[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. eda668423fa87898c59d1075118693714aa5a053
Holger Levsen
holger at layer-acht.org
Fri Dec 23 10:25:19 UTC 2011
The following commit has been merged in the master branch:
commit 4130c370a442426bc4cbd9d50b8f285599503f95
Author: Holger Levsen <holger at layer-acht.org>
Date: Sun Oct 23 13:40:28 2011 +0200
revert 5847f4571589b4eaefa8ac6e43d5af051b401197 as it was buggy, even after fixing two syntax errors..
diff --git a/debian/changelog b/debian/changelog
index 152299a..5ccc063 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,7 +7,7 @@ piuparts (0.42) UNRELEASED; urgency=low
logrotate. Thanks Stefano! (Closes: #638832)
* Remove Debian.NEWS entry about source in git. (Closes: #640121)
* piuparts-slave.py: Replace deprecated os.popen2 with subprocess.Popen,
- thanks to Scott Schaefer and Evgeni Golov for their patches.
+ thanks to Scott Schaefer for the patch.
(Closes: #640646)
* debian/copyright: apply patch by Scott Schaefer to make it compliant with
DEP-5. Thanks Scott!
@@ -17,6 +17,10 @@ piuparts (0.42) UNRELEASED; urgency=low
are filed already.
* debian/control: Add python-apt and python-debianbts to piuparts depends.
+ [ Scott Schaefer ]
+ * piuparts-slave.py: Replace deprecated os.popen2 with subprocess.Popen.
+ (Closes: #640646)
+
-- Holger Levsen <holger at debian.org> Sun, 28 Aug 2011 09:50:12 +0200
piuparts (0.41) unstable; urgency=low
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 0d09ba7..730b29f 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -28,9 +28,8 @@ import sys
import stat
import time
import logging
-import ConfigParser
-import shlex
import subprocess
+import ConfigParser
import piupartslib.conf
import piupartslib.packagesdb
@@ -145,18 +144,13 @@ class Slave:
user = self._master_user + "@"
else:
user = ""
- cmd = "ssh %s %s 'cd %s; %s 2> %s.$$ && rm %s.$$'" %
- (self._master_host,
- user,
- self._master_directory or ".",
- self._master_command,
- log_file,
- log_file)
- cmd = shlex.split(cmd)
- f = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=PIPE,
- close_fds=True)
- (self._to_master, self._from_master) = (f.stdin, f.stdout)
-
+ ssh_cmdline = "cd %s; %s 2> %s.$$ && rm %s.$$" % \
+ (self._master_directory or ".",
+ self._master_command, log_file, log_file)
+ p = subprocess.Popen(["ssh", user + self._master_host, ssh_cmdline],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ self._to_master = p.stdin
+ self._from_master = p.stdout
line = self._readline()
if line != "hello\n":
raise MasterDidNotGreet()
@@ -369,10 +363,10 @@ def test_package(config, package, packages_files):
logging.debug("Executing: %s" % command)
output.write("Executing: %s\n" % command)
- f = execute_command(command)
- for line in f.communicate()[0].splitlines():
+ f = os.popen("{ %s; } 2>&1" % command, "r")
+ for line in f:
output.write(line)
- status = f.returncode
+ status = f.close()
if status is None:
status = 0
else:
@@ -392,11 +386,11 @@ def test_package(config, package, packages_files):
logging.debug("Executing: %s" % command)
output.write("\nExecuting: %s\n" % command)
- f = execute_command(command)
- for line in f.communicate()[0].splitlines():
+ f = os.popen("{ %s; } 2>&1" % command, "r")
+ for line in f:
output.write(line)
output.flush()
- status = f.returncode
+ status = f.close()
if status is None:
status = 0
@@ -417,8 +411,8 @@ def create_chroot(config, tarball, distro):
command = "%s -ad %s -s %s.new -m %s hello" % \
(config["piuparts-cmd"], distro, tarball, config["mirror"])
logging.debug("Executing: " + command)
- f = execute_command(command)
- for line in f.communicate()[0].splitlines():
+ f = os.popen("{ %s; } 2>&1" % command, "r")
+ for line in f:
logging.debug(">> " + line.rstrip())
f.close()
if os.path.exists(tarball + ".new"):
@@ -453,8 +447,9 @@ def fetch_packages_file(config, distro):
arch = config["arch"]
if not arch:
# Try to figure it out ourselves, using dpkg
- vout = execute_command("dpkg --print-architecture").communicate()[0]
- arch = vout.strip()
+ p = subprocess.Popen(["dpkg", "--print-architecture"],
+ stdout=subprocess.PIPE)
+ arch = p.stdout.read().rstrip()
packages_url = \
"%s/dists/%s/main/binary-%s/Packages.bz2" % (mirror, distro, arch)
@@ -471,10 +466,6 @@ def create_file(filename, contents):
f.write(contents)
f.close()
-def execute_command(cmd):
- cmd = shlex.split(cmd)
- f = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- return f
def main():
setup_logging(logging.INFO, None)
--
piuparts git repository
More information about the Piuparts-commits
mailing list