summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-05-24 12:44:16 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-30 15:58:13 +0100
commit0f64a717d28184b01d8ec76cb4fe12c9102392d3 (patch)
tree73f46cb84cbf6ec28e4a7c57be07cb0bfea0586b /meta/lib
parentd56ccf691b194ce4d753b2bd1a4b12c524d4a887 (diff)
downloadopenembedded-core-contrib-0f64a717d28184b01d8ec76cb4fe12c9102392d3.tar.gz
openembedded-core-contrib-0f64a717d28184b01d8ec76cb4fe12c9102392d3.tar.bz2
openembedded-core-contrib-0f64a717d28184b01d8ec76cb4fe12c9102392d3.zip
lib/oe/package_manager.py: Add pkgpath to dict returned by package_info
Having the package path with all the other package info allows to reuse more code and have this information outside the package manager, without additional processing. [YOCTO #8536] (From OE-Core rev: 343f762792cbfccffaf3aa901289f9bb0f8cef3d) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/package_manager.py41
1 files changed, 24 insertions, 17 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 2d7da961cd..79b3206621 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -1444,8 +1444,10 @@ class RpmPM(PackageManager):
break
# To have the same data type than other package_info methods
+ filepath = os.path.join(self.deploy_dir, arch, filename)
pkg_dict = {}
- pkg_dict[pkg] = {"arch":arch, "ver":ver, "filename":filename}
+ pkg_dict[pkg] = {"arch":arch, "ver":ver, "filename":filename,
+ "filepath": filepath}
return pkg_dict
@@ -1461,9 +1463,7 @@ class RpmPM(PackageManager):
bb.fatal("Unable to get information for package '%s' while "
"trying to extract the package." % pkg)
- pkg_arch = pkg_info[pkg]["arch"]
- pkg_filename = pkg_info[pkg]["filename"]
- pkg_path = os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
+ pkg_path = pkg_info[pkg]["filepath"]
cpio_cmd = bb.utils.which(os.getenv("PATH"), "cpio")
rpm2cpio_cmd = bb.utils.which(os.getenv("PATH"), "rpm2cpio")
@@ -1522,10 +1522,11 @@ class OpkgDpkgPM(PackageManager):
This method extracts the common parts for Opkg and Dpkg
"""
- def extract(self, pkg, pkg_path):
+ def extract(self, pkg, pkg_info):
ar_cmd = bb.utils.which(os.getenv("PATH"), "ar")
tar_cmd = bb.utils.which(os.getenv("PATH"), "tar")
+ pkg_path = pkg_info[pkg]["filepath"]
if not os.path.isfile(pkg_path):
bb.fatal("Unable to extract package for '%s'."
@@ -1897,7 +1898,14 @@ class OpkgPM(OpkgDpkgPM):
"""
def package_info(self, pkg):
cmd = "%s %s info %s" % (self.opkg_cmd, self.opkg_args, pkg)
- return super(OpkgPM, self).package_info(pkg, cmd)
+ pkg_info = super(OpkgPM, self).package_info(pkg, cmd)
+
+ pkg_arch = pkg_info[pkg]["arch"]
+ pkg_filename = pkg_info[pkg]["filename"]
+ pkg_info[pkg]["filepath"] = \
+ os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
+
+ return pkg_info
"""
Returns the path to a tmpdir where resides the contents of a package.
@@ -1910,11 +1918,7 @@ class OpkgPM(OpkgDpkgPM):
bb.fatal("Unable to get information for package '%s' while "
"trying to extract the package." % pkg)
- pkg_arch = pkg_info[pkg]["arch"]
- pkg_filename = pkg_info[pkg]["filename"]
- pkg_path = os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
-
- tmp_dir = super(OpkgPM, self).extract(pkg, pkg_path)
+ tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info)
bb.utils.remove(os.path.join(tmp_dir, "data.tar.gz"))
return tmp_dir
@@ -2219,7 +2223,14 @@ class DpkgPM(OpkgDpkgPM):
"""
def package_info(self, pkg):
cmd = "%s show %s" % (self.apt_cache_cmd, pkg)
- return super(DpkgPM, self).package_info(pkg, cmd)
+ pkg_info = super(DpkgPM, self).package_info(pkg, cmd)
+
+ pkg_arch = pkg_info[pkg]["pkgarch"]
+ pkg_filename = pkg_info[pkg]["filename"]
+ pkg_info[pkg]["filepath"] = \
+ os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
+
+ return pkg_info
"""
Returns the path to a tmpdir where resides the contents of a package.
@@ -2232,11 +2243,7 @@ class DpkgPM(OpkgDpkgPM):
bb.fatal("Unable to get information for package '%s' while "
"trying to extract the package." % pkg)
- pkg_arch = pkg_info[pkg]["pkgarch"]
- pkg_filename = pkg_info[pkg]["filename"]
- pkg_path = os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
-
- tmp_dir = super(DpkgPM, self).extract(pkg, pkg_path)
+ tmp_dir = super(DpkgPM, self).extract(pkg, pkg_info)
bb.utils.remove(os.path.join(tmp_dir, "data.tar.xz"))
return tmp_dir