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)
downloadpoky-0f64a717d28184b01d8ec76cb4fe12c9102392d3.tar.gz
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):
1444 break 1444 break
1445 1445
1446 # To have the same data type than other package_info methods 1446 # To have the same data type than other package_info methods
1447 filepath = os.path.join(self.deploy_dir, arch, filename)
1447 pkg_dict = {} 1448 pkg_dict = {}
1448 pkg_dict[pkg] = {"arch":arch, "ver":ver, "filename":filename} 1449 pkg_dict[pkg] = {"arch":arch, "ver":ver, "filename":filename,
1450 "filepath": filepath}
1449 1451
1450 return pkg_dict 1452 return pkg_dict
1451 1453
@@ -1461,9 +1463,7 @@ class RpmPM(PackageManager):
1461 bb.fatal("Unable to get information for package '%s' while " 1463 bb.fatal("Unable to get information for package '%s' while "
1462 "trying to extract the package." % pkg) 1464 "trying to extract the package." % pkg)
1463 1465
1464 pkg_arch = pkg_info[pkg]["arch"] 1466 pkg_path = pkg_info[pkg]["filepath"]
1465 pkg_filename = pkg_info[pkg]["filename"]
1466 pkg_path = os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
1467 1467
1468 cpio_cmd = bb.utils.which(os.getenv("PATH"), "cpio") 1468 cpio_cmd = bb.utils.which(os.getenv("PATH"), "cpio")
1469 rpm2cpio_cmd = bb.utils.which(os.getenv("PATH"), "rpm2cpio") 1469 rpm2cpio_cmd = bb.utils.which(os.getenv("PATH"), "rpm2cpio")
@@ -1522,10 +1522,11 @@ class OpkgDpkgPM(PackageManager):
1522 1522
1523 This method extracts the common parts for Opkg and Dpkg 1523 This method extracts the common parts for Opkg and Dpkg
1524 """ 1524 """
1525 def extract(self, pkg, pkg_path): 1525 def extract(self, pkg, pkg_info):
1526 1526
1527 ar_cmd = bb.utils.which(os.getenv("PATH"), "ar") 1527 ar_cmd = bb.utils.which(os.getenv("PATH"), "ar")
1528 tar_cmd = bb.utils.which(os.getenv("PATH"), "tar") 1528 tar_cmd = bb.utils.which(os.getenv("PATH"), "tar")
1529 pkg_path = pkg_info[pkg]["filepath"]
1529 1530
1530 if not os.path.isfile(pkg_path): 1531 if not os.path.isfile(pkg_path):
1531 bb.fatal("Unable to extract package for '%s'." 1532 bb.fatal("Unable to extract package for '%s'."
@@ -1897,7 +1898,14 @@ class OpkgPM(OpkgDpkgPM):
1897 """ 1898 """
1898 def package_info(self, pkg): 1899 def package_info(self, pkg):
1899 cmd = "%s %s info %s" % (self.opkg_cmd, self.opkg_args, pkg) 1900 cmd = "%s %s info %s" % (self.opkg_cmd, self.opkg_args, pkg)
1900 return super(OpkgPM, self).package_info(pkg, cmd) 1901 pkg_info = super(OpkgPM, self).package_info(pkg, cmd)
1902
1903 pkg_arch = pkg_info[pkg]["arch"]
1904 pkg_filename = pkg_info[pkg]["filename"]
1905 pkg_info[pkg]["filepath"] = \
1906 os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
1907
1908 return pkg_info
1901 1909
1902 """ 1910 """
1903 Returns the path to a tmpdir where resides the contents of a package. 1911 Returns the path to a tmpdir where resides the contents of a package.
@@ -1910,11 +1918,7 @@ class OpkgPM(OpkgDpkgPM):
1910 bb.fatal("Unable to get information for package '%s' while " 1918 bb.fatal("Unable to get information for package '%s' while "
1911 "trying to extract the package." % pkg) 1919 "trying to extract the package." % pkg)
1912 1920
1913 pkg_arch = pkg_info[pkg]["arch"] 1921 tmp_dir = super(OpkgPM, self).extract(pkg, pkg_info)
1914 pkg_filename = pkg_info[pkg]["filename"]
1915 pkg_path = os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
1916
1917 tmp_dir = super(OpkgPM, self).extract(pkg, pkg_path)
1918 bb.utils.remove(os.path.join(tmp_dir, "data.tar.gz")) 1922 bb.utils.remove(os.path.join(tmp_dir, "data.tar.gz"))
1919 1923
1920 return tmp_dir 1924 return tmp_dir
@@ -2219,7 +2223,14 @@ class DpkgPM(OpkgDpkgPM):
2219 """ 2223 """
2220 def package_info(self, pkg): 2224 def package_info(self, pkg):
2221 cmd = "%s show %s" % (self.apt_cache_cmd, pkg) 2225 cmd = "%s show %s" % (self.apt_cache_cmd, pkg)
2222 return super(DpkgPM, self).package_info(pkg, cmd) 2226 pkg_info = super(DpkgPM, self).package_info(pkg, cmd)
2227
2228 pkg_arch = pkg_info[pkg]["pkgarch"]
2229 pkg_filename = pkg_info[pkg]["filename"]
2230 pkg_info[pkg]["filepath"] = \
2231 os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
2232
2233 return pkg_info
2223 2234
2224 """ 2235 """
2225 Returns the path to a tmpdir where resides the contents of a package. 2236 Returns the path to a tmpdir where resides the contents of a package.
@@ -2232,11 +2243,7 @@ class DpkgPM(OpkgDpkgPM):
2232 bb.fatal("Unable to get information for package '%s' while " 2243 bb.fatal("Unable to get information for package '%s' while "
2233 "trying to extract the package." % pkg) 2244 "trying to extract the package." % pkg)
2234 2245
2235 pkg_arch = pkg_info[pkg]["pkgarch"] 2246 tmp_dir = super(DpkgPM, self).extract(pkg, pkg_info)
2236 pkg_filename = pkg_info[pkg]["filename"]
2237 pkg_path = os.path.join(self.deploy_dir, pkg_arch, pkg_filename)
2238
2239 tmp_dir = super(DpkgPM, self).extract(pkg, pkg_path)
2240 bb.utils.remove(os.path.join(tmp_dir, "data.tar.xz")) 2247 bb.utils.remove(os.path.join(tmp_dir, "data.tar.xz"))
2241 2248
2242 return tmp_dir 2249 return tmp_dir