Author: wade
Date: 2006-06-30 20:48:56 -0400 (Fri, 30 Jun 2006)
New Revision: 62168
Added:
trunk/release/jailbuilder/sample_config/suse-101-i586.txt
trunk/release/jailbuilder/sample_config/suse-101-x86_64.txt
Modified:
trunk/release/buildbuddy_notes.txt
trunk/release/jailbuilder/
trunk/release/jailbuilder/buildjail.py
Log:
jailbuilder:
-add new config files for suse 10.1
-implement rpm query cache to speed up jail creation (most of the time is spent
querying packages,
and if something goes wrong, the querying can be vastly sped up)
buildbuddy_notes.txt:
-more concrete instructions to make setting up buildbuddy much faster
Modified: trunk/release/buildbuddy_notes.txt
===================================================================
--- trunk/release/buildbuddy_notes.txt 2006-07-01 00:46:57 UTC (rev 62167)
+++ trunk/release/buildbuddy_notes.txt 2006-07-01 00:48:56 UTC (rev 62168)
@@ -1,26 +1,38 @@
-Get the bb source tarball
+Get the bb source tarball (TODO: add link to tarball of 1.6 branch and my
+additional patches, files)
+Add distro and/or arch to conf/os.conf if it's not there
+
+Copy all files (if working from a subversion work area):
+svn export . bb
+
+tar up bb and copy to build machine
+
+Extract, then:
+
perl Makefile.PL
make
sudo su
make install
-Install XML::Simple
-
+Install XML::Simple (or XML::Parser if using the bb 1.6 branch)
Possibly from cpan...
-Copy these scripts from a closely related distro (under
/usr/share/ximian-build-system):
+Inside jail, from inside the unpacked tarball, as root (copy and paste):
-conf/os.conf
-scripts/*.guess
-conf/bb.conf
-conf/packsys.conf
-packsys/rpm/*
+---------------------
+export DEST=/usr/share/ximian-build-system
-Command to tar up:
-tar -zcvf bb_conf.tar.gz conf/os.conf scripts/*.guess conf/bb.conf
conf/packsys.conf packsys/rpm/*
+mkdir -p $DEST/conf
-Add distro and/or arch to conf/os.conf
+cp -f conf/os.conf $DEST/conf
+cp -f conf/bb.conf $DEST/conf
+cp -f conf/packsys.conf $DEST/conf
-Fedora 4 and up specifics:
--Need to change Copyright to License in /usr/bin/bb_do
+cp -Rf packsys $DEST
+
+mkdir -p $DEST/scripts
+cp -f scripts/distribution.guess $DEST/scripts
+cp -f scripts/config.guess $DEST/scripts
+---------------------
+
Property changes on: trunk/release/jailbuilder
___________________________________________________________________
Name: svn:ignore
- isos
rpms
+ isos
rpms
rpm_cache
Modified: trunk/release/jailbuilder/buildjail.py
===================================================================
--- trunk/release/jailbuilder/buildjail.py 2006-07-01 00:46:57 UTC (rev
62167)
+++ trunk/release/jailbuilder/buildjail.py 2006-07-01 00:48:56 UTC (rev
62168)
@@ -26,14 +26,20 @@
import sys
import os
-import commands
import re
import string
import tempfile
import shutil
+import pickle
+
import pdb
+sys.path+=['../pyutils']
+import utils
+
+
+
class Package:
# "Static" Members/Methods
@@ -74,9 +80,8 @@
# Get metadata for an rpm
# (Reference website: http://rikers.org/rpmbook/node30.html)
- # TODO: do a hash of the filename, and check a cache for the data
before reloading
def load_package_info(self):
- (status, output) = commands.getstatusoutput("""rpm -qp
--queryformat
"____NAME\n%{NAME}\n____ARCH\n%{ARCH}\n____FILELIST\n[%{FILENAMES}\n]"
--queryformat "____REQUIRES\n" --requires --queryformat "____PROVIDES\n"
--provides """ + self.full_path)
+ (status, output) = utils.launch_process("""rpm -qp
--queryformat
"____NAME\n%{NAME}\n____ARCH\n%{ARCH}\n____FILELIST\n[%{FILENAMES}\n]"
--queryformat "____REQUIRES\n" --requires --queryformat "____PROVIDES\n"
--provides """ + self.full_path, print_output=0)
#print output
@@ -118,7 +123,48 @@
else:
return 0
+class rpm_query_cache:
+ """Front loader to the Package class, checking a cached version
first."""
+ def __init__(self):
+
+ # Filename to pickle load/unload
+ self.cache_dir = 'rpm_cache'
+
+ if not os.path.exists(self.cache_dir):
+ os.mkdir(self.cache_dir)
+
+ def retrieve(self, dir_and_filename):
+ """Load Package object from cache, otherwise create a new one,
store it in the cache,
+ and return the new object."""
+
+ filename = os.path.basename(dir_and_filename)
+
+ pickle_path = self.cache_dir + os.sep + filename +
".Package.pickle"
+
+ load_success = False
+ if os.path.exists(pickle_path):
+ pickle_fd = open(pickle_path, 'r')
+ try:
+ package = pickle.load(pickle_fd)
+ pickle_fd.close()
+ load_success = True
+ print dir_and_filename + " (*Cache hit*)"
+ except:
+ #Pickling failed... remove .pickle
+ pickle_fd.close()
+ os.unlink(pickle_path)
+
+ # Load new package
+ if not load_success:
+ package = Package(dir_and_filename)
+ pickle_fd = open(pickle_path, 'w')
+ pickle.dump(package, pickle_fd)
+ pickle_fd.close()
+
+ return package
+
+
class Jail:
def __init__(self, config, path):
@@ -128,6 +174,8 @@
if not os.path.exists(self.jail_location):
os.mkdir(self.jail_location)
+ self.cache = rpm_query_cache()
+
# These are base names of rpms
# for rpm based distros, you must add the rpm dep since we
are ignoring rpmlib requirements
self.orig_required_rpms = config.get_required_rpms()
@@ -173,7 +221,9 @@
for rpm_filename in files:
- my_package = Package(
+
+
+ my_package = self.cache.retrieve(
os.path.join(self.config.get_rpm_repository_path(), rpm_filename))
@@ -228,7 +278,7 @@
print "ERROR!: need requirement '%s'
but do not have a package to satisfy it!" % req
print "\tmake sure you have the correct
arch types in valid_arch in your jail config"
print "Current Distro Hint:"
- (status, output) =
commands.getstatusoutput("""rpm -q --whatprovides '%s' """ % req)
+ (status, output) =
utils.launch_process("""rpm -q --whatprovides '%s' """ % req)
print output
sys.exit(1)
@@ -263,14 +313,14 @@
# Blow away the directory
# Unmount the possible proc dir just in case
- commands.getstatusoutput("umount %s" % self.jail_location +
os.sep + "proc")
+ utils.launch_process("umount %s" % self.jail_location + os.sep
+ "proc")
print "Removing jail target dir..."
shutil.rmtree(self.jail_location)
os.makedirs(self.jail_location + os.sep + "var/lib/rpm") #
Needed for rpm version 3
command = """rpm --root %s --initdb""" % self.jail_location
print command
- (status, output) = commands.getstatusoutput(command)
+ (status, output) = utils.launch_process(command)
if status:
print "Error initializing the rpm database inside the
jail"
sys.exit(1)
@@ -290,7 +340,7 @@
# This will work (using a manifest filename) as long as you're
using rpm version 4 and above on the host machine
command = """rpm --root %s -i %s""" % (self.jail_location,
manifest_filename)
print command
- (status, output) = commands.getstatusoutput(command)
+ (status, output) = utils.launch_process(command)
print output
if status:
print "Error installing rpms inside the jail!!!"
@@ -327,7 +377,7 @@
# Reinitialize the rpm database with the jail's version of rpm
command = "chroot %s env %s rpm --initdb" %
(self.jail_location, self.environment)
print command
- (status, output) = commands.getstatusoutput(command)
+ (status, output) = utils.launch_process(command)
print "Status: %d" % status
print "Output: " + output
@@ -338,7 +388,7 @@
# But, this method may be a problem because of the length of
the arguments
command = "chroot %s env %s rpm --force -U %s" %
(self.jail_location, self.environment, rpm_list)
print command
- (status, output) = commands.getstatusoutput(command)
+ (status, output) = utils.launch_process(command)
print "Status: %d" % status
print "Output: " + output
Added: trunk/release/jailbuilder/sample_config/suse-101-i586.txt
===================================================================
--- trunk/release/jailbuilder/sample_config/suse-101-i586.txt 2006-07-01
00:46:57 UTC (rev 62167)
+++ trunk/release/jailbuilder/sample_config/suse-101-i586.txt 2006-07-01
00:48:56 UTC (rev 62168)
@@ -0,0 +1,18 @@
+# Format: <name>=<value>
+
+jail_name=suse-101-i586
+
+rpm_repository_path=rpms/suse-101
+
+# Only accept packages with these arches
+valid_arch=i386 i586 i686 noarch
+
+required_rpms=aaa_base gcc make autoconf automake pwdutils vim iputils
util-linux sysvinit yast2 procps sudo smart glibc-locale tar unzip zip
freetype2-devel giflib-devel libjpeg-devel libtiff-devel libpng-devel
glib2-devel pkgconfig zlib-devel xorg-x11-devel perl-XML-Parser sqlite2 patch
gtkhtml2-devel gnome-keyring-devel gtk2-devel libart_lgpl-devel libglade2-devel
libgnomecanvas-devel libgsf-devel libgnomeui-devel vte-devel libgnomeprint
libgnomeprint-devel libgnomeprintui libgnomeprintui-devel librsvg librsvg-devel
esound-devel popt-devel gnome-panel-devel libxslt-devel gnome-panel-devel
libxslt-devel apache2-devel libtool file apache2-prefork
+
+#environment=
+
+# Other various/optional post jail settings:
+nameservers=137.65.1.3 137.65.1.4 130.57.22.5
+users=builder
+
+
Added: trunk/release/jailbuilder/sample_config/suse-101-x86_64.txt
===================================================================
--- trunk/release/jailbuilder/sample_config/suse-101-x86_64.txt 2006-07-01
00:46:57 UTC (rev 62167)
+++ trunk/release/jailbuilder/sample_config/suse-101-x86_64.txt 2006-07-01
00:48:56 UTC (rev 62168)
@@ -0,0 +1,18 @@
+# Format: <name>=<value>
+
+jail_name=suse-101-x86_64
+
+rpm_repository_path=rpms/suse-101
+
+# Only accept packages with these arches
+valid_arch=x86_64 i386 i586 i686 noarch
+
+required_rpms=aaa_base gcc make autoconf automake pwdutils vim iputils
util-linux sysvinit yast2 procps sudo smart glibc-locale tar unzip zip
freetype2-devel giflib-devel libjpeg-devel libtiff-devel libpng-devel
glib2-devel pkgconfig zlib-devel xorg-x11-devel perl-XML-Parser sqlite2 patch
gtkhtml2-devel gnome-keyring-devel gtk2-devel libart_lgpl-devel libglade2-devel
libgnomecanvas-devel libgsf-devel libgnomeui-devel vte-devel libgnomeprint
libgnomeprint-devel libgnomeprintui libgnomeprintui-devel librsvg librsvg-devel
esound-devel popt-devel gnome-panel-devel libxslt-devel gnome-panel-devel
libxslt-devel apache2-devel libtool file apache2-prefork
+
+#environment=
+
+# Other various/optional post jail settings:
+nameservers=137.65.1.3 137.65.1.4 130.57.22.5
+users=builder
+
+
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches