1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 00:39:46 +00:00

classes/buildhistory: record PKG/PKGE/PKGV/PKGR

Save PKG (the actual output package name, which is often different due
to debian renaming), and PKGE/PKGV/PKGR (which may be manipulated in
certain special cases e.g. gitpkgv.bbclass in meta-oe, the
external-sourcery-toolchain recipe, etc.) Note that these are only
written when they are different from the normal package name in the
case of PKG, or PE/PV/PR for the other variables.

Also, use PKGE/PKGV/PKGR instead of PE/PV/PR when comparing package
versions since these actually represent the version that the package
manager sees.

Implements [YOCTO #2787].

(From OE-Core rev: 65d7e9b2d4d8115ac9fd513c04f39a2df9556a5a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton
2012-08-02 10:23:05 +01:00
committed by Richard Purdie
parent c0149ac6c4
commit 81485a47d5
2 changed files with 71 additions and 17 deletions
+50 -16
View File
@@ -51,6 +51,11 @@ python buildhistory_emit_pkghistory() {
self.pe = "0"
self.pv = "0"
self.pr = "r0"
# pkg/pkge/pkgv/pkgr should be empty because we want to be able to default them
self.pkg = ""
self.pkge = ""
self.pkgv = ""
self.pkgr = ""
self.size = 0
self.depends = ""
self.rdepends = ""
@@ -72,8 +77,7 @@ python buildhistory_emit_pkghistory() {
def readPackageInfo(pkg, histfile):
pkginfo = PackageInfo(pkg)
f = open(histfile, "r")
try:
with open(histfile, "r") as f:
for line in f:
lns = line.split('=')
name = lns[0].strip()
@@ -84,6 +88,14 @@ python buildhistory_emit_pkghistory() {
pkginfo.pv = value
elif name == "PR":
pkginfo.pr = value
elif name == "PKG":
pkginfo.pkg = value
elif name == "PKGE":
pkginfo.pkge = value
elif name == "PKGV":
pkginfo.pkgv = value
elif name == "PKGR":
pkginfo.pkgr = value
elif name == "RDEPENDS":
pkginfo.rdepends = value
elif name == "RRECOMMENDS":
@@ -94,8 +106,15 @@ python buildhistory_emit_pkghistory() {
pkginfo.files = value
elif name == "FILELIST":
pkginfo.filelist = value
finally:
f.close()
# Apply defaults
if not pkginfo.pkg:
pkginfo.pkg = pkginfo.name
if not pkginfo.pkge:
pkginfo.pkge = pkginfo.pe
if not pkginfo.pkgv:
pkginfo.pkgv = pkginfo.pv
if not pkginfo.pkgr:
pkginfo.pkgr = pkginfo.pr
return pkginfo
def getlastpkgversion(pkg):
@@ -143,29 +162,33 @@ python buildhistory_emit_pkghistory() {
rcpinfo.packages = packages
write_recipehistory(rcpinfo, d)
# Apparently the version can be different on a per-package basis (see Python)
pkgdest = d.getVar('PKGDEST', True)
for pkg in packagelist:
pe = getpkgvar(pkg, 'PE') or "0"
pv = getpkgvar(pkg, 'PV')
pr = getpkgvar(pkg, 'PR')
pkge = getpkgvar(pkg, 'PKGE') or "0"
pkgv = getpkgvar(pkg, 'PKGV')
pkgr = getpkgvar(pkg, 'PKGR')
#
# Find out what the last version was
# Make sure the version did not decrease
#
lastversion = getlastpkgversion(pkg)
if lastversion:
last_pe = lastversion.pe
last_pv = lastversion.pv
last_pr = lastversion.pr
r = bb.utils.vercmp((pe, pv, pr), (last_pe, last_pv, last_pr))
last_pkge = lastversion.pkge
last_pkgv = lastversion.pkgv
last_pkgr = lastversion.pkgr
r = bb.utils.vercmp((pkge, pkgv, pkgr), (last_pkge, last_pkgv, last_pkgr))
if r < 0:
bb.error("Package version for package %s went backwards which would break package feeds from (%s:%s-%s to %s:%s-%s)" % (pkg, last_pe, last_pv, last_pr, pe, pv, pr))
bb.error("Package version for package %s went backwards which would break package feeds from (%s:%s-%s to %s:%s-%s)" % (pkg, last_pkge, last_pkgv, last_pkgr, pkge, pkgv, pkgr))
pkginfo = PackageInfo(pkg)
pkginfo.pe = pe
pkginfo.pv = pv
pkginfo.pr = pr
# Apparently the version can be different on a per-package basis (see Python)
pkginfo.pe = getpkgvar(pkg, 'PE') or "0"
pkginfo.pv = getpkgvar(pkg, 'PV')
pkginfo.pr = getpkgvar(pkg, 'PR')
pkginfo.pkg = getpkgvar(pkg, 'PKG') or pkg
pkginfo.pkge = pkge
pkginfo.pkgv = pkgv
pkginfo.pkgr = pkgr
pkginfo.rdepends = sortpkglist(squashspaces(getpkgvar(pkg, 'RDEPENDS') or ""))
pkginfo.rrecommends = sortpkglist(squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or ""))
pkginfo.files = squashspaces(getpkgvar(pkg, 'FILES') or "")
@@ -219,6 +242,17 @@ def write_pkghistory(pkginfo, d):
f.write("PE = %s\n" % pkginfo.pe)
f.write("PV = %s\n" % pkginfo.pv)
f.write("PR = %s\n" % pkginfo.pr)
pkgvars = {}
pkgvars['PKG'] = pkginfo.pkg if pkginfo.pkg != pkginfo.name else ''
pkgvars['PKGE'] = pkginfo.pkge if pkginfo.pkge != pkginfo.pe else ''
pkgvars['PKGV'] = pkginfo.pkgv if pkginfo.pkgv != pkginfo.pv else ''
pkgvars['PKGR'] = pkginfo.pkgr if pkginfo.pkgr != pkginfo.pr else ''
for pkgvar in pkgvars:
val = pkgvars[pkgvar]
if val:
f.write("%s = %s\n" % (pkgvar, val))
f.write("RDEPENDS = %s\n" % pkginfo.rdepends)
f.write("RRECOMMENDS = %s\n" % pkginfo.rrecommends)
f.write("PKGSIZE = %d\n" % pkginfo.size)