From steve at finagle.org Sun Apr 13 19:07:16 2008 From: steve at finagle.org (Steve Sloan) Date: Sun, 13 Apr 2008 16:07:16 -0700 Subject: [Ruby-rpm-devel] RPM build broken? Message-ID: <48029224.4060701@finagle.org> I've constructed a package build system using rake and calling rpm (v4.4.2) and rpmbuild via IO.popen. I was ecstatic to discover ruby-rpm, if for no other reason than the huge speed improvement over shell calls. However, I've run into some significant differences in behavior: 1. Using RPM::Spec, the package OS is 'gnu-linux' instead of 'linux'. This prevents built packages from being installed. I've hacked around this by calling rpmbuild instead of RPM::Spec.build. 2. The package arch also defaults to 'i686' instead of 'i386'. I use "pkg.sprintf(RPM::expand('%_build_name_fmt'))" to determine the RPM filenames, but this has the wrong arch. Since I do have one package (kernel module) that is i686, I can't really hack around this one. 3. I'm creating about a dozen RPM::Specs, but when building, they all get the same BuildRoot macro value (it appears they all get the value of the first spec to load). This doesn't actually break anything. Please let me know if there are any work-arounds (or if I'm just doing it wrong). Thanks ... -- Steve From lutter at watzmann.net Tue Apr 15 17:30:32 2008 From: lutter at watzmann.net (David Lutterkort) Date: Tue, 15 Apr 2008 21:30:32 +0000 Subject: [Ruby-rpm-devel] RPM build broken? In-Reply-To: <48029224.4060701@finagle.org> References: <48029224.4060701@finagle.org> Message-ID: <1208295032.3904.164.camel@localhost.localdomain> On Sun, 2008-04-13 at 16:07 -0700, Steve Sloan wrote: > I've constructed a package build system using rake and calling rpm > (v4.4.2) and rpmbuild via IO.popen. I was ecstatic to discover ruby-rpm, > if for no other reason than the huge speed improvement over shell calls. Excellent ! I don't have an actual i386 machine around, so my experiments below are from within a i386 build root: > 1. Using RPM::Spec, the package OS is 'gnu-linux' instead of 'linux'. > This prevents built packages from being installed. I've hacked around > this by calling rpmbuild instead of RPM::Spec.build. What exactly do you mean by this ? When I try s1 = RPM::Spec.open("/tmp/puppet.spec") s1.expand_macros("_os") I get "linux". Are you trying something else ? > 2. The package arch also defaults to 'i686' instead of 'i386'. I use > "pkg.sprintf(RPM::expand('%_build_name_fmt'))" to determine the RPM > filenames, but this has the wrong arch. Since I do have one package > (kernel module) that is i686, I can't really hack around this one. I couldn't reproduce that either: pkg = RPM::package.open("/tmp/augeas-0.0.5-1.fc9.i386.rpm") pkg.sprintf(RPM::expand('%_build_name_fmt')) => "i386/augeas-0.0.5-1.fc9.i386.rpm" Are you sure this is caused by ruby-rpm and not by any differences in .rpmmacros when you are running your build system ? > 3. I'm creating about a dozen RPM::Specs, but when building, they all > get the same BuildRoot macro value (it appears they all get the value of > the first spec to load). This doesn't actually break anything. Yes, that's happening to me, too. Though the code within ruby-rpm seems to be doing the right things. It might be that RPM can't handle multiple settings of those values in one transaction. David From steve at finagle.org Tue Apr 15 18:41:35 2008 From: steve at finagle.org (Steve Sloan) Date: Tue, 15 Apr 2008 15:41:35 -0700 Subject: [Ruby-rpm-devel] RPM build broken? In-Reply-To: <1208295032.3904.164.camel@localhost.localdomain> References: <48029224.4060701@finagle.org> <1208295032.3904.164.camel@localhost.localdomain> Message-ID: <48052F1F.7050103@finagle.org> David Lutterkort wrote: >> 1. Using RPM::Spec, the package OS is 'gnu-linux' instead of 'linux'. >> This prevents built packages from being installed. I've hacked around >> this by calling rpmbuild instead of RPM::Spec.build. > > What exactly do you mean by this ? When I try > s1 = RPM::Spec.open("/tmp/puppet.spec") > s1.expand_macros("_os") > I get "linux". Are you trying something else ? No, that works for me. However, "s1.packages.first.sprintf '%{os}'" always gives me 'linux-gnu'. >> 2. The package arch also defaults to 'i686' instead of 'i386'. I use >> "pkg.sprintf(RPM::expand('%_build_name_fmt'))" to determine the RPM >> filenames, but this has the wrong arch. Since I do have one package >> (kernel module) that is i686, I can't really hack around this one. > > I couldn't reproduce that either: > pkg = RPM::package.open("/tmp/augeas-0.0.5-1.fc9.i386.rpm") > pkg.sprintf(RPM::expand('%_build_name_fmt')) > => "i386/augeas-0.0.5-1.fc9.i386.rpm" That also works for me (opening existing RPMs). However, a spec file (e.g. "s1.packages.first.sprintf '%{arch}'") always defaults to i686. FYI, I'm actually doing: class RPM::Package def path @@build_name_fmt ||= RPM::expand '%_rpmdir/%_build_name_fmt' @path ||= sprintf @@build_name_fmt end end > Are you sure this is caused by ruby-rpm and not by any differences > in .rpmmacros when you are running your build system ? $ mv ~/.rpmmacros ~/_rpmmacros $ ./test.rb Yeah, I'm pretty sure. ;) > Yes, that's happening to me, too. Though the code within ruby-rpm seems > to be doing the right things. It might be that RPM can't handle multiple > settings of those values in one transaction. I don't really know librpm at all. Would a call to init_macros (and/or reloading the spec) between each build do right thing? -- Steve From lutter at watzmann.net Wed Apr 16 13:50:55 2008 From: lutter at watzmann.net (David Lutterkort) Date: Wed, 16 Apr 2008 10:50:55 -0700 Subject: [Ruby-rpm-devel] RPM build broken? In-Reply-To: <48052F1F.7050103@finagle.org> References: <48029224.4060701@finagle.org> <1208295032.3904.164.camel@localhost.localdomain> <48052F1F.7050103@finagle.org> Message-ID: <1208368255.17168.3.camel@localhost.localdomain> On Tue, 2008-04-15 at 15:41 -0700, Steve Sloan wrote: > > Yes, that's happening to me, too. Though the code within ruby-rpm seems > > to be doing the right things. It might be that RPM can't handle multiple > > settings of those values in one transaction. > > I don't really know librpm at all. Would a call to init_macros (and/or > reloading the spec) between each build do right thing? Hmm ... good question; I have a suspicion that this needs to be looked at by a real expert on RPM (i.e., not me ;) >From looking at the ruby-rpm bindings, they are just fairly thin wrappers around rpmlib, so I am doubtful they are causing the problems. It seems to me that the trouble is more that there are restrictions in rpmlib that ruby-rpm makes too easy to violate (or impossible to not violate) - but I don't know what they are. David