(wrap-program) bug

DoneSubmitted by Prafulla Giri.
Details
2 participants
  • Julien Lepiller
  • Prafulla Giri
Owner
unassigned
Severity
normal
P
P
Prafulla Giri wrote on 20 Aug 2020 13:59
(address . bug-guix@gnu.org)
CAFw+=j1g34Xk9FKw6FMuXNjvDEYnRKoi1ikD4je3n3_GXmBnPw@mail.gmail.com
Esteemed maintainers,
It seems that (wrap-program ...) over-writes the previous wrapping of apackage done by the build system.
This does not happen for many (wrap-programs) called in the modify-phasessection of the package definition itself.
Attached is a package definition for ruby-ronn-ng, that demonstrates thisissue. The custom (wrap-program)-scalled from the package definition seem to over-write the definitions ofGEM_ENV as made by the 'wrap %standard-phaseof the ruby-build system.The wrappings made by 'wrap %standard-phase can be seen during the custom'DEBUG phase. The subsequent 'wrap-program1and 'wrap-program2 add more environment variables to the wrapping, but onchecking the contents of `which ronn`, onceit is installed (using `less $(which ronn)`), it can be verified that theGEM_ENV package definitions have been overwritten.
This may just be a ruby-build-system issue. Or perhaps it might besomething that permeates over a few more build systems.That still remains to be tested.
Attached are a few different versions of the package definitions forruby-ronn-ng for the ease of those who would like toverify this.1. ruby-ronn-ng-standalone.scm : To be tested using `guix time-machine --build --verbosity=2 --file=ruby-ronn-ng-standalone.scm`[1]2. ruby-ronn-ng.scm : To be appended to the end of thegnu/packages/ruby.scm file in local guix checkout, and be tested using thelocal version3. ruby-ronn-ng.patch : To be applied to local guix checkout
[1] - This package definition needs ruby-mustache, which has only recentlybeen added to guix. Hence, the time-machine.
NOTE: `ronn` does not work even with `propagated-inputs`. See this patch asto why:https://aur.archlinux.org/cgit/aur.git/tree/0001-allow-mustache-1.0.patch?h=ruby-ronn-ng
Attachment: file
Toggle diff (61 lines)diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scmindex 010028082a..5797b7cb9d 100644--- a/gnu/packages/ruby.scm+++ b/gnu/packages/ruby.scm@@ -11659,3 +11659,56 @@ which snapshots to consider and what files to include.") defined in @file{.travis.yml} on your local machine, using @code{rvm}, @code{rbenv}, or @code{chruby} to test different versions of Ruby.") (license license:expat)))++(define-public ruby-ronn-ng+ (package+ (name "ruby-ronn-ng")+ (version "0.9.1")+ (home-page "asdf")+ (source+ (origin+ (method url-fetch)+ (uri (rubygems-uri "ronn-ng" version))+ (sha256+ (base32+ "1slxfg57cabmh98fw507z4ka6lwq1pvbrqwppflxw6700pi8ykfh"))))+ (build-system ruby-build-system)+ (arguments+ `(#:phases+ (modify-phases %standard-phases+ ;; Debug phase, just to show that before any of this wrapping, the standard ruby 'wrap phase has+ ;; already done it's job, AND it gets over-written, for some strange reason. The (wrappings)+ ;; defined in the package itself don't seem to over-write each other. Hmm.+ (add-after+ 'wrap 'DEBUG+ (lambda _+ (pk "Hey there, I'm closer than I appear!")+ (invoke "cat" (string-append (assoc-ref %outputs "out") "/bin/.ronn-real"))+ #t))+ (add-after+ 'wrap 'wrap-program2+ (lambda* (#:key outputs #:allow-other-keys)+ (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn")))+ (begin (display %build-inputs)(newline))+ (wrap-program prog+ `("PATH" ":" suffix ,(map (lambda (exp_inpt)+ (string-append (assoc-ref %build-inputs exp_inpt) "/bin"))+ '("ruby-kramdown" "ruby-mustache" "ruby-nokogiri")))))+ #t))+ (add-after+ 'wrap 'wrap-program1+ (lambda* (#:key outputs #:allow-other-keys)+ (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn")))+ (wrap-program prog+ `("FOO" ":" = ("BAR"))))#t))+ ;; another add-after may go here+ )))+ (inputs ;; note to self: these were propagated-inputs before+ `(("ruby-kramdown" ,ruby-kramdown)+ ("ruby-mustache" ,ruby-mustache)+ ("ruby-nokogiri" ,ruby-nokogiri)))+ (synopsis+ "Ronn-NG builds manuals in HTML and Unix man page format from Markdown.")+ (description+ "Ronn-NG builds manuals in HTML and Unix man page format from Markdown.")+ (license license:expat))) ;; license and home-page are mock values here
(define-public ruby-ronn-ng (package (name "ruby-ronn-ng") (version "0.9.1") (home-page "asdf") (source (origin (method url-fetch) (uri (rubygems-uri "ronn-ng" version)) (sha256 (base32 "1slxfg57cabmh98fw507z4ka6lwq1pvbrqwppflxw6700pi8ykfh")))) (build-system ruby-build-system) (arguments `(#:phases (modify-phases %standard-phases ;; Debug phase, just to show that before any of this wrapping, the standard ruby 'wrap phase has ;; already done it's job, AND it gets over-written, for some strange reason. The (wrappings) ;; defined in the package itself don't seem to over-write each other. Hmm. (add-after 'wrap 'DEBUG (lambda _ (pk "Hey there, I'm closer than I appear!") (invoke "cat" (string-append (assoc-ref %outputs "out") "/bin/.ronn-real")) #t)) (add-after 'wrap 'wrap-program2 (lambda* (#:key outputs #:allow-other-keys) (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn"))) (begin (display %build-inputs)(newline)) (wrap-program prog `("PATH" ":" suffix ,(map (lambda (exp_inpt) (string-append (assoc-ref %build-inputs exp_inpt) "/bin")) '("ruby-kramdown" "ruby-mustache" "ruby-nokogiri"))))) #t)) (add-after 'wrap 'wrap-program1 (lambda* (#:key outputs #:allow-other-keys) (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn"))) (wrap-program prog `("FOO" ":" = ("BAR"))))#t)) ;; another add-after may go here ))) (inputs ;; note to self: these were propagated-inputs before `(("ruby-kramdown" ,ruby-kramdown) ("ruby-mustache" ,ruby-mustache) ("ruby-nokogiri" ,ruby-nokogiri))) (synopsis "Ronn-NG builds manuals in HTML and Unix man page format from Markdown.") (description "Ronn-NG builds manuals in HTML and Unix man page format from Markdown.") (license license:expat))) ;; license and home-page are mock values here
(use-modules (guix packages) (guix download) (guix build-system ruby) ((guix licenses) #:prefix license:) (gnu packages ruby)) (define ruby-ronn-ng (package (name "ruby-ronn-ng") (version "0.9.1") (home-page "asdf") (source (origin (method url-fetch) (uri (rubygems-uri "ronn-ng" version)) (sha256 (base32 "1slxfg57cabmh98fw507z4ka6lwq1pvbrqwppflxw6700pi8ykfh")))) (build-system ruby-build-system) (arguments `(#:phases (modify-phases %standard-phases ;; Debug phase, just to show that before any of this wrapping, the standard ruby 'wrap phase has ;; already done it's job, AND it gets over-written, for some strange reason. The (wrappings) ;; defined in the package itself don't seem to over-write each other. Hmm. (add-after 'wrap 'DEBUG (lambda _ (pk "Hey there, I'm closer than I appear!") (invoke "cat" (string-append (assoc-ref %outputs "out") "/bin/.ronn-real")) #t)) (add-after 'wrap 'wrap-program2 (lambda* (#:key outputs #:allow-other-keys) (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn"))) (begin (display %build-inputs)(newline)) (wrap-program prog `("PATH" ":" suffix ,(map (lambda (exp_inpt) (string-append (assoc-ref %build-inputs exp_inpt) "/bin")) '("ruby-kramdown" "ruby-mustache" "ruby-nokogiri"))))) #t)) (add-after 'wrap 'wrap-program1 (lambda* (#:key outputs #:allow-other-keys) (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn"))) (wrap-program prog `("FOO" ":" = ("BAR"))))#t)) ;; another add-after may go here ))) (inputs ;; note to self: these were propagated-inputs before `(("ruby-kramdown" ,ruby-kramdown) ("ruby-mustache" ,ruby-mustache) ("ruby-nokogiri" ,ruby-nokogiri))) (synopsis "Ronn-NG builds manuals in HTML and Unix man page format from Markdown.") (description "Ronn-NG builds manuals in HTML and Unix man page format from Markdown.") (license license:expat))) ;; license and home-page are mock values here ruby-ronn-ng
J
J
Julien Lepiller wrote on 20 Aug 2020 14:31
(name . Prafulla Giri)(address . pratheblackdiamond@gmail.com)(address . 42948@debbugs.gnu.org)
20200820143158.51e8b321@tachikoma.lepiller.eu
Le Thu, 20 Aug 2020 17:44:01 +0545,Prafulla Giri <pratheblackdiamond@gmail.com> a écrit :
Toggle quote (41 lines)> Esteemed maintainers,> > It seems that (wrap-program ...) over-writes the previous wrapping of> a package done by the build system.> > This does not happen for many (wrap-programs) called in the> modify-phases section of the package definition itself.> > Attached is a package definition for ruby-ronn-ng, that demonstrates> this issue. The custom (wrap-program)-s> called from the package definition seem to over-write the definitions> of GEM_ENV as made by the 'wrap %standard-phase> of the ruby-build system.> The wrappings made by 'wrap %standard-phase can be seen during the> custom 'DEBUG phase. The subsequent 'wrap-program1> and 'wrap-program2 add more environment variables to the wrapping,> but on checking the contents of `which ronn`, once> it is installed (using `less $(which ronn)`), it can be verified that> the GEM_ENV package definitions have been overwritten.> > This may just be a ruby-build-system issue. Or perhaps it might be> something that permeates over a few more build systems.> That still remains to be tested.> > Attached are a few different versions of the package definitions for> ruby-ronn-ng for the ease of those who would like to> verify this.> 1. ruby-ronn-ng-standalone.scm : To be tested using `guix> time-machine -- build --verbosity=2> --file=ruby-ronn-ng-standalone.scm`[1] 2. ruby-ronn-ng.scm : To be> appended to the end of the gnu/packages/ruby.scm file in local guix> checkout, and be tested using the local version> 3. ruby-ronn-ng.patch : To be applied to local guix checkout> > [1] - This package definition needs ruby-mustache, which has only> recently been added to guix. Hence, the time-machine.> > NOTE: `ronn` does not work even with `propagated-inputs`. See this> patch as to why:> https://aur.archlinux.org/cgit/aur.git/tree/0001-allow-mustache-1.0.patch?h=ruby-ronn-ng
Hi,
From what I see, there is no issue here (unless I'm missing something).In the built package, I see bin/ronn is a shell wrapper that definesthe PATH and FOO environment variables and calls bin/.ronn-real.bin/.ronn-real itself is a ruby script that defines GEM_PATH and callsbin/.real/ronn, which is the actual program.
I don't see anything wrong with that, but I'm not a ruby expert. Infact, when running ronn (from its store path directly), I see thefollowing error:
/gnu/store/9yqh0g1p5bmxar8dlfp84j4py3j631jv-ruby-2.6.5/lib/ruby/2.6.0/rubygems/dependency.rb:313:in`to_specs': Could not find 'mustache' (>= 0.7.0, ~> 0.7) - did find:[mustache-1.1.1] (Gem::MissingSpecVersionError) Checked in'GEM_PATH=/gnu/store/l8jicf1ibzrgff754mvbc5k14fa62s7a-ruby-ronn-ng-0.9.1/lib/ruby/vendor_ruby:/gnu/store/9yqh0g1p5bmxar8dlfp84j4py3j631jv-ruby-2.6.5/lib/ruby/vendor_ruby:/gnu/store/w1a9ndhvvbw76g19fgx4j78kx3aghi4k-ruby-kramdown-2.3.0/lib/ruby/vendor_ruby:/gnu/store/jfbzrfd7i8x46q9c8sw26av6kx7jyr3c-ruby-mustache-1.1.1/lib/ruby/vendor_ruby:/gnu/store/0wsy4yymr5m0wzms0qv5ak5q21g8c6hs-ruby-nokogiri-1.10.9/lib/ruby/vendor_ruby:/gnu/store/7ncf7v5prhv4ir8bgdlxa1rz8ph5mlry-ruby-pkg-config-1.2.5/lib/ruby/vendor_ruby:/gnu/store/924np2k8f04lfjr6l9hzic7drah8bgbb-ruby-mini-portile-2.4.0/lib/ruby/vendor_ruby:/gnu/store/9yqh0g1p5bmxar8dlfp84j4py3j631jv-ruby-2.6.5/lib/ruby/gems/2.6.0',execute `gem env` for more information
which suggests that the GEM_PATH is set correctly (after all it foundmustache), but the dependencies do not have the expected version. Doesthat make sense?
P
P
Prafulla Giri wrote on 20 Aug 2020 17:15
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 42948@debbugs.gnu.org)
CAFw+=j3FhPEE=KNfDWg0sktrzfafabkmvnpnUS=XZ+WWUb3TRw@mail.gmail.com
Yes, you are correct. This turned out to be a false alarm. I poked aroundwith the definition, and, just like you said, everything works.
`ronn` not running was a gempspec issue that I have resolved in the packagedefinition (patch attached).
Thank you very much for clearing the matter out!
On Thu, Aug 20, 2020 at 6:17 PM Julien Lepiller <julien@lepiller.eu> wrote:
Toggle quote (69 lines)> Le Thu, 20 Aug 2020 17:44:01 +0545,> Prafulla Giri <pratheblackdiamond@gmail.com> a écrit :>> > Esteemed maintainers,> >> > It seems that (wrap-program ...) over-writes the previous wrapping of> > a package done by the build system.> >> > This does not happen for many (wrap-programs) called in the> > modify-phases section of the package definition itself.> >> > Attached is a package definition for ruby-ronn-ng, that demonstrates> > this issue. The custom (wrap-program)-s> > called from the package definition seem to over-write the definitions> > of GEM_ENV as made by the 'wrap %standard-phase> > of the ruby-build system.> > The wrappings made by 'wrap %standard-phase can be seen during the> > custom 'DEBUG phase. The subsequent 'wrap-program1> > and 'wrap-program2 add more environment variables to the wrapping,> > but on checking the contents of `which ronn`, once> > it is installed (using `less $(which ronn)`), it can be verified that> > the GEM_ENV package definitions have been overwritten.> >> > This may just be a ruby-build-system issue. Or perhaps it might be> > something that permeates over a few more build systems.> > That still remains to be tested.> >> > Attached are a few different versions of the package definitions for> > ruby-ronn-ng for the ease of those who would like to> > verify this.> > 1. ruby-ronn-ng-standalone.scm : To be tested using `guix> > time-machine -- build --verbosity=2> > --file=ruby-ronn-ng-standalone.scm`[1] 2. ruby-ronn-ng.scm : To be> > appended to the end of the gnu/packages/ruby.scm file in local guix> > checkout, and be tested using the local version> > 3. ruby-ronn-ng.patch : To be applied to local guix checkout> >> > [1] - This package definition needs ruby-mustache, which has only> > recently been added to guix. Hence, the time-machine.> >> > NOTE: `ronn` does not work even with `propagated-inputs`. See this> > patch as to why:> >> https://aur.archlinux.org/cgit/aur.git/tree/0001-allow-mustache-1.0.patch?h=ruby-ronn-ng>> Hi,>> From what I see, there is no issue here (unless I'm missing something).> In the built package, I see bin/ronn is a shell wrapper that defines> the PATH and FOO environment variables and calls bin/.ronn-real.> bin/.ronn-real itself is a ruby script that defines GEM_PATH and calls> bin/.real/ronn, which is the actual program.>> I don't see anything wrong with that, but I'm not a ruby expert. In> fact, when running ronn (from its store path directly), I see the> following error:>>> /gnu/store/9yqh0g1p5bmxar8dlfp84j4py3j631jv-ruby-2.6.5/lib/ruby/2.6.0/rubygems/dependency.rb:313:in> `to_specs': Could not find 'mustache' (>= 0.7.0, ~> 0.7) - did find:> [mustache-1.1.1] (Gem::MissingSpecVersionError) Checked in>> 'GEM_PATH=/gnu/store/l8jicf1ibzrgff754mvbc5k14fa62s7a-ruby-ronn-ng-0.9.1/lib/ruby/vendor_ruby:/gnu/store/9yqh0g1p5bmxar8dlfp84j4py3j631jv-ruby-2.6.5/lib/ruby/vendor_ruby:/gnu/store/w1a9ndhvvbw76g19fgx4j78kx3aghi4k-ruby-kramdown-2.3.0/lib/ruby/vendor_ruby:/gnu/store/jfbzrfd7i8x46q9c8sw26av6kx7jyr3c-ruby-mustache-1.1.1/lib/ruby/vendor_ruby:/gnu/store/0wsy4yymr5m0wzms0qv5ak5q21g8c6hs-ruby-nokogiri-1.10.9/lib/ruby/vendor_ruby:/gnu/store/7ncf7v5prhv4ir8bgdlxa1rz8ph5mlry-ruby-pkg-config-1.2.5/lib/ruby/vendor_ruby:/gnu/store/924np2k8f04lfjr6l9hzic7drah8bgbb-ruby-mini-portile-2.4.0/lib/ruby/vendor_ruby:/gnu/store/9yqh0g1p5bmxar8dlfp84j4py3j631jv-ruby-2.6.5/lib/ruby/gems/2.6.0',> execute `gem env` for more information>> which suggests that the GEM_PATH is set correctly (after all it found> mustache), but the dependencies do not have the expected version. Does> that make sense?>
Attachment: file
Toggle diff (51 lines)diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scmindex 010028082a..0a245855ee 100644--- a/gnu/packages/ruby.scm+++ b/gnu/packages/ruby.scm@@ -11659,3 +11659,46 @@ which snapshots to consider and what files to include.") defined in @file{.travis.yml} on your local machine, using @code{rvm}, @code{rbenv}, or @code{chruby} to test different versions of Ruby.") (license license:expat)))++(define-public ruby-ronn-ng+ (package+ (name "ruby-ronn-ng")+ (version "0.9.1")+ (source+ (origin+ (method url-fetch)+ (uri (rubygems-uri "ronn-ng" version))+ (sha256+ (base32+ "1slxfg57cabmh98fw507z4ka6lwq1pvbrqwppflxw6700pi8ykfh"))))+ (build-system ruby-build-system)+ (arguments+ `(#:phases+ (modify-phases %standard-phases+ (add-after+ 'extract-gemspec 'fix-gemspec-mustache+ (lambda _+ (substitute* "ronn-ng.gemspec"+ (("(<mustache>.freeze.*~>).*(\".*$)" all start end)+ (string-append start " 1.0" end)))+ #t))+ (add-after+ 'wrap 'wrap-program+ (lambda* (#:key outputs #:allow-other-keys)+ (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn")))+ (begin (display %build-inputs)(newline))+ (wrap-program prog+ `("PATH" ":" suffix ,(map (lambda (exp_inpt)+ (string-append (assoc-ref %build-inputs exp_inpt) "/bin"))+ '("ruby-kramdown" "ruby-mustache" "ruby-nokogiri")))))+ #t)) )))+ (inputs+ `(("ruby-kramdown" ,ruby-kramdown)+ ("ruby-mustache" ,ruby-mustache)+ ("ruby-nokogiri" ,ruby-nokogiri)))+ (synopsis+ "Ronn-NG builds manuals in HTML and Unix man page format from Markdown.")+ (description+ "Ronn-NG builds manuals in HTML and Unix man page format from Markdown.")+ (home-page "https://github.com/apjanke/ronn-ng")+ (license license:expat)))
J
J
Julien Lepiller wrote on 20 Aug 2020 18:57
5ECBDDD2-2FDC-4386-9564-8DF12218D0DB@lepiller.eu
I see you've posted your patch in another thread, so I'm closing this one as it was a false alarm. Thank you!
On 2020年8月20日 7:59:01 GMT-04:00, Prafulla Giri <pratheblackdiamond@gmail.com> wrote:
Toggle quote (50 lines)>Esteemed maintainers,>>It seems that (wrap-program ...) over-writes the previous wrapping of a>package done by the build system.>>This does not happen for many (wrap-programs) called in the>modify-phases>section of the package definition itself.>>Attached is a package definition for ruby-ronn-ng, that demonstrates>this>issue. The custom (wrap-program)-s>called from the package definition seem to over-write the definitions>of>GEM_ENV as made by the 'wrap %standard-phase>of the ruby-build system.>The wrappings made by 'wrap %standard-phase can be seen during the>custom>'DEBUG phase. The subsequent 'wrap-program1>and 'wrap-program2 add more environment variables to the wrapping, but>on>checking the contents of `which ronn`, once>it is installed (using `less $(which ronn)`), it can be verified that>the>GEM_ENV package definitions have been overwritten.>>This may just be a ruby-build-system issue. Or perhaps it might be>something that permeates over a few more build systems.>That still remains to be tested.>>Attached are a few different versions of the package definitions for>ruby-ronn-ng for the ease of those who would like to>verify this.>1. ruby-ronn-ng-standalone.scm : To be tested using `guix time-machine>-->build --verbosity=2 --file=ruby-ronn-ng-standalone.scm`[1]>2. ruby-ronn-ng.scm : To be appended to the end of the>gnu/packages/ruby.scm file in local guix checkout, and be tested using>the>local version>3. ruby-ronn-ng.patch : To be applied to local guix checkout>>[1] - This package definition needs ruby-mustache, which has only>recently>been added to guix. Hence, the time-machine.>>NOTE: `ronn` does not work even with `propagated-inputs`. See this>patch as>to why:>https://aur.archlinux.org/cgit/aur.git/tree/0001-allow-mustache-1.0.patch?h=ruby-ronn-ng
Attachment: file
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 42948@debbugs.gnu.org