[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.44-656-gc294e8d
Andreas Beckmann
debian at abeckmann.de
Mon Jun 4 11:58:59 UTC 2012
The following commit has been merged in the develop branch:
commit 1bcdf4429c387c8bbc5efb4c262a67d98181ef06
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Sun Jun 3 02:36:46 2012 +0200
p-s: merge Section.setup() into Section.__init__()
and further simplify it
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/debian/changelog b/debian/changelog
index 74a62be..d86a541 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -82,6 +82,7 @@ piuparts (0.45) UNRELEASED; urgency=low
* piuparts-slave.py:
- Randomize waiting time (between 60 and 180 seconds) if master is busy.
- Sleep until the next section can be tried, but at least 1 minute.
+ - Simplify and merge Section.setup() into Section.__init__().
* piuparts-report.py:
- Remove known_circular_depends handling.
- Exclude obsolete states from generated report.
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 37b409f..c2facc4 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -252,16 +252,12 @@ class Section:
self._sleep_until = 0
self._slave_directory = os.path.abspath(self._config["slave-directory"])
if not os.path.exists(self._slave_directory):
- os.mkdir(self._slave_directory)
+ os.makedirs(self._slave_directory)
- def setup(self):
if self._config["debug"] in ["yes", "true"]:
self._logger = logging.getLogger()
self._logger.setLevel(logging.DEBUG)
- oldcwd = os.getcwd()
- os.chdir(self._slave_directory)
-
if self._config["chroot-tgz"] and not self._config["distro"]:
logging.info("The option --chroot-tgz needs --distro.")
@@ -269,7 +265,7 @@ class Section:
int(global_config["min-tgz-retry-delay"])]
self._check_tarball()
- for rdir in ["new", "pass", "fail"]:
+ for rdir in ["new", "pass", "fail", "untestable", "reserved"]:
rdir = os.path.join(self._slave_directory, rdir)
if not os.path.exists(rdir):
os.mkdir(rdir)
@@ -281,13 +277,11 @@ class Section:
self._slave.set_master_command(self._config["master-command"])
self._log_file=self._config["log-file"]
- for rdir in ["pass", "fail", "untestable", "reserved"]:
- rdir = os.path.join(self._slave_directory, rdir)
- if not os.path.exists(rdir):
- os.makedirs(rdir)
- os.chdir(oldcwd)
def _check_tarball(self):
+ oldcwd = os.getcwd()
+ os.chdir(self._slave_directory)
+
tarball = self._config["chroot-tgz"]
if tarball:
create_or_replace_chroot_tgz(self._config, tarball,
@@ -298,6 +292,8 @@ class Section:
create_or_replace_chroot_tgz(self._config, tarball,
self._base_tgz_ctrl, self._config["upgrade-test-distros"].split()[0])
+ os.chdir(oldcwd)
+
def precedence(self):
return int(self._config["precedence"])
@@ -615,9 +611,10 @@ def create_file(filename, contents):
def main():
setup_logging(logging.INFO, None)
- # For supporting multiple architectures and suites, we take a command-line
- # argument referring to a section in configuration file.
- # If no argument is given, the "global" section is assumed.
+ # For supporting multiple architectures and suites, we take command-line
+ # argument(s) referring to section(s) in the configuration file.
+ # If no argument is given, the "sections" entry from the "global" section
+ # is used.
section_names = []
global_config = Config(section="global")
global_config.read(CONFIG_FILE)
@@ -626,11 +623,8 @@ def main():
else:
section_names = global_config["sections"].split()
- sections = []
- for section_name in section_names:
- section = Section(section_name, global_config)
- section.setup()
- sections.append(section)
+ sections = [Section(section_name, global_config)
+ for section_name in section_names]
while True:
test_count = 0
--
piuparts git repository
More information about the Piuparts-commits
mailing list