#! /usr/bin/python2
#
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
-# Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
else:
raise IOError("file %s does not exist!" % self.name)
- def resolve_binary(self, binary):
- if os.path.isabs(binary):
- return binary
-
- for path in os.environ["PATH"].split(':'):
- resolved = os.path.join(path, binary)
- if os.path.exists(resolved):
- return resolved
-
- return binary
-
def generate(self, pacman):
print "==> Generating test environment"
logdir = os.path.join(self.root, os.path.dirname(util.LOGFILE))
etcdir = os.path.join(self.root, os.path.dirname(util.PACCONF))
bindir = os.path.join(self.root, "bin")
- sbindir = os.path.join(self.root, "sbin")
- scriptlet_shell = self.resolve_binary(pacman["scriptlet-shell"])
- shelldir = os.path.join(self.root, os.path.dirname(scriptlet_shell)[1:])
+ ldconfig = os.path.basename(pacman["ldconfig"])
+ ldconfigdir = os.path.join(self.root, os.path.dirname(pacman["ldconfig"][1:]))
+ shell = pacman["scriptlet-shell"][1:]
+ shelldir = os.path.join(self.root, os.path.dirname(shell))
sys_dirs = [dbdir, cachedir, syncdir, tmpdir, logdir, etcdir, bindir,
- sbindir, shelldir]
+ ldconfigdir, shelldir]
for sys_dir in sys_dirs:
if not os.path.isdir(sys_dir):
vprint("\t%s" % sys_dir[len(self.root)+1:])
os.makedirs(sys_dir, 0755)
# Only the dynamically linked binary is needed for fakechroot
shutil.copy("/bin/sh", bindir)
- if scriptlet_shell != "/bin/sh":
- shutil.copy("/bin/sh", os.path.join(self.root, scriptlet_shell[1:]))
+ if shell != "bin/sh":
+ shutil.copy("/bin/sh", os.path.join(self.root, shell))
shutil.copy(os.path.join(util.SELFPATH, "ldconfig.stub"),
- os.path.join(sbindir, "ldconfig"))
+ os.path.join(ldconfigdir, ldconfig))
ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w")
ld_so_conf.close()
vprint(" Creating package archives")
for pkg in self.localpkgs:
vprint("\t%s" % os.path.join(util.TMPDIR, pkg.filename()))
+ pkg.finalize()
pkg.makepkg(tmpdir)
for key, value in self.db.iteritems():
+ for pkg in value.pkgs:
+ pkg.finalize()
if key == "local" and not self.createlocalpkgs:
continue
for pkg in value.pkgs:
# Filesystem
vprint(" Populating file system")
- for pkg in self.db["local"].pkgs:
- vprint("\tinstalling %s" % pkg.fullname())
- pkg.install_package(self.root)
for f in self.filesystem:
vprint("\t%s" % f)
util.mkfile(self.root, f, f)
path = os.path.join(self.root, f)
if os.path.isfile(path):
os.utime(path, (355, 355))
+ for pkg in self.db["local"].pkgs:
+ vprint("\tinstalling %s" % pkg.fullname())
+ pkg.install_package(self.root)
# Done.
vprint(" Taking a snapshot of the file system")
cmd.append("fakeroot")
fakechroot = util.which("fakechroot")
- if fakechroot:
+ if not fakechroot:
+ print "WARNING: fakechroot not found!"
+ else:
cmd.append("fakechroot")
if pacman["gdb"]:
# archives are made available more easily.
time_start = time.time()
self.retcode = subprocess.call(cmd, stdout=output, stderr=output,
- cwd=os.path.join(self.root, util.TMPDIR))
+ cwd=os.path.join(self.root, util.TMPDIR), env={'LC_ALL': 'C'})
time_end = time.time()
vprint("\ttime elapsed: %.2fs" % (time_end - time_start))
if success == 1:
msg = " OK "
self.result["success"] += 1
- elif success == 0:
+ else:
msg = "FAIL"
self.result["fail"] += 1
- else:
- msg = "SKIP"
print "\t[%s] %s" % (msg, i)
# vim: set ts=4 sw=4 et: