[Piuparts-commits] rev 88 - / people/jsw/multi-arch-master people/jsw/multi-arch-master/piupartslib
John Wright
jsw-guest at alioth.debian.org
Wed Sep 5 00:27:12 UTC 2007
Author: jsw-guest
Date: 2007-09-05 00:27:12 +0000 (Wed, 05 Sep 2007)
New Revision: 88
Modified:
/
people/jsw/multi-arch-master/piuparts-master.py
people/jsw/multi-arch-master/piuparts-slave.py
people/jsw/multi-arch-master/piupartslib/packagesdb.py
Log:
r79 at neptune: jswright | 2007-09-04 18:15:04 -0600
* piuparts-master.py:
- Actually pass the section argument when initializing the Master object
* piuparts-slave.py:
- Allow for multiple sections in the config file, just like for
piuparts-master. This way, a single slave machine can have configurations
for multiple dists.
- Add an optional arch option to the configuration. If it is not specified,
the architecture is automatically determined using dpkg. (This way, a host
capable of running binaries for multiple architectures, e.g. amd64, can be
a piuparts slave for more than one architecture.)
- When creating a chroot, use the mirror specified in the config file
- Only try to build the upgrade test chroot if upgrade-test-distros is
defined in the config file
* piupartslib/packagesdb.py:
- Fix a bug in setting up log directories, where I was adding a string to a
list by accident
Property changes on:
___________________________________________________________________
Name: svk:merge
- b12c1668-1bd8-44a9-a1e9-87753b0bf707:/local/piuparts:78
+ b12c1668-1bd8-44a9-a1e9-87753b0bf707:/local/piuparts:79
Modified: people/jsw/multi-arch-master/piuparts-master.py
===================================================================
--- people/jsw/multi-arch-master/piuparts-master.py 2007-09-05 00:27:08 UTC (rev 87)
+++ people/jsw/multi-arch-master/piuparts-master.py 2007-09-05 00:27:12 UTC (rev 88)
@@ -175,8 +175,10 @@
# backwards compatibility, if no argument is given, the "master" section is
# assumed.
if len(sys.argv) == 2:
- config = Config(section=sys.argv[1])
+ section = sys.argv[1]
+ config = Config(section=section)
else:
+ section = None
config = Config()
config.read(CONFIG_FILE)
@@ -184,7 +186,7 @@
logging.info("Fetching %s" % config["packages-url"])
packages_file = piupartslib.open_packages_url(config["packages-url"])
- m = Master(sys.stdin, sys.stdout, packages_file)
+ m = Master(sys.stdin, sys.stdout, packages_file, section=section)
packages_file.close()
while m.do_transaction():
pass
Modified: people/jsw/multi-arch-master/piuparts-slave.py
===================================================================
--- people/jsw/multi-arch-master/piuparts-slave.py 2007-09-05 00:27:08 UTC (rev 87)
+++ people/jsw/multi-arch-master/piuparts-slave.py 2007-09-05 00:27:12 UTC (rev 88)
@@ -56,8 +56,8 @@
class Config(piupartslib.conf.Config):
- def __init__(self):
- piupartslib.conf.Config.__init__(self, "slave",
+ def __init__(self, section="slave"):
+ piupartslib.conf.Config.__init__(self, section,
{
"idle-sleep": "10",
"master-host": None,
@@ -73,6 +73,7 @@
"max-reserved": "1",
"debug": "no",
"keep-sources-list": "no",
+ "arch": None,
},
["master-host", "master-user", "master-command"])
@@ -281,8 +282,8 @@
def create_chroot(config, tarball, distro):
logging.info("Creating new tarball %s" % tarball)
- command = "%s -ad %s -s %s.new hello" % \
- (config["piuparts-cmd"], distro, tarball)
+ command = "%s -ad %s -s %s.new -m %s hello" % \
+ (config["piuparts-cmd"], distro, tarball, config["mirror"])
logging.debug("Executing: " + command)
f = os.popen("{ %s; } 2>&1" % command, "r")
for line in f:
@@ -293,7 +294,11 @@
def fetch_packages_file(config, distro):
mirror = config["mirror"]
- arch = "i386" # FIXME to figure our arch right
+ arch = config["arch"]
+ if not arch:
+ # Try to figure it out ourselves, using dpkg
+ input, output = os.popen2("dpkg --print-architecture")
+ arch = output.read().rstrip()
packages_url = \
"%s/dists/%s/main/binary-%s/Packages.bz2" % (mirror, distro, arch)
@@ -314,7 +319,17 @@
def main():
setup_logging(logging.INFO, None)
- config = Config()
+ # For supporting multiple piuparts-slave configurations on a particular
+ # machine (e.g. for testing multiple suites), we take a command-line
+ # argument referring to a section in the slave configuration file. For
+ # backwards compatibility, if no argument is given, the "slave" section is
+ # assumed.
+ if len(sys.argv) == 2:
+ section = sys.argv[1]
+ config = Config(section=section)
+ else:
+ section = None
+ config = Config()
config.read(CONFIG_FILE)
if config["debug"] in ["yes", "true"]:
@@ -324,7 +339,8 @@
if not os.path.exists(config["chroot-tgz"]):
create_chroot(config, config["chroot-tgz"], config["distro"])
- if not os.path.exists(config["upgrade-test-chroot-tgz"]):
+ if (config["upgrade-test-distros"] and not
+ os.path.exists(config["upgrade-test-chroot-tgz"])):
create_chroot(config, config["upgrade-test-chroot-tgz"],
config["upgrade-test-distros"].split()[0])
Modified: people/jsw/multi-arch-master/piupartslib/packagesdb.py
===================================================================
--- people/jsw/multi-arch-master/piupartslib/packagesdb.py 2007-09-05 00:27:08 UTC (rev 87)
+++ people/jsw/multi-arch-master/piupartslib/packagesdb.py 2007-09-05 00:27:12 UTC (rev 88)
@@ -241,9 +241,9 @@
if reserved:
self._reserved = format % reserved
if moreok:
- self._moreok = format % moreok
+ self._moreok = [format % s for s in moreok]
if morefail:
- self._morefail = format % morefail
+ self._morefail = [format % s for s in morefail]
self._all = [self._ok, self._fail, self._evil, self._reserved] + \
self._moreok + self._morefail
More information about the Piuparts-commits
mailing list