[Treepkg-commits] r222 - in trunk: bin test treepkg
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Nov 18 19:11:25 CET 2009
Author: bh
Date: 2009-11-18 19:11:22 +0100 (Wed, 18 Nov 2009)
New Revision: 222
Modified:
trunk/bin/treepkgbuilder.py
trunk/test/test_builder.py
trunk/treepkg/builder.py
Log:
Make it easy to install extra binaries into subdirectories of extra-pkg.
This makes it easier to manage the extra-pkg directory when it contains
manually added packages and automatically added packages from one of the
package tracks by putting the automatically added packages into
extra-pkg/auto and manually added packages into extra-pkg/manual.
To this end, add parameter subdir to PBuilder.add_binaries_to_extra_pkg
method with default value "auto". Adapt the test case accordingly.
Also add the command line argument --subdir to bin/treepkgbuilder.py
add-binaries command, this time with default value "manual".
Modified: trunk/bin/treepkgbuilder.py
===================================================================
--- trunk/bin/treepkgbuilder.py 2009-10-06 13:34:49 UTC (rev 221)
+++ trunk/bin/treepkgbuilder.py 2009-11-18 18:11:22 UTC (rev 222)
@@ -85,9 +85,20 @@
names = ("add-binaries",)
+ def create_parser(self):
+ parser = super(AddBinariesCommand, self).create_parser()
+ parser.set_defaults(subdir="manual")
+ parser.add_option("--subdir",
+ help=("The subdirectory of extra-pkg into which"
+ " the packages are to be copied"
+ " (default 'manual')."))
+ return parser
+
+
def run(self):
builder = self.get_builder()
- builder.add_binaries_to_extra_pkg(self.rest)
+ builder.add_binaries_to_extra_pkg(self.rest,
+ subdirectory=self.opts.subdir)
class UpdateCommand(Command):
Modified: trunk/test/test_builder.py
===================================================================
--- trunk/test/test_builder.py 2009-10-06 13:34:49 UTC (rev 221)
+++ trunk/test/test_builder.py 2009-11-18 18:11:22 UTC (rev 222)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, 2008 by Intevation GmbH
+# Copyright (C) 2007, 2008, 2009 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
#
@@ -375,6 +375,9 @@
builder.add_binaries_to_extra_pkg([self.minimal_package_deb])
self.assertEquals(sorted(os.listdir(self.extra_pkg_dir)),
- ["Packages", "Release", "minimal_1.0-1_i386.deb"])
+ ["Packages", "Release", "auto"])
+ self.assertEquals(sorted(os.listdir(os.path.join(self.extra_pkg_dir,
+ "auto"))),
+ ["minimal_1.0-1_i386.deb"])
self.check_command_line(['/usr/sbin/pbuilder', 'update',
'--configfile', self.pbuilderrc])
Modified: trunk/treepkg/builder.py
===================================================================
--- trunk/treepkg/builder.py 2009-10-06 13:34:49 UTC (rev 221)
+++ trunk/treepkg/builder.py 2009-11-18 18:11:22 UTC (rev 222)
@@ -193,19 +193,22 @@
if os.path.splitext(filename)[1] not in (".deb", ".changes"):
os.remove(os.path.join(binary_dir, filename))
- def add_binaries_to_extra_pkg(self, filenames):
+ def add_binaries_to_extra_pkg(self, filenames, subdirectory="auto"):
"""Adds binary packages to the extra-pkg directory.
The filenames parameter should be sequence of absolute
- filenames. The files named will be copied to the extra-pkg
- directory which is assumed to reside in the same directory as
- the pbuilderrc. Afterwards, the method generates a Packages
- file in the directory and runs pbuilder update. All of this
- assumes that pbuilder was set up the way bin/initpbuilder.py
- does.
+ filenames. The files named will be copied to a subdirectory of
+ the extra-pkg directory which is assumed to reside in the same
+ directory as the pbuilderrc. The subdirectory is specified with
+ the subdirectory parameter and defaults to 'auto'. Afterwards,
+ the method generates a Packages file in the directory and runs
+ pbuilder update. All of this assumes that pbuilder was set up
+ the way bin/initpbuilder.py does.
"""
+ target_dir = os.path.join(self.extra_pkg_dir, subdirectory)
+ util.ensure_directory(target_dir)
for filename in filenames:
- logging.info("Copying %s into %s", filename, self.extra_pkg_dir)
- shutil.copy(filename, self.extra_pkg_dir)
+ logging.info("Copying %s into %s", filename, target_dir)
+ shutil.copy(filename, target_dir)
logging.info("Running apt-ftparchive in %s", self.extra_pkg_dir)
self.update_extra_pkg_dir()
More information about the Treepkg-commits
mailing list