Re: Fetching and building dependencies automatically

Brian Candler <[email protected]>
Newsgroups gmane.linux.freshrpms.user
Message-ID <[email protected]>
On Tue, Mar 06, 2007 at 04:10:21PM +0100, Matthias Saou wrote:
> Brian Candler wrote :
> 
> > Any pointers gratefully received.
> 
> You seem to be looking for mach :-)
> 
> If you're running any recent Fedora release, just "yum install mach",
> otherwise you can find more information here :
> http://thomas.apestaart.org/projects/mach/
> 
> Once set up, just "mach build foo.spec" and it'll download all sources
> for you and rebuild foo inside a chroot where it'll use yum to populate
> it with all build requirements.
> Then for "bar" which build requires "foo", "mach build bar.spec" will
> just work, installing the freshly built "foo" package.

I've just tried mach on a centos 4.4 box, but am having problems.

I built it using rpmbuild -tb mach-0.9.1.tar.bz2, then installed it using
rpm -Uvh (I first had to yum install createrepo as a dependency). My
~/.machrc is given below.

"mach setup build" worked fine, and "mach chroot" lets me go in there and
browse around (rpm -qa)

However, then I took a .spec file downloaded from freshrpms.net:

$ mach build /v/downloads/perl-SOAP-Lite.spec
Building .src.rpm from perl-SOAP-Lite.spec
Getting http://www.cpan.org/modules/by-module/SOAP/SOAP-Lite-0.69.tar.gz ...
Using /var/tmp/mach/tmp/centos-4-i386-extras/perl-SOAP-Lite-0.69-1/SOAP-Lite-0.69.tar.gz
Creating .src.rpm ....
Traceback (most recent call last):
  File "/usr/bin/mach", line 2444, in ?
    main (config, sys.argv[1:])
  File "/usr/bin/mach", line 2413, in main
    output = Root.__dict__[command] (root, args[1:])
  File "/usr/bin/mach", line 951, in build
    os.unlink (srpmfile)
OSError: [Errno 13] Permission denied: '/var/lib/mach/roots/centos-4-i386-extras/usr/src/rpm/SRPMS/perl-SOAP-Lite-0.69-1.src.rpm'

Retrying doesn't help:

$ mach unlock
$ mach clean
Cleaning out root ..........
$ mach build /v/downloads/perl-SOAP-Lite.spec
Preparing root
Installing package set 'minimal' .........
Installing package set 'base' ............
Installing package set 'build' ..........
Making snapshot ...
Building .src.rpm from perl-SOAP-Lite.spec
Using /var/tmp/mach/tmp/centos-4-i386-extras/perl-SOAP-Lite-0.69-1/SOAP-Lite-0.69.tar.gz
Creating .src.rpm ....
Traceback (most recent call last):
  File "/usr/bin/mach", line 2444, in ?
    main (config, sys.argv[1:])
  File "/usr/bin/mach", line 2413, in main
    output = Root.__dict__[command] (root, args[1:])
  File "/usr/bin/mach", line 951, in build
    os.unlink (srpmfile)
OSError: [Errno 13] Permission denied: '/var/lib/mach/roots/centos-4-i386-extras/usr/src/rpm/SRPMS/perl-SOAP-Lite-0.69-1.src.rpm'

So I commented out line 951 (os.unlink) - perhaps mach had forgotten to gain
privileges at this point. But then it fails with another permission problem:

$ mach unlock
$ mach build /v/downloads/perl-SOAP-Lite.spec
Building .src.rpm from perl-SOAP-Lite.spec
Using /var/tmp/mach/tmp/centos-4-i386-extras/perl-SOAP-Lite-0.69-1/SOAP-Lite-0.69.tar.gz
Creating .src.rpm ....
Rebuilding generated .src.rpm's:
- /var/tmp/mach/tmp/centos-4-i386-extras/perl-SOAP-Lite-0.69-1/perl-SOAP-Lite-0.69-1.src.rpm
Getting /var/tmp/mach/tmp/centos-4-i386-extras/perl-SOAP-Lite-0.69-1/perl-SOAP-Lite-0.69-1.src.rpm ...
Building source rpm perl-SOAP-Lite-0.69-1.src.rpm
ERROR: createrepo /var/lib/mach/roots/centos-4-i386-extras/usr/src/rpm/RPMS.mach-local failed
Traceback (most recent call last):
  File "/usr/bin/mach", line 2444, in ?
    main (config, sys.argv[1:])
  File "/usr/bin/mach", line 2413, in main
    output = Root.__dict__[command] (root, args[1:])
  File "/usr/bin/mach", line 956, in build
    self.rebuild (options + srpms)
  File "/usr/bin/mach", line 1229, in rebuild
    self.update_local_repo ()
  File "/usr/bin/mach", line 1026, in update_local_repo
    create_sources_list (self.config, srcs)
  File "/usr/bin/mach", line 2156, in create_sources_list
    raise Exception, "Could not update local yum repository"
Exception: Could not update local yum repository

So clearly something fundamental is wrong.

mach-helper appears to be correctly set up:

$ groups
ibn wheel mach
$ ls -l /usr/sbin/mach-helper
-rwsr-x---  1 root mach 8476 Mar  8 09:39 /usr/sbin/mach-helper
$

Any clues?

Thanks,

Brian.

--------- 8< ---------------------------------------------------------------
config['installer'] = 'yum'

config['files'] = {
  '/etc/hosts': '''
127.0.0.1 candlerb.london.example.com candlerb
localhost
''',
  '/etc/resolv.conf': '''
nameserver 10.1.1.50
nameserver 10.1.1.51
search maint.example.com
'''
}

config['defaultroot'] = 'centos-4-i386-extras'

config['macros'] = {
    'vendor':   'Example Company',
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.