patch to add SuSE 9.3 support to mock

Bryan Stillwell bryans at aspsys.com
Mon Aug 8 22:46:45 UTC 2005


I see mock and plague being a great way for third parties to do builds
of their software on many distributions.  For example, our customers
commonly request Fedora, RHEL, SuSE, or SLES to be installed on their
Beowulf clusters.  There's common clustering software (dsh, mpich,
torque, etc.) that we install on top of these OSes and I've been working
on packaging most of these into rpms.  Since mock/plague appear to be
mostly Fedora centric, I've had to patch a few things to get it working.
Attached is a patch that I created to deal with some SuSE deficiencies
I've run across.  Also attached is the buildroots file and mock config
file.

Bryan

-- 
Aspen Systems, Inc.    | http://www.aspsys.com/
Production Engineer    | Phone: (303)431-4606
bryans at aspsys.com      | Fax:   (303)431-7196
-------------- next part --------------
diff -ru mock-0.4.orig/mock.py mock-0.4/mock.py
--- mock-0.4.orig/mock.py	2005-07-26 14:33:52.000000000 -0600
+++ mock-0.4/mock.py	2005-08-08 16:28:39.586256320 -0600
@@ -574,6 +574,12 @@
             cmd = "chown %s.%s %s/%s" % (self.config['chrootuser'], 
                self.config['chrootgroup'], self.builddir, subdir)
             self.do_chroot(cmd, fatal = True)
+
+        # SuSE's useradd doesn't create home directory, so since we created
+        # it above we set the ownership here.
+        cmd = "chown %s.%s %s" % (self.config['chrootuser'], 
+            self.config['chrootgroup'], self.homedir)
+        self.do_chroot(cmd, fatal = True)
         
         # rpmmacros default
         macrofile_out = '%s%s/.rpmmacros' % (self.rootdir, self.homedir)
@@ -581,6 +587,10 @@
             rpmmacros = open(macrofile_out, 'w')
             rpmmacros.write(self.config['macros'])
             rpmmacros.close()
+
+        # SuSE's rpm version doesn't support the dist tag in 9.3
+        cmd = "cat /etc/rpm/macros.disttag >>%s/.rpmmacros" % self.homedir
+        self.do_chroot(cmd, fatal = True)
         
     
     def _prep_build(self):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: buildroots.xml
Type: text/xml
Size: 3244 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/buildsys/attachments/20050808/f00fb85f/attachment.xml 
-------------- next part --------------
#!/usr/bin/python -tt
import os
config_opts['root'] = 'suse-93-x86_64'
config_opts['basedir'] = '/var/lib/mock/'
config_opts['chroot'] = '/usr/sbin/mock-helper chroot'
config_opts['mount'] = '/usr/sbin/mock-helper mount'
config_opts['umount'] = '/usr/sbin/mock-helper umount'
config_opts['rm'] = '/usr/sbin/mock-helper rm'
config_opts['mknod'] = '/usr/sbin/mock-helper mknod'
config_opts['yum'] = '/usr/sbin/mock-helper yum'
config_opts['runuser'] = '/bin/su'
config_opts['buildgroup'] = 'build'
config_opts['chrootuser'] = 'mockbuild'
config_opts['chrootgroup'] = 'users'
config_opts['chrootuid'] = os.geteuid()
config_opts['chrootgid'] = os.getegid()
config_opts['chroothome'] = '/builddir'
config_opts['clean'] = True
config_opts['target_arch'] = 'x86_64'


config_opts['yum.conf'] = """
[main]
cachedir=/var/cache/yum
debuglevel=1
logfile=/var/log/yum.log
reposdir=/dev/null
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
exclude=*.i386 *.i686 *.athlon *.i586 *.486

# repos

[core]
name=core
baseurl=http://localhost/suse/9.3/x86_64/

#[updates-released]
#name=updates
#baseurl=http://localhost/suse/updates/9.3/x86_64/

[groups]
name=groups
baseurl=http://localhost/suse/buildgroups/9.3/x86_64/

[local]
name=aspen
baseurl=http://localhost/localrpms/suse93/

"""


More information about the buildsys mailing list