[opensuse-go] simplify rpmsysinfo.rb
1. why not hook onto RbConfig::CONFIG['libdir']? it has the value for us already :) then only the goarch stuff would need to be in the conditional 2. we could get the BUILDROOT and stuff from the environment ... no need to guess it. or am I missing something? darix -- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org -- To unsubscribe, e-mail: opensuse-go+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-go+owner@opensuse.org
On 05/31/2016 06:01 PM, Marcus Rückert wrote:
1. why not hook onto RbConfig::CONFIG['libdir']?
it has the value for us already :)
then only the goarch stuff would need to be in the conditional
+1
2. we could get the BUILDROOT and stuff from the environment ... no need to guess it. or am I missing something?
I don't know. Could you create a Pull Request so we can discuss it there and merge it if appropiate? thanks
darix
-- To unsubscribe, e-mail: opensuse-go+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-go+owner@opensuse.org
On 05/31/2016 06:01 PM, Marcus Rückert wrote: 1. why not hook onto RbConfig::CONFIG['libdir']?
it has the value for us already :)
then only the goarch stuff would need to be in the conditional
+1
I wrote those codes with SLE 11 SP3 in mind. It uses ruby 1.8. RbConfig was introduced in ruby 1.9. It means we need redundant codes to detect ruby versions. Anyway we have to support SLE and there's a conditional, why not bother myself:-)
2. we could get the BUILDROOT and stuff from the environment ... no need to guess it. or am I missing something?
I don't know.
Could you create a Pull Request so we can discuss it there and merge it if appropiate?
thanks
ENV['RPM_BUILD_ROOT'] may save us a lot of work. I have already used ENV['HOME'] for loguser, just didn't come up that environment variable at that time. Will test and PR. Marguerite -- To unsubscribe, e-mail: opensuse-go+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-go+owner@opensuse.org
On Tue, 7 Jun 2016 01:56:56 +0800 marguerite wrote:
On 05/31/2016 06:01 PM, Marcus Rückert wrote: 1. why not hook onto RbConfig::CONFIG['libdir']?
it has the value for us already :)
then only the goarch stuff would need to be in the conditional
+1
I wrote those codes with SLE 11 SP3 in mind.
It uses ruby 1.8.
RbConfig was introduced in ruby 1.9.
It means we need redundant codes to detect ruby versions.
Anyway we have to support SLE and there's a conditional, why not bother myself:-)
actually RbConfig is really really old :) it also works on ruby 1.8 $ ruby -v -r rbconfig -e "puts RbConfig::CONFIG['libdir']" ruby 1.8.7 (2011-12-28 patchlevel 357) [x86_64-linux] /usr/lib64 hth darix -- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org -- To unsubscribe, e-mail: opensuse-go+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-go+owner@opensuse.org
在 2016年6月7日,02:11,Marcus Rückert
写道: On Tue, 7 Jun 2016 01:56:56 +0800 marguerite wrote:
On 05/31/2016 06:01 PM, Marcus Rückert wrote: 1. why not hook onto RbConfig::CONFIG['libdir']?
it has the value for us already :)
then only the goarch stuff would need to be in the conditional
+1
I wrote those codes with SLE 11 SP3 in mind.
It uses ruby 1.8.
RbConfig was introduced in ruby 1.9.
It means we need redundant codes to detect ruby versions.
Anyway we have to support SLE and there's a conditional, why not bother myself:-)
actually RbConfig is really really old :) it also works on ruby 1.8
$ ruby -v -r rbconfig -e "puts RbConfig::CONFIG['libdir']" ruby 1.8.7 (2011-12-28 patchlevel 357) [x86_64-linux] /usr/lib64
I hope I can have a SLE... I read ruby-doc.com, the oldest doc showed 1.9.2. I manually wrote lots of such less efficient codes for ruby 1.8.7 which I don't have (this project was done at my office, with ssh to a VPS) Will drop them Marguerite -- To unsubscribe, e-mail: opensuse-go+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-go+owner@opensuse.org
RPM environment variables are not avaiable when finding Provides/Requires. Because at that time RPMs have actually been created. See here: https://build.opensuse.org/package/live_build_log/home:MargueriteSu:branches... run "ruby /usr/lib/rpm/golang.prov" in %install section will get : "/home/abuild/rpmbuild/SOURCES" while still: [ 86s] Finding Provides: /usr/lib/rpm/golang.prov [ 86s] /usr/lib/rpm/golang/rpmsysinfo.rb:76:in `get_go_importpath': undefined method `+' for nil:NilClass (NoMethodError) [ 86s] from /usr/lib/rpm/golang.prov:8:in `<main>' [ 86s] error: /usr/lib/rpm/golang.prov failed: 100 [ 86s] error: Failed to find Provides: line 76 is: + importpath, sourcedir = "", ENV["RPM_SOURCE_DIR"] + p sourcedir - specfile = Dir.glob(@@topdir + "/SOURCES/*.spec")[0] + specfile = Dir.glob(sourcedir + "/*.spec")[0] I think we need to guess @@topdir anyway. Modified rpmsysinfo.rb here: https://build.opensuse.org/package/rdiff/home:MargueriteSu:branches:devel:languages:go/golang-packaging?opackage=golang-packaging&oproject=devel%3Alanguages%3Ago&rev=9 Marguerite -- To unsubscribe, e-mail: opensuse-go+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-go+owner@opensuse.org
I just use a clever workaround to simplify go_get_importpath function in rpmsysinfo.rb. See my commit. Next we have to discuss the removal of golang(API). then I'll release. Marguerite On Tue, Jun 7, 2016 at 11:18 AM, Marguerite Su wrote:
RPM environment variables are not avaiable when finding Provides/Requires.
Because at that time RPMs have actually been created.
See here:
https://build.opensuse.org/package/live_build_log/home:MargueriteSu:branches...
run "ruby /usr/lib/rpm/golang.prov" in %install section will get :
"/home/abuild/rpmbuild/SOURCES"
while still:
[ 86s] Finding Provides: /usr/lib/rpm/golang.prov [ 86s] /usr/lib/rpm/golang/rpmsysinfo.rb:76:in `get_go_importpath': undefined method `+' for nil:NilClass (NoMethodError) [ 86s] from /usr/lib/rpm/golang.prov:8:in `<main>' [ 86s] error: /usr/lib/rpm/golang.prov failed: 100 [ 86s] error: Failed to find Provides:
line 76 is:
+ importpath, sourcedir = "", ENV["RPM_SOURCE_DIR"] + p sourcedir - specfile = Dir.glob(@@topdir + "/SOURCES/*.spec")[0] + specfile = Dir.glob(sourcedir + "/*.spec")[0]
I think we need to guess @@topdir anyway.
Modified rpmsysinfo.rb here: https://build.opensuse.org/package/rdiff/home:MargueriteSu:branches:devel:languages:go/golang-packaging?opackage=golang-packaging&oproject=devel%3Alanguages%3Ago&rev=9
Marguerite -- To unsubscribe, e-mail: opensuse-go+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-go+owner@opensuse.org
participants (4)
-
Jordi Massaguer Pla
-
Marcus Rückert
-
marguerite
-
Marguerite Su