summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2014-01-22 14:15:02 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-11 11:53:40 +0000
commit080ce635164e3b4d6036205c1ec3419dd629615d (patch)
treefa1450d331311540ae6762dfb7eecef17a56a461 /meta
parent0b47dc4491701877068727e20e9147b5f3e635c0 (diff)
downloadast2050-yocto-poky-080ce635164e3b4d6036205c1ec3419dd629615d.zip
ast2050-yocto-poky-080ce635164e3b4d6036205c1ec3419dd629615d.tar.gz
lib/oe/package_manager.py: fixes for dpkg backend
This commit contains the following fixes: * pass the apt config directory to the DpkgPM constructor, so one can instantiate this class multiple times and give it different config files (like for creating SDK); * change constructor argument name from 'dpkg_archs' to 'base_archs'; * export APT_CONFIG environment variable before calling apt-get, not in constructor. If done in constructor, the last class instantiation, sets the environment, which is note desireable; (From OE-Core rev: dc626cbcfd37c940bb8739b14d3ab8097e1760ea) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/package_manager.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index e06ded4..e802edd 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -349,19 +349,20 @@ class OpkgPM(PackageManager):
class DpkgPM(PackageManager):
- def __init__(self, d, target_rootfs, archs, dpkg_arch):
+ def __init__(self, d, target_rootfs, archs, base_archs, apt_conf_dir=None):
super(DpkgPM, self).__init__(d)
self.target_rootfs = target_rootfs
self.deploy_dir = self.d.getVar('DEPLOY_DIR_DEB', True)
- self.apt_conf_dir = self.d.expand("${APTCONF_TARGET}/apt")
+ if apt_conf_dir is None:
+ self.apt_conf_dir = self.d.expand("${APTCONF_TARGET}/apt")
+ else:
+ self.apt_conf_dir = apt_conf_dir
self.apt_conf_file = os.path.join(self.apt_conf_dir, "apt.conf")
self.apt_get_cmd = bb.utils.which(os.getenv('PATH'), "apt-get")
self.apt_args = d.getVar("APT_ARGS", True)
- os.environ['APT_CONFIG'] = self.apt_conf_file
-
- self._create_configs(archs, dpkg_arch)
+ self._create_configs(archs, base_archs)
"""
This function will change a package's status in /var/lib/dpkg/status file.
@@ -437,6 +438,8 @@ class DpkgPM(PackageManager):
self.mark_packages("unpacked", failed_pkgs)
def update(self):
+ os.environ['APT_CONFIG'] = self.apt_conf_file
+
cmd = "%s update" % self.apt_get_cmd
try:
@@ -446,6 +449,8 @@ class DpkgPM(PackageManager):
"returned %d" % (e.cmd, e.returncode))
def install(self, pkgs, attempt_only=False):
+ os.environ['APT_CONFIG'] = self.apt_conf_file
+
cmd = "%s %s install --force-yes --allow-unauthenticated %s" % \
(self.apt_get_cmd, self.apt_args, ' '.join(pkgs))
@@ -474,6 +479,7 @@ class DpkgPM(PackageManager):
def remove(self, pkgs, with_dependencies=True):
if with_dependencies:
+ os.environ['APT_CONFIG'] = self.apt_conf_file
cmd = "%s remove %s" % (self.apt_get_cmd, ' '.join(pkgs))
else:
cmd = "%s --admindir=%s/var/lib/dpkg --instdir=%s" \
@@ -532,8 +538,8 @@ class DpkgPM(PackageManager):
open(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"), "w+").close()
- def _create_configs(self, archs, dpkg_arch):
- dpkg_arch = re.sub("_", "-", dpkg_arch)
+ def _create_configs(self, archs, base_archs):
+ base_archs = re.sub("_", "-", base_archs)
if os.path.exists(self.apt_conf_dir):
bb.utils.remove(self.apt_conf_dir, True)
@@ -573,7 +579,7 @@ class DpkgPM(PackageManager):
with open(self.d.expand("${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample")) as apt_conf_sample:
for line in apt_conf_sample.read().split("\n"):
line = re.sub("Architecture \".*\";",
- "Architecture \"%s\";" % dpkg_arch, line)
+ "Architecture \"%s\";" % base_archs, line)
line = re.sub("#ROOTFS#", self.target_rootfs, line)
line = re.sub("#APTCONF#", self.apt_conf_dir, line)
@@ -593,6 +599,8 @@ class DpkgPM(PackageManager):
bb.utils.remove(self.target_rootfs + "/var/lib/dpkg/", True)
def fix_broken_dependencies(self):
+ os.environ['APT_CONFIG'] = self.apt_conf_file
+
cmd = "%s %s -f install" % (self.apt_get_cmd, self.apt_args)
try:
OpenPOWER on IntegriCloud