Discussion:
RPM Development as non-root
Michael Dengler
2007-06-28 17:00:46 UTC
Permalink
Hi,

I'm trying to figure out how to do this:

We have a build machine that I want to use to build rpms. The Sysadmin's for
this build machine are adamant that all build tools must be kept separate
from the OS and it root fs.

example: If ant is needed to build some java packages, the ant source
package is retrieved from a mounted repository, temporarily installed to a
custom location, ant builds the project and then ant is uninstalled.

I need to emulate this behaviour with rpmbuild but am having a lot of
difficulties.

Is there a way to install rpmbuild to a temporary, isolated location, use it
to build some rpms, then remove it?

Any help is greatly appreciated!

Thanks

Mike
Matthew Miller
2007-06-28 17:06:55 UTC
Permalink
Post by Michael Dengler
Is there a way to install rpmbuild to a temporary, isolated location, use
it to build some rpms, then remove it?
lookit 'mock'.
--
Matthew Miller ***@mattdm.org <http://mattdm.org/>
Boston University Linux ------> <http://linux.bu.edu/>
Michael Dengler
2007-06-28 18:47:20 UTC
Permalink
Hi,

Thanks for the replies. I've checked out the suggestions and both sound like
they will get the job done except:

mock needs to be installed to do the job...sysadmins won't allow it.

same goes for mezzanine.

What would be perfect is if I could simply "rpm -ivh --prefix
/isolated/directory/ rpm-devel.rpm"

Unfortunately rpm-devel is not relocatable. :-(

Any other suggestions are more than welcome.

Thanks

Mike
Post by Matthew Miller
Post by Michael Dengler
Is there a way to install rpmbuild to a temporary, isolated location,
use
Post by Michael Dengler
it to build some rpms, then remove it?
lookit 'mock'.
--
Boston University Linux ------> <http://linux.bu.edu/>
_______________________________________________
Rpm-list mailing list
https://www.redhat.com/mailman/listinfo/rpm-list
Michael Jennings
2007-06-28 18:55:45 UTC
Permalink
On Thursday, 28 June 2007, at 14:47:20 (-0400),
Post by Michael Dengler
Thanks for the replies. I've checked out the suggestions and both sound like
mock needs to be installed to do the job...sysadmins won't allow it.
same goes for mezzanine.
Check out Mezzanine from CVS:

cvs -d :pserver:***@anoncvs.caoslinux.org:/var/cvs co mezzanine

Then run "make" to create an RPM. The RPM can be installed into your
home directory using "rpm2cpio mezzanine*.rpm | cpio -iuvd"

Just put $HOME/usr/bin in your path (or "mv $HOME/usr/bin $HOME/bin"
and put $HOME/bin in your path) and add the appropriate perl directory
($HOME/usr/lib/perl5/vendor_perl/5.8.5 or something similar) to your
$PERL5LIB environment variable.

Michael
--
Michael Jennings (a.k.a. KainX) http://www.kainx.org/ <***@kainx.org>
n + 1, Inc., http://www.nplus1.net/ Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
"Somebody love me; come and carry me away.
Somebody need me to be the blue in their grey." -- Michael W. Smith
Michael Dengler
2007-07-03 13:19:32 UTC
Permalink
Michael,

OK...trying mezzanine as per your instructs...

$ make

...

+ /bin/mkdir -p /var/tmp/mezzanine-buildroot.15952/usr/bin
/bin/mkdir: cannot create directory `/var/tmp/mezzanine-buildroot.15952':
Permission denied

...

when building as non-root.

I added a new %_tmppath and %_topdir that points to my home dir to
~/.rpmmacros but alas...no joy.


I cannot write to /var/tmp and can't seem to find a place in the mezzanine
build to modify the path to point to somewhere I can write to.

any help?

Thanks

Mike
Post by Michael Jennings
On Thursday, 28 June 2007, at 14:47:20 (-0400),
Post by Michael Dengler
Thanks for the replies. I've checked out the suggestions and both sound
like
Post by Michael Dengler
mock needs to be installed to do the job...sysadmins won't allow it.
same goes for mezzanine.
Then run "make" to create an RPM. The RPM can be installed into your
home directory using "rpm2cpio mezzanine*.rpm | cpio -iuvd"
Just put $HOME/usr/bin in your path (or "mv $HOME/usr/bin $HOME/bin"
and put $HOME/bin in your path) and add the appropriate perl directory
($HOME/usr/lib/perl5/vendor_perl/5.8.5 or something similar) to your
$PERL5LIB environment variable.
Michael
--
n + 1, Inc., http://www.nplus1.net/ Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
"Somebody love me; come and carry me away.
Somebody need me to be the blue in their grey." -- Michael W. Smith
_______________________________________________
Rpm-list mailing list
https://www.redhat.com/mailman/listinfo/rpm-list
Tim Mooney
2007-07-03 16:22:57 UTC
Permalink
Post by Michael Dengler
Michael,
OK...trying mezzanine as per your instructs...
$ make
...
+ /bin/mkdir -p /var/tmp/mezzanine-buildroot.15952/usr/bin
Permission denied
...
when building as non-root.
I added a new %_tmppath and %_topdir that points to my home dir to
~/.rpmmacros but alas...no joy.
I cannot write to /var/tmp and can't seem to find a place in the mezzanine
build to modify the path to point to somewhere I can write to.
Then something is screwed up on the system you're building on. /var/tmp
should be writeable by all users.

In the meantime, it's probably something related to a buildroot that is
selecting /var/tmp. Try doing

rpm --showrc | egrep /tmp

and

rpm --showrc | egrep mezzanine

to see if either of them show you what macro might be involved.

Tim
--
Tim Mooney ***@dogbert.cc.ndsu.NoDak.edu
Information Technology Services (701) 231-1076 (Voice)
Room 242-J6, IACC Building (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
Michael Jennings
2007-07-03 20:11:58 UTC
Permalink
On Tuesday, 03 July 2007, at 09:19:32 (-0400),
Post by Michael Dengler
+ /bin/mkdir -p /var/tmp/mezzanine-buildroot.15952/usr/bin
Permission denied
...
when building as non-root.
Any system on which non-root users cannot write to /var/tmp is
inherently broken. File a bug against your sysadmin. :-)
Post by Michael Dengler
I added a new %_tmppath and %_topdir that points to my home dir to
~/.rpmmacros but alas...no joy.
Try setting $MEZZANINE_TMPDIR. If that doesn't work, use this:

perl -pi -e 's,/var/tmp,/tmp,g' mod/*.pm

Then try again. Use something else instead of /tmp if you wish.

Michael
--
Michael Jennings (a.k.a. KainX) http://www.kainx.org/ <***@kainx.org>
n + 1, Inc., http://www.nplus1.net/ Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
"A woman broke up with me and sent me pictures of her and her new
boyfriend in bed together. Solution? I sent them to her dad."
-- Christopher Case
Michael Dengler
2007-07-04 20:49:40 UTC
Permalink
Thanks all for your valued suggestions.

I finally got this to go.

Here's how:

Installed the rpm development tools to a non-standard location using
rpm2cpio:

~/rpm_devel $ rpm2cpio rpm-devel.rpm | cpio -iuvd

Modified some macros to point to the correct area (these can be defined in a
~/.rpmmacros file or on the rpmbuild command line):

%define __os_install_post ~/rpm_devel/usr/lib/rpm/brp-compress
~/rpm_devel/usr/lib/rpm/brp-strip
~/rpm_devel/usr/lib/rpm/brp-strip-static-archive
~/rpm_devel/usr/lib/rpm/brp-strip-comment-note %{nil}

%define __check_files ~/rpm_devel/usr/lib/rpm/check-files %{buildroot}

%define _topdir ~/rpm_devel/topdir
%define _tmppath ~/rpm_devel/tmp

After all of this I am able to temporarily install rpmbuild to my home dir
and build my rpms.

That was painful.

Thanks again for your help.

Mike
Post by Michael Jennings
On Tuesday, 03 July 2007, at 09:19:32 (-0400),
Post by Michael Dengler
+ /bin/mkdir -p /var/tmp/mezzanine-buildroot.15952/usr/bin
/bin/mkdir: cannot create directory `/var/tmp/mezzanine-buildroot.15952
Permission denied
...
when building as non-root.
Any system on which non-root users cannot write to /var/tmp is
inherently broken. File a bug against your sysadmin. :-)
Post by Michael Dengler
I added a new %_tmppath and %_topdir that points to my home dir to
~/.rpmmacros but alas...no joy.
perl -pi -e 's,/var/tmp,/tmp,g' mod/*.pm
Then try again. Use something else instead of /tmp if you wish.
Michael
--
n + 1, Inc., http://www.nplus1.net/ Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
"A woman broke up with me and sent me pictures of her and her new
boyfriend in bed together. Solution? I sent them to her dad."
-- Christopher Case
_______________________________________________
Rpm-list mailing list
https://www.redhat.com/mailman/listinfo/rpm-list
Nigel Metheringham
2007-06-29 08:07:34 UTC
Permalink
Post by Michael Dengler
Thanks for the replies. I've checked out the suggestions and both
mock needs to be installed to do the job...sysadmins won't allow it.
At this point I think you need to consider applying a baseball bat.
Or get them to give you a build VM (still use a build environment
within that).
Post by Michael Dengler
same goes for mezzanine.
also for mach, which is another similar solution.
Post by Michael Dengler
What would be perfect is if I could simply "rpm -ivh --prefix /
isolated/directory/ rpm-devel.rpm"
Really you end up needing chroot do to a properly isolated build
environment. That needs root, so basically either requires a package
to be installed, or it needs you to have superuser access.

Nigel.


--
[ Nigel Metheringham ***@InTechnology.co.uk ]
[ - Comments in this message are my own and not ITO opinion/policy - ]
Michael Jennings
2007-06-28 17:38:19 UTC
Permalink
On Thursday, 28 June 2007, at 13:00:46 (-0400),
Post by Michael Dengler
We have a build machine that I want to use to build rpms. The
Sysadmin's for this build machine are adamant that all build tools
must be kept separate from the OS and it root fs.
example: If ant is needed to build some java packages, the ant
source package is retrieved from a mounted repository, temporarily
installed to a custom location, ant builds the project and then ant
is uninstalled.
I need to emulate this behaviour with rpmbuild but am having a lot
of difficulties.
Is there a way to install rpmbuild to a temporary, isolated
location, use it to build some rpms, then remove it?
http://beta.kainx.org/wiki/view/Mezzanine
http://beta.kainx.org/articles/6

Michael
--
Michael Jennings (a.k.a. KainX) http://www.kainx.org/ <***@kainx.org>
n + 1, Inc., http://www.nplus1.net/ Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
"She had a need to feel the thunder, to chase the lightning from the
sky, to watch a storm with all its wonder raging in her lover's
eyes. She had to ride the heat of passion like a comet burning
bright, rushing headlong in the wind, down where only dreams have
been, burning both ends of the night."
-- Garth Brooks, "That Summer"
Loading...