Bugzilla – Bug 19
$BOGO_RPM_SHORT_CIRCUIT SRPMS placed into production
Last modified: 2001-01-08 02:30:42 CST
You need to log in before you can comment on or make changes to this bug.
I would *STRONGLY* suggest that $BOGO_RPM_SHORT_CIRCUIT not be used for anything other than development. The vast majority of people expect RPM to work a certain way and this completely breaks the status quo. For instance, I expect to be able to take an SRPM package, install it, and do an 'rpm -ba <package-name>.spec' to rebuild the package on my machine and NOT get error message like this: <snip> Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.30650 + umask 022 + cd /usr/src/redhat/BUILD + test no = no + cd sysadm_base-1.3.4 + test -f ../../../../../libtool + cp ../../../../../config.status . cp: ../../../../../config.status: No such file or directory Bad exit status from /var/tmp/rpm-tmp.30650 (%build) OK, so again, this is from Rhino, but still, this is also the root of the problem with the rpm.spec naming problem. This is what the sysadm_base rpm.spec file says: # DO NOT EDIT rpm.spec - edit rpm.spec.in instead. rpm.spec is generated # from rpm.spec.in by the configure script generated by autoconf. Sorry, this doesn't fly very well. Dan
> The vast majority of people expect RPM to work a certain way and this > completely breaks the status quo. For instance, I expect to be able to > take an SRPM package, install it, and do an 'rpm -ba <package-name>.spec' > to rebuild the package on my machine and NOT get error message like this: All right, that's good to know; I'll look at making this work the way you expect. (How do you pass arguments to the configure script that way, like --prefix and --sysconfdir? Is it customary to just hard-code those to --prefix=/usr --sysconfdir=/etc, or leave the defaults? sysadm_failsafe can handle sysadm_base being installed in /usr/local instead of /usr because it uses autoconf & automake, but I don't think the failsafe back-end stuff can handle that.)
Meant to assign this to myself.
Also, just to clarify what BOGO_RPM_SHORT_CIRCUIT does: it's only used during development (specifically, when you're modifying the layout of the files in your packages, your post-install scripts, or other stuff specific to the packages themselves), and it prints big warnings when it's set. If you set BOGO_RPM_SHORT_CIRCUIT to the DESTDIR where you've done a "make DESTDIR=... install", it just copies the installed files so that you don't have to sit through configure...build...install... when working on your spec file. So this problem doesn't have anything to do with BOGO_RPM_SHORT_CIRCUIT; the problem is that the spec file is attempting to use the config.status generated by the configure script. (That way, you unpack your tarball, run "configure --whatever", and then run "make rpm" to build RPM packages using the configuration you just chose.) It should be easy to make the build rule just run configure instead of config.status if config.status isn't there (so that it will work the way you expect), but see my question in the previous add about arguments to the configure script. Also, about this comment: > # DO NOT EDIT rpm.spec - edit rpm.spec.in instead. rpm.spec is generated > # from rpm.spec.in by the configure script generated by autoconf. > > Sorry, this doesn't fly very well. This is necessary so that if you run configure --prefix=/opt, the generated rpm.spec has /opt/lib/libfoo.so; hard-coding /usr/lib/libfoo.so or /usr/local/lib/libfoo.so would be broken. Is there a better way to use variable paths with RPM?
If I remember correctly, you should be able to leave the defaults when you configure the Makefile and then use a "Prefix" tag in the spec file to relocate the files to where you want them. Read up on the details here: http://rpmdp.org/rpmbook/node80.html. more...
Regarding the BOGO_RPM_... issue: You're logic is marred in this bit of scripting in the sysadm_base.spc file: if test "no$BOGO_RPM_SHORT_CIRCUIT" = "no"; then \ cd %{fullname}; \ test -f ../../../../../libtool && cp ../../../../../libtool . ; \ cp ../../../../../config.status . ; \ ./config.status; \ make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"; \ else \ echo "DANGER %build SKIPPED BECAUSE \$BOGO_RPM_SHORT_CIRCUIT IS SET!"; \ fi In either instance you assume that BOGO_RPM_... is set. The problem lies in the "cp ../../../../../config.status ." line. When you're building the rpm package from the SRPM's you're in /usr/src/redhat/BUILD/sysadm_base-1.3.4. Trying to cd out 5 dirs puts you in never-never land. This must be a product of your build environment. It don't work fer the rest of us. It should be something like this, I think: %build if [ "$BOGO_RPM_SHORT_CIRCUIT" = "no" ] then cd %{fullname} test -f ../../../../../libtool && cp ../../../../../libtool . cp ../../../../../config.status . ./config.status make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" elif [ "$BOGO_RPM_SHORT_CIRCUIT" = "yes" ] echo "DANGER %build SKIPPED BECAUSE \$BOGO_RPM_SHORT_CIRCUIT IS SET!" else echo "BOGO_RPM_SHORT_CIRCUIT is not set to either yes or no. Continuing." fi Dan
> Regarding the BOGO_RPM_... issue: > > You're logic is marred in this bit of scripting in the sysadm_base.spc file: > > if test "no$BOGO_RPM_SHORT_CIRCUIT" = "no"; then \ ... > In either instance you assume that BOGO_RPM_... is set. I think you're reading that line wrong. When BOGO_RPM_SHORT_CIRCUIT is set to anything at all, the %build phase just prints a warning and doesn't build anything. When it's *not* set, the %build phase attempts to build. You wouldn't ever want it set except in the specific case mentioned in the paragraph at the top of the file which describes what BOGO_RPM_SHORT_CIRCUIT is for & how to use it. As for running ./configure instead of attempting to copy config.status from the top of the source tree, here's what I came up with: %build if test "no$BOGO_RPM_SHORT_CIRCUIT" = "no"; then \ cd %{fullname}; \ test -f ../../../../../libtool && cp ../../../../../libtool . ; \ test -f ../../../../../config.status && cp ../../../../../config.status . ; \ test -f ./config.status && ./config.status; \ test -f ./config.status || ./configure; \ make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"; \ else \ echo "DANGER %build SKIPPED BECAUSE \$BOGO_RPM_SHORT_CIRCUIT IS SET!"; \ fi It still tries to copy config.status, but if that doesn't work, it just runs the configure script. The problem with this is that it doesn't work, because it's not passing the arguments to the configure script which were used to create the rpm spec file. Here's why this is a problem: suppose you ran ./configure --prefix=/usr --sysconfdir=/etc. Our configure.in has autoconf generate a spec file with the correct full paths you chose: /usr/bin/foo, /usr/lib/libfoo.so, /etc/foo.conf, etc. When you install the SRPM, and run rpm -ba foo.spec, it will (hopefully!) fail to find the config.status, and instead run ./configure, but that will use a default prefix of /usr/local, which won't put files where the spec file says they'll be, which will croak the build. Making relocatable RPM packages seems like the right thing to do. (Thanks for that pointer to the relevant documentation, by the way; it saved me a lot of time.) Unfortunately, it looks like RPM's idea of relocatable packages isn't nearly as flexible as autoconf & automake's, and it breaks if you run configure with anything other than --prefix. I see three choices: - At configure time, generate a relocatable spec file which works if you limit yourself to setting the --prefix only. (If you specify a --sysconfdir, --libdir, --includedir, --datadir, etc., rpm won't be able to handle it.) - Write some script which would substitute configure's arguments into the spec file, and run it during the right make targets. (This would be fragile & nasty, but it would eliminate the need to copy config.status, which would mean the same %build commands could be used in both the source tree and when building from an installed SRPM.) - Distribute source tarballs only, not SRPM's. (If people want RPMs, they can run "make rpm" in the source tree.) Option #3 is looking pretty good to me. :) --Rusty
>> In either instance you assume that BOGO_RPM_... is set. > >I think you're reading that line wrong. When BOGO_RPM_SHORT_CIRCUIT is set to Oh, right. Sorry, my bad. Not enough caffeine, obviously. > As for running ./configure instead of attempting to copy config.status from > the top of the source tree, here's what I came up with: > > %build > if test "no$BOGO_RPM_SHORT_CIRCUIT" = "no"; then \ > cd %{fullname}; \ > test -f ../../../../../libtool && cp ../../../../../libtool . ; \ > test -f ../../../../../config.status && cp ../../../../../config.status > . ; \ > test -f ./config.status && ./config.status; \ > test -f ./config.status || ./configure; \ > make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"; \ > else \ > echo "DANGER %build SKIPPED BECAUSE \$BOGO_RPM_SHORT_CIRCUIT IS SET!"; >\ > fi Ah yes, that looks much better. > - At configure time, generate a relocatable spec file which works if you limit > yourself to setting the --prefix only. (If you specify a --sysconfdir, > --libdir, --includedir, --datadir, etc., rpm won't be able to handle it.) I think it's reasonable, and even expected, to leave the system defaults; allow the user to change the prefix and let them work out relocating installation directories themselves if they are so inclined. The system default values are set in /usr/lib/rpm/i386-linux/macros and Prefix will allow the user to set the base directory for the install tree. If they want to change more than the prefix, they can do it themselves in that file. > - Write some script which would substitute configure's arguments into the > spec file, and run it during the right make targets. (This would be fragile > & nasty, but it would eliminate the need to copy config.status, which would > mean the same %build commands could be used in both the source tree and when > building from an installed SRPM.) If you *really* wanted to, you could create env variables in the spec file for these values and write your own configure line that uses those variables instead of using the built-in rpm %configure macro, but as I pointed out above, let the end user screw around with that. > - Distribute source tarballs only, not SRPM's. (If people want RPMs, they can > run "make rpm" in the source tree.) But that's intentionally breaking/circumventing the tools available in RPM. Take a little extra time to learn what can be done with it and you'll make your life a whole lot easier and keep your end users happy because it works like every other RPM package in the world. Trust me on this one. ;) Dan
Do we have an update here, too?
> > - Distribute source tarballs only, not SRPM's. (If people want RPMs, > > they can run "make rpm" in the source tree.) > > But that's intentionally breaking/circumventing the tools available in > RPM. It seems to me that RPM breaks the tools available in autoconf/automake. > Take a little extra time to learn what can be done with it and > you'll make your life a whole lot easier and keep your end users happy > because it works like every other RPM package in the world. So far, I really haven't enjoyed the time I've spent using RPM. I'll be happy to take a patch to the spec file which makes RPM support the flexibility of autoconf, but I'm not interested in trying to write it myself when I can just distribute source tarballs instead of SRPMs.
Same argument as last bug ;-) If we distribute binary RPMs, it is expected that we also distribute clean SRPMs.