Re: Question about rpmbuild --root

2011-02-14 Thread Eric MSP Veith
Am Sonntag, 13. Februar 2011, 21:07:45 schrieb Jeff Johnson:
 Depends. --root (as wired in rpmbuild) isn't doing what you think
 its doing. What rpmbuild --root is actually attempting is considerably
 harder to explain, dates back to 2000 or so ...

Hm, well, the manpage says it'll chroot() before running any scriptlets. But 
skimming through the sources, I found no call to chroot(2). Hum. Manpage 
bug?

   chroot /wherever rpmbuild ...
 if you want/need single invocation functionality. But you
 likely just want to enter the chroot, and use rpmbuild inside.
   chroot /wherever
   rpmbuild ...

Which, however, will force me to install RPM with all deps inside the chroot, 
right? 

And without having tried it I guess that doing it programatically I could call 
chroot() before buildSpec() and it *should* work? If so, I'm back working on 
my small little build system... :-)

Eric
Dreaming of Ruby + RPM5 + Zypper.


signature.asc
Description: This is a digitally signed message part.


Re: Question about rpmbuild --root

2011-02-14 Thread Jeff Johnson

On Feb 14, 2011, at 3:43 AM, Eric MSP Veith wrote:

 Am Sonntag, 13. Februar 2011, 21:07:45 schrieb Jeff Johnson:
 Depends. --root (as wired in rpmbuild) isn't doing what you think
 its doing. What rpmbuild --root is actually attempting is considerably
 harder to explain, dates back to 2000 or so ...
 
 Hm, well, the manpage says it'll chroot() before running any scriptlets. But 
 skimming through the sources, I found no call to chroot(2). Hum. Manpage 
 bug?
 

Yes but ... rpmbuild --root is not doing chroot(2), never has done chroot(2),
and cannot do chroot(2) unless uid == 0.

It in the man page because someone insisted:
Its a CLI option so it MUST be in the man page.
and it was easier to oblige than explain.

  chroot /wherever rpmbuild ...
 if you want/need single invocation functionality. But you
 likely just want to enter the chroot, and use rpmbuild inside.
  chroot /wherever
  rpmbuild ...
 
 Which, however, will force me to install RPM with all deps inside the chroot, 
 right? 
 

Essentially yes.

 And without having tried it I guess that doing it programatically I could 
 call 
 chroot() before buildSpec() and it *should* work? If so, I'm back working on 
 my small little build system... :-)
 

File path's get implicitly prefixed when chroot(2) is called.

There's harder issues, like readong configuration (from inside or outside the 
chroot?)
and finding the rpmdb (inside or outside?) and writing *.rpm output (inside or 
outside),
but otherwise yes.

73 de Jeff

smime.p7s
Description: S/MIME cryptographic signature


Re: Question about rpmbuild --root

2011-02-14 Thread Eric MSP Veith
Am Montag, 14. Februar 2011, 13:26:32 schrieb Jeff Johnson:
 Yes but ... rpmbuild --root is not doing chroot(2), never has done
 chroot(2), and cannot do chroot(2) unless uid == 0.

The latter one I solved by calling sudo rpmbuild. 
 
 It in the man page because someone insisted:
   Its a CLI option so it MUST be in the man page.
 and it was easier to oblige than explain.

What's the difference between '--root' and '--dbpath' then?

 File path's get implicitly prefixed when chroot(2) is called.
 
 There's harder issues, like readong configuration (from inside or outside
 the chroot?) and finding the rpmdb (inside or outside?) and writing *.rpm
 output (inside or outside), but otherwise yes.

I can answer these questions in case of what I'm planning to do. I mainly 
don't want to populate the buildroot with all dependencies of RPM, that's all. 
But I can live with copying macro files and other config data.

Ok, off trying... :-)

Eric


signature.asc
Description: This is a digitally signed message part.


Re: Question about rpmbuild --root

2011-02-14 Thread Eric MSP Veith
Am Montag, 14. Februar 2011, 10:04:55 schrieb devzero2000:
 You can try mock perhaps http://fedoraproject.org/wiki/Projects/Mock

Thanks for the answer, but I won't try mock. Mock simply calls 
rpm/rpmbuildusing something like exec(['/bin/bash', '--login', '-c', ]).

This means that (a) RPM is installed in the buildroot (which I want to avoid) 
and that (b) there's no actual usage of RPM's API. That much I can do myself, 
I don't need mock for that...

Eric


signature.asc
Description: This is a digitally signed message part.


Re: Question about rpmbuild --root

2011-02-14 Thread Jeff Johnson

On Feb 14, 2011, at 8:31 AM, Eric MSP Veith wrote:

 Am Montag, 14. Februar 2011, 13:26:32 schrieb Jeff Johnson:
 Yes but ... rpmbuild --root is not doing chroot(2), never has done
 chroot(2), and cannot do chroot(2) unless uid == 0.
 
 The latter one I solved by calling sudo rpmbuild. 
 

So no figger where rpmbuild is supposed to read its configuration from.
That's a bit harder than using sudo to get uid == 0.

 It in the man page because someone insisted:
  Its a CLI option so it MUST be in the man page.
 and it was easier to oblige than explain.
 
 What's the difference between '--root' and '--dbpath' then?
 

Depends on context.

Traditionally, RPM implicitly added --root to --dbpath when opening
an rpmdb and expected the user to know when to add the chroot
prefix to the --dbpath argument for non-root execution.

But PLD wanted --rebuilddb --root instead of --rebuildb --dbpath
(where one had to manually insert the root prefix in the --dbpath argument).

So --root and --dbpath behavior was changed.

The change has broken 4-5 times over the years and is way too complex
and undocumented and more.

 File path's get implicitly prefixed when chroot(2) is called.
 
 There's harder issues, like readong configuration (from inside or outside
 the chroot?) and finding the rpmdb (inside or outside?) and writing *.rpm
 output (inside or outside), but otherwise yes.
 
 I can answer these questions in case of what I'm planning to do. I mainly 
 don't want to populate the buildroot with all dependencies of RPM, that's 
 all. 
 But I can live with copying macro files and other config data.
 
 Ok, off trying... :-)
 

Good luck!

FYI: --root takes a /string which is used to construct a command that looks like
rsh -c chroot /string ...
that isn't what anyone is expecting but is exactly what was intended.

73 de jeff



smime.p7s
Description: S/MIME cryptographic signature


Re: Question about rpmbuild --root

2011-02-14 Thread Eric MSP Veith
Am Montag, 14. Februar 2011, 14:41:42 schrieb Jeff Johnson:
  The latter one I solved by calling sudo rpmbuild.
 
 So no figger where rpmbuild is supposed to read its configuration from.
 That's a bit harder than using sudo to get uid == 0.

I don't understand. :-/ There are hardcoded macro file paths like 
/usr/lib/rpm/macros:~/.rpmmacros. ~ resolves to ~root or ~myuser based on 
what variables sudo sets. I don't expect RPM to add some extra magic 
dowhatIwant(). Or should I?

 Depends on context.
 
 Traditionally, RPM implicitly added --root to --dbpath when opening
 an rpmdb and expected the user to know when to add the chroot
 prefix to the --dbpath argument for non-root execution.
 
 But PLD wanted --rebuilddb --root instead of --rebuildb --dbpath
 (where one had to manually insert the root prefix in the --dbpath
 argument).
 
 So --root and --dbpath behavior was changed.

I don't quite get the implications. But I guess that when I encounter a 
problem related to this, I'll remember this part and hopefully be able to use 
this particular information. :-)

  Ok, off trying... :-)
 
 Good luck!

TA! I hoped that I could do the config file reading and loading .so files into 
memory and do the chroot() just before doing the actual call to build(). So 
everything should already reside in memory and the only thing that needs to be 
in the chroot is the rpmdb. Well, I'll see.

 FYI: --root takes a /string which is used to construct a command that looks
 like rsh -c chroot /string ...
 that isn't what anyone is expecting but is exactly what was intended.

You mean via %_remchroot, %_remroot  Co? These are never filled here. I 
already tried to manually add -D '%_remroot /my/chroot' and so on, but that 
didn't work, too. What am I missing?

Eric


signature.asc
Description: This is a digitally signed message part.


Re: Question about rpmbuild --root

2011-02-14 Thread Eric MSP Veith
Ok, thanks for all the info. I'll first go the lazy way and just install RPM 
into the chroot as it seems to be done by all the cool package builders. ;-) 
And maybe afterwards I can come up with something more nifty. Stay tuned for 
silent failure! 

Eric


signature.asc
Description: This is a digitally signed message part.


Question about rpmbuild --root

2011-02-13 Thread Eric MSP Veith
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello list,

I try to build in a chroot with an old RPM-5.1.9 using 

sudo rpmbuild --root=/var/tmp/eglibc-2.13.buildroot -ba eglibc.spec

Basically, what I want to know, is: Am I doing something completely wrong 
besides using an old and dusty RPM version? ;-)

eglibc.spec resides in the current directory alias 
~/gnyupkg/eglibc/eglibc.spec.

What happens is:

- ---%---
~/gnyupkg/eglibc $ sudo rpmbuild --root=/var/tmp/eglibc-2.13.buildroot  -ba 
eglibc.spec 21 | tee build.log
Fetching(Source3): bindresvport.blacklist
error: Fetching Source3 failed: Unknown or unexpected error
error: Missing Source3: bindresvport.blacklist: No such file or directory
Fetching(Source2): nsswitch.conf
error: Fetching Source2 failed: Unknown or unexpected error
error: Missing Source2: nsswitch.conf: No such file or directory
Fetching(Source1): nscd.ii
error: Fetching Source1 failed: Unknown or unexpected error
error: Missing Source1: nscd.ii: No such file or directory
Fetching(Source0): eglibc-2.13.12839.tar.bz2
error: Fetching Source0 failed: Unknown or unexpected error
error: Missing Source0: eglibc-2.13.12839.tar.bz2: No such file or directory
Executing(%prep): /bin/bash -e /var/tmp/eglibc-2.13.buildroot/var/tmp/rpm-
tmp.8989
+ umask 022
+ cd /usr/src/rpm/BUILD
+ exit 0
error: Bad file: /usr/src/rpm/SOURCES/bindresvport.blacklist: No such file 
or directory
error: Bad file: /usr/src/rpm/SOURCES/nsswitch.conf: No such file or 
directory
error: Bad file: /usr/src/rpm/SOURCES/nscd.ii: No such file or directory
error: Bad file: /usr/src/rpm/SOURCES/eglibc-2.13.12839.tar.bz2: No such 
file or directory
- ---%---

The sources mentioned are residing in $CHROOT/usr/src/rpm/SOURCES, but not 
in /usr/src/rpm/SOURCES. The $CHROOT itself is populated only with the bare 
minimum, meaning that there's also no RPM installation in the buildroot. (I 
guessed from some mails that this should theoretically be possible?) Having 
attached strace to the process, I see that there's no actual call to 
chroot(2).

Any hints, besides upgrading? (On the agenda on that system.)

TIA!

Eric
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBAgAGBQJNWC/PAAoJEIXD2TZ1epVBZyUQAIzVCYcN6Ja9Q49rIXG/QOBO
K1k4HXTQNLT/ZR7TsLbf2PzsoIMK+Rrfe67Bd5LQRqbJ7EwdcS67uTxuf8BQR+Nd
jsPayMOSz91aiu6Dc9ZgLTe3Yr+w6yFZgKx/oTNjmIb7V+UX980EXOww0oiFA20g
OUNl6ZL9bBud/zqHIOEztxAESk5YpWX7eofkC6+mihyrEiuprl8d+5Mb3zGSm6oq
FT0YHiE36jxjxFC39jzSlN+TfjH30ZnTEsFERgkWbP6oguFtBRk5mvZWyWUzaUPK
v/hjWw9U8iKXzX4jrOPomT6RISgRUSbXibj+5+AacJgM2SkH8W5k75pDf19aFwgg
OtgJPrlghUE0RSUOSjgahflTjVZguGmv2j1gGyB2SHoStHuAP3e2hv740Vi5VqQN
qhu+uWx5zs5RFia6z+pq56qhfAJj1aUlD9qYQDmdcf11v7h3nNLLXgGmgh0bxO/l
kuMlif+8pNi0ABQh05PdU2MDwcTbLHqrid9dR4R5L0JCYIpIgOOlCMW7OUni5mUC
085kwlJUO/bnq1InQiMpAOI9grsBrW/aKRk5BLVGS2MC++BV17yHsgq5LKz2W0BB
cyZ0jXu1tjpyFnt6NP8c8anui0SF857EybVagy7gMvKoFVBDU+Qa9B8LYTVKtGTP
JrOCoAGDaLqlsEBmng+p
=I7Q8
-END PGP SIGNATURE-
__
RPM Package Managerhttp://rpm5.org
User Communication List rpm-users@rpm5.org


Re: Question about rpmbuild --root

2011-02-13 Thread Jeff Johnson

On Feb 13, 2011, at 2:23 PM, Eric MSP Veith wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hello list,
 
 I try to build in a chroot with an old RPM-5.1.9 using 
 
   sudo rpmbuild --root=/var/tmp/eglibc-2.13.buildroot -ba eglibc.spec
 
 Basically, what I want to know, is: Am I doing something completely wrong 
 besides using an old and dusty RPM version? ;-)

Depends. --root (as wired in rpmbuild) isn't doing what you think
its doing. What rpmbuild --root is actually attempting is considerably
harder to explain, dates back to 2000 or so ...


Try
chroot /wherever rpmbuild ...
if you want/need single invocation functionality. But you
likely just want to enter the chroot, and use rpmbuild inside.
chroot /wherever
rpmbuild ...

hth

73 de Jeff

smime.p7s
Description: S/MIME cryptographic signature