From 7989d9f02cf14060aa512ca1d2f882493d89ead0 Mon Sep 17 00:00:00 2001 From: Rory McCann Date: Wed, 4 Feb 2009 19:56:41 +0000 Subject: [PATCH] have different dists --- bin/make-apt-cdrom.py | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/bin/make-apt-cdrom.py b/bin/make-apt-cdrom.py index a8668ee..9a2c5dd 100755 --- a/bin/make-apt-cdrom.py +++ b/bin/make-apt-cdrom.py @@ -20,6 +20,12 @@ parser.add_option( "-d", "--deb-dir", dest="debdir", default=None, help="The directory that has all the debs" ) +parser.add_option( "-D", "--dist", + dest="dist", default=None, type="choice", + choices=['warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', 'gutsy', 'hardy', 'intrepid', + '4.10', '7.04', '7.10', '6.10', '6.06', '5.10', '8.04', '5.04', '8.10'], + help="The ubuntu distrobution we're using" ) + parser.add_option( "-k", "--gpg-key", dest="gpgkey", default=None, type="string", help="The GPG key used to sign the packages" ) @@ -29,15 +35,21 @@ parser.add_option( "-k", "--gpg-key", assert options.isofilename is not None, "You must specify the filename for the resultant ISO file with --iso-file/-i" assert options.name is not None, "You must provide a name for the CD with --name/-n" assert options.debdir is not None, "You must provide a directory that contains all the debs using --deb-dir/-d" -assert options.gpgkey is not None, "You must provide the GPG key to sign the packages using --gpg-key/-g" +assert options.gpgkey is not None, "You must provide the GPG key to sign the packages using --gpg-key/-k" debdir = os.path.abspath( options.debdir ) # this is the CD we work in and will have be the cd image layout apt_cdrom_dir = tempfile.mkdtemp( prefix="make-apt-cdrom-cdrom-", dir=os.getcwd() ) -# TODO remove 'dapper' hardcoding' -for dir in ["pool", "pool/main", "dists", "dists/dapper", "dists/dapper/main", "dists/dapper/main/binary-i386"]: +dist_version_to_name = {'4.10': 'warty', '7.04': 'feisty', '7.10': 'gutsy', '6.10': 'edgy', '6.06': 'dapper', '5.10': 'breezy', '8.04': 'hardy', '5.04': 'hoary', '8.10': 'intrepid'} + +if options.dist in dist_version_to_name: + dist = dist_version_to_name[options.dist] +else: + dist = options.dist + +for dir in ["pool", "pool/main", "dists", "dists/"+dist, "dists/"+dist+"/main", "dists/"+dist+"/main/binary-i386"]: os.mkdir( os.path.join( apt_cdrom_dir, dir ) ) for package, filename in [(Package(filename=filename), filename) for filename in glob.glob( os.path.join( debdir, "*.deb" ) )]: @@ -53,8 +65,7 @@ for package, filename in [(Package(filename=filename), filename) for filename in # remake the packages file -# TODO remove 'dapper' hardcoding -status, output = commands.getstatusoutput( "apt-ftparchive packages \"%(aptdir)s/pool/main/\" | gzip -9c > \"%(aptdir)s/dists/dapper/main/binary-i386/Packages.gz\"" % {'aptdir':apt_cdrom_dir} ) +status, output = commands.getstatusoutput( "apt-ftparchive packages \"%(aptdir)s/pool/main/\" | gzip -9c > \"%(aptdir)s/dists/%(dist)s/main/binary-i386/Packages.gz\"" % {'aptdir':apt_cdrom_dir, 'dist':dist} ) if status != 0: print output #assert status == 0 @@ -65,22 +76,22 @@ config_file, config_filename = tempfile.mkstemp( prefix="make-apt-cdrom-release- open( config_filename, "w" ).write("""APT::FTPArchive::Release { Origin "APT-Move"; Label "APT-Move"; -Suite "dapper"; -Codename "dapper"; +Suite "%(dist)s"; +Codename "%(dist)s"; Architectures "i386"; Components "main"; -Description "%s"; -};""" % options.name ) +Description "%(name)s"; +};""" % {'name':options.name, 'dist':dist} ) -status, output = commands.getstatusoutput( "apt-ftparchive -c \"%(config_filename)s\" release %(aptdir)s/dists/dapper/" % {'config_filename':config_filename, 'aptdir':apt_cdrom_dir } ) +status, output = commands.getstatusoutput( "apt-ftparchive -c \"%(config_filename)s\" release %(aptdir)s/dists/%(dist)s/" % {'config_filename':config_filename, 'aptdir':apt_cdrom_dir, 'dist':dist } ) if status != 0: print output assert status == 0 -open( os.path.join( apt_cdrom_dir, 'dists', 'dapper', 'Release'), 'w').write( output ) +open( os.path.join( apt_cdrom_dir, 'dists', dist, 'Release'), 'w').write( output ) -status,output = commands.getstatusoutput( "gpg -ba --default-key=%(gpg_key)s -o \"%(aptdir)s/dists/dapper/Release.gpg\" \"%(aptdir)s/dists/dapper/Release\"" % {'gpg_key':options.gpgkey, 'aptdir':apt_cdrom_dir } ) +status,output = commands.getstatusoutput( "gpg -ba --default-key=%(gpg_key)s -o \"%(aptdir)s/dists/%(dist)s/Release.gpg\" \"%(aptdir)s/dists/%(dist)s/Release\"" % {'gpg_key':options.gpgkey, 'aptdir':apt_cdrom_dir, 'dist':dist } ) if status != 0: print output -- 2.11.4.GIT