diff -Nru autopkgtest-3.19.2/debian/bzr-builder.manifest autopkgtest-3.19.2/debian/bzr-builder.manifest --- autopkgtest-3.19.2/debian/bzr-builder.manifest 2016-01-18 15:39:54.000000000 +0000 +++ autopkgtest-3.19.2/debian/bzr-builder.manifest 2016-01-21 13:50:30.000000000 +0000 @@ -1,2 +1,2 @@ -# bzr-builder format 0.3 deb-version {debupstream}-0~1367 -lp:~vila/autopkgtest/git-master revid:git-v1:9008c6f285bcfa6c4f8f6cf172497116042307db +# bzr-builder format 0.3 deb-version {debupstream}-0~1374 +lp:~vila/autopkgtest/git-master revid:git-v1:89cd6a3008f3c6a6dacd92bca02d0c44213c0379 diff -Nru autopkgtest-3.19.2/debian/changelog autopkgtest-3.19.2/debian/changelog --- autopkgtest-3.19.2/debian/changelog 2016-01-18 15:39:54.000000000 +0000 +++ autopkgtest-3.19.2/debian/changelog 2016-01-21 13:50:30.000000000 +0000 @@ -1,16 +1,21 @@ -autopkgtest (3.19.2-0~1367~ubuntu14.04.1) trusty; urgency=low +autopkgtest (3.19.2-0~1374~ubuntu14.04.1) trusty; urgency=low * Auto build. - -- Vincent Ladeuil Mon, 18 Jan 2016 15:39:54 +0000 + -- Vincent Ladeuil Thu, 21 Jan 2016 13:50:30 +0000 -autopkgtest (3.19.2) UNRELEASED; urgency=medium +autopkgtest (3.19.2) unstable; urgency=medium - * Fix "apt-get source" version detection to ignore source record "Binary:" - entries which are not actually binaries of that source. - * Fix "apt-get source" version detection to take the highest source version - of all encountered binaries. In other words, as soon as apt pinning uses - one package from -proposed, use the tests from -proposed too. + * Fix "apt-get source" version detection: + - Ignore source record "Binary:" entries which are not actually binaries + of that source. + - Take the highest source version of all encountered binaries. In other + words, as soon as apt pinning uses one package from -proposed, use the + tests from -proposed too. + - Only consider binaries which exist in all releases. This avoids newly + introduced binaries (library transitions, new kernel versions) to skew + the intended apt pinning as they would always win the "highest version" + check from above. * Install /usr/share/autopkgtest/setup-commands/* scripts as executable, to make them work for vmdebootstrap --customize. (Closes: #810862) * ssh-setup/nova: Use extended RE for matching --image pattern. @@ -23,8 +28,19 @@ * adt-buildvm-ubuntu-cloud: Don't try to run "None" if --post-command is not given. * adt-virt-lxc: Add timeouts to all LXC operations. + * Fix chowning for "rw-build-tree" restriction: run it as root if available, + and otherwise ignore it entirely. (LP: #1535234) + * Drop apt-cache showsrc --only-source option, as this is not yet understood + by Ubuntu 12.04's apt. + * VirtSubproc.py, execute_timeout(): Avoid UnicodeDecodeErrors when called + programs send gibberish. Decode manually with "replace" error mode + instead. (LP: #1535741) + * adt-virt-lxc: Avoid unnecessary reading and decoding of program outputs if + we don't actually use it. + * ssh-setup/nova: Use the image with the latest "created" time, instead of + the last lexicographic name. - -- Martin Pitt Tue, 12 Jan 2016 12:08:47 +0100 + -- Martin Pitt Thu, 21 Jan 2016 13:30:40 +0100 autopkgtest (3.19.1) unstable; urgency=medium diff -Nru autopkgtest-3.19.2/lib/adt_testbed.py autopkgtest-3.19.2/lib/adt_testbed.py --- autopkgtest-3.19.2/lib/adt_testbed.py 2016-01-18 15:39:53.000000000 +0000 +++ autopkgtest-3.19.2/lib/adt_testbed.py 2016-01-21 13:50:28.000000000 +0000 @@ -84,8 +84,8 @@ if os.path.exists(os.path.join(root_dir, '.git')): try: head = subprocess.check_output(['git', 'show', '--no-patch', '--oneline'], - cwd=root_dir, universal_newlines=True) - head = head.strip() + cwd=root_dir) + head = head.decode('UTF-8').strip() except OSError: head = 'cannot determine current HEAD' adtlog.info('git checkout: %s' % head) @@ -923,8 +923,6 @@ 'cd "$buildtree"; '\ % {'t': tree.tb, 'a': test_artifacts} - if self.user and 'rw-build-tree' in test.restrictions: - script += 'chown -R %s "$buildtree"; ' % self.user for e in extra_env: script += 'export \'%s\'; ' % e # there's no way to tell su to not reset $PATH, for install-tmp mode; @@ -956,6 +954,9 @@ # self.execute(); so emulate the parts that we want # FIXME: move "run as user" as an argument of execute()/check_exec() and run with -l test_argv = ['su', '-s', '/bin/bash', self.user, '-c'] + + if 'rw-build-tree' in test.restrictions: + self.check_exec(['chown', '-R', self.user, tree.tb]) else: # this ensures that we have a PAM/logind session for root tests as # well; with some interfaces like ttyS1 or lxc_attach we don't log @@ -1241,8 +1242,7 @@ '''Get all child processes of pid''' try: - out = subprocess.check_output(['ps', '-o', 'pid=', '--ppid', str(pid)], - universal_newlines=True) + out = subprocess.check_output(['ps', '-o', 'pid=', '--ppid', str(pid)]) return [int(p) for p in out.split()] except subprocess.CalledProcessError: return [] diff -Nru autopkgtest-3.19.2/lib/VirtSubproc.py autopkgtest-3.19.2/lib/VirtSubproc.py --- autopkgtest-3.19.2/lib/VirtSubproc.py 2016-01-18 15:39:53.000000000 +0000 +++ autopkgtest-3.19.2/lib/VirtSubproc.py 2016-01-21 13:50:28.000000000 +0000 @@ -139,13 +139,18 @@ adtlog.debug('execute-timeout: ' + ' '.join(popenargs[0])) sp = subprocess.Popen(*popenargs, preexec_fn=preexecfn, - universal_newlines=True, **popenargsk) if instr is None: popenargsk['stdin'] = devnull_read + else: + instr = instr.encode('UTF-8') timeout_start(timeout) try: (out, err) = sp.communicate(instr) + if out is not None: + out = out.decode('UTF-8', 'replace') + if err is not None: + err = err.decode('UTF-8', 'replace') except Timeout: try: sp.kill() diff -Nru autopkgtest-3.19.2/runner/adt-run autopkgtest-3.19.2/runner/adt-run --- autopkgtest-3.19.2/runner/adt-run 2016-01-18 15:39:53.000000000 +0000 +++ autopkgtest-3.19.2/runner/adt-run 2016-01-21 13:50:28.000000000 +0000 @@ -342,10 +342,13 @@ elif kind == 'apt-source': # determine the version for "apt-get source pkg=version" that conforms - # to the current apt pinning + # to the current apt pinning, to work around the lack of + # "apt-get source foo/release". We only consider binaries which are + # shipped in all available versions, otherwise new binaries in pockets + # would always win. # apt-get source is terribly noisy; only show what gets downloaded - create_command = ('maxver=''; ' - 'for pkg in $(apt-cache showsrc --only-source "%(src)s" | sed -n "/^Binary:/ { s/^Binary://; s/,//g; p }" | xargs -n1 | sort -u); do' + create_command = ('''pkgs=$(apt-cache showsrc %(src)s | awk "/^Package-List:/ { inlist=1; next } (/^ / && inlist == 1) { thissrc[\$1] = 1; next } { if (!inlist) next; inlist=0; if (intersect) {for (p in pkgs) { if (!(p in thissrc)) delete pkgs[p] }} else { for (p in thissrc) { pkgs[p] = 1}; intersect=1 }; delete thissrc } END {for (p in pkgs) print p}");''' + ' for pkg in $pkgs; do' ' pkg_candidate=$(apt-cache policy $pkg|sed -n "/Candidate:/ { s/^.* //; /none/d; p}");' ' [ -n "$pkg_candidate" ] || continue; ' ' show=$(apt-cache show $pkg=$pkg_candidate | grep "^Source:" || true);' diff -Nru autopkgtest-3.19.2/ssh-setup/nova autopkgtest-3.19.2/ssh-setup/nova --- autopkgtest-3.19.2/ssh-setup/nova 2016-01-18 15:39:53.000000000 +0000 +++ autopkgtest-3.19.2/ssh-setup/nova 2016-01-21 13:50:28.000000000 +0000 @@ -177,8 +177,21 @@ fi # check available images that match the given name, use the latest match - images=$(nova image-list|sed -n '2 d; /^|/ {s/^| *//; s/ *|$//; s/ *| *\+/\t/g; p}') - last=$(echo "$images" | grep -E "${IMAGE}.*ACTIVE" |sort -k2 | tail -n1) + last=$(cat < latest.created: + latest = i +if latest: + print('%s\t%s' % (latest.id, latest.name)) +EOF +) + if [ -z "$last" ]; then error "No nova image available that matches $IMAGE" exit 1 diff -Nru autopkgtest-3.19.2/tests/adt-run autopkgtest-3.19.2/tests/adt-run --- autopkgtest-3.19.2/tests/adt-run 2016-01-18 15:39:53.000000000 +0000 +++ autopkgtest-3.19.2/tests/adt-run 2016-01-21 13:50:28.000000000 +0000 @@ -2020,8 +2020,13 @@ def test_user(self): '''Run tests as different user''' - p = self.build_src('Tests: t\nDepends: aspell-doc\nRestrictions: rw-build-tree\n', - {'t': '''#!/bin/sh -e + p = self.build_src('Tests: r\nDepends:\nRestrictions: rw-build-tree, needs-root\n\n' + 'Tests: t\nDepends: aspell-doc\nRestrictions: rw-build-tree\n', + {'r': '''#!/bin/sh -e + mkdir xsrc + echo r00t > xsrc/root.txt + ''', + 't': '''#!/bin/sh -e echo world > $ADTTMP/hello.txt cat $ADTTMP/hello.txt mkdir -p $ADTTMP/one/subdir @@ -2029,6 +2034,7 @@ cat $ADTTMP/one/subdir/subdir.txt rm -r $ADTTMP/one echo dir_is_rw > rw_flag + echo user >> xsrc/root.txt cat rw_flag echo hello > $ADT_ARTIFACTS/world.txt chmod 600 $ADT_ARTIFACTS/world.txt diff -Nru autopkgtest-3.19.2/virt-subproc/adt-virt-lxc autopkgtest-3.19.2/virt-subproc/adt-virt-lxc --- autopkgtest-3.19.2/virt-subproc/adt-virt-lxc 2016-01-18 15:39:53.000000000 +0000 +++ autopkgtest-3.19.2/virt-subproc/adt-virt-lxc 2016-01-21 13:50:28.000000000 +0000 @@ -179,7 +179,7 @@ # lxc-clone should pick -B by itself (LP: #1532125) argv = sudoify(['lxc-clone', '--new', lxc_container_name, '--orig', args.template]) if VirtSubproc.execute_timeout(None, 10, argv + ['-B', 'btrfs'], - stdout=subprocess.PIPE, stderr=subprocess.STDOUT)[0] != 0: + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)[0] != 0: adtlog.debug('lxc-clone with btrfs backingstore failed, re-trying without') VirtSubproc.check_exec(argv, outp=True, timeout=600) argv = ['lxc-start', '--name', lxc_container_name, '--daemon'] @@ -272,7 +272,7 @@ # non-fatal (s, o, e) = VirtSubproc.execute_timeout( None, 30, sudoify(['lxc-destroy', '--name', lxc_container_name]), - stderr=subprocess.PIPE) + stderr=subprocess.DEVNULL) if s != 0 and e and 'not defined' not in e: sys.stderr.write(e)