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:
parent
c0149ac6c4
commit
81485a47d5
|
@ -51,6 +51,11 @@ python buildhistory_emit_pkghistory() {
|
||||||
self.pe = "0"
|
self.pe = "0"
|
||||||
self.pv = "0"
|
self.pv = "0"
|
||||||
self.pr = "r0"
|
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.size = 0
|
||||||
self.depends = ""
|
self.depends = ""
|
||||||
self.rdepends = ""
|
self.rdepends = ""
|
||||||
|
@ -72,8 +77,7 @@ python buildhistory_emit_pkghistory() {
|
||||||
|
|
||||||
def readPackageInfo(pkg, histfile):
|
def readPackageInfo(pkg, histfile):
|
||||||
pkginfo = PackageInfo(pkg)
|
pkginfo = PackageInfo(pkg)
|
||||||
f = open(histfile, "r")
|
with open(histfile, "r") as f:
|
||||||
try:
|
|
||||||
for line in f:
|
for line in f:
|
||||||
lns = line.split('=')
|
lns = line.split('=')
|
||||||
name = lns[0].strip()
|
name = lns[0].strip()
|
||||||
|
@ -84,6 +88,14 @@ python buildhistory_emit_pkghistory() {
|
||||||
pkginfo.pv = value
|
pkginfo.pv = value
|
||||||
elif name == "PR":
|
elif name == "PR":
|
||||||
pkginfo.pr = value
|
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":
|
elif name == "RDEPENDS":
|
||||||
pkginfo.rdepends = value
|
pkginfo.rdepends = value
|
||||||
elif name == "RRECOMMENDS":
|
elif name == "RRECOMMENDS":
|
||||||
|
@ -94,8 +106,15 @@ python buildhistory_emit_pkghistory() {
|
||||||
pkginfo.files = value
|
pkginfo.files = value
|
||||||
elif name == "FILELIST":
|
elif name == "FILELIST":
|
||||||
pkginfo.filelist = value
|
pkginfo.filelist = value
|
||||||
finally:
|
# Apply defaults
|
||||||
f.close()
|
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
|
return pkginfo
|
||||||
|
|
||||||
def getlastpkgversion(pkg):
|
def getlastpkgversion(pkg):
|
||||||
|
@ -143,29 +162,33 @@ python buildhistory_emit_pkghistory() {
|
||||||
rcpinfo.packages = packages
|
rcpinfo.packages = packages
|
||||||
write_recipehistory(rcpinfo, d)
|
write_recipehistory(rcpinfo, d)
|
||||||
|
|
||||||
# Apparently the version can be different on a per-package basis (see Python)
|
|
||||||
pkgdest = d.getVar('PKGDEST', True)
|
pkgdest = d.getVar('PKGDEST', True)
|
||||||
for pkg in packagelist:
|
for pkg in packagelist:
|
||||||
pe = getpkgvar(pkg, 'PE') or "0"
|
pkge = getpkgvar(pkg, 'PKGE') or "0"
|
||||||
pv = getpkgvar(pkg, 'PV')
|
pkgv = getpkgvar(pkg, 'PKGV')
|
||||||
pr = getpkgvar(pkg, 'PR')
|
pkgr = getpkgvar(pkg, 'PKGR')
|
||||||
#
|
#
|
||||||
# Find out what the last version was
|
# Find out what the last version was
|
||||||
# Make sure the version did not decrease
|
# Make sure the version did not decrease
|
||||||
#
|
#
|
||||||
lastversion = getlastpkgversion(pkg)
|
lastversion = getlastpkgversion(pkg)
|
||||||
if lastversion:
|
if lastversion:
|
||||||
last_pe = lastversion.pe
|
last_pkge = lastversion.pkge
|
||||||
last_pv = lastversion.pv
|
last_pkgv = lastversion.pkgv
|
||||||
last_pr = lastversion.pr
|
last_pkgr = lastversion.pkgr
|
||||||
r = bb.utils.vercmp((pe, pv, pr), (last_pe, last_pv, last_pr))
|
r = bb.utils.vercmp((pkge, pkgv, pkgr), (last_pkge, last_pkgv, last_pkgr))
|
||||||
if r < 0:
|
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 = PackageInfo(pkg)
|
||||||
pkginfo.pe = pe
|
# Apparently the version can be different on a per-package basis (see Python)
|
||||||
pkginfo.pv = pv
|
pkginfo.pe = getpkgvar(pkg, 'PE') or "0"
|
||||||
pkginfo.pr = pr
|
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.rdepends = sortpkglist(squashspaces(getpkgvar(pkg, 'RDEPENDS') or ""))
|
||||||
pkginfo.rrecommends = sortpkglist(squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or ""))
|
pkginfo.rrecommends = sortpkglist(squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or ""))
|
||||||
pkginfo.files = squashspaces(getpkgvar(pkg, 'FILES') 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("PE = %s\n" % pkginfo.pe)
|
||||||
f.write("PV = %s\n" % pkginfo.pv)
|
f.write("PV = %s\n" % pkginfo.pv)
|
||||||
f.write("PR = %s\n" % pkginfo.pr)
|
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("RDEPENDS = %s\n" % pkginfo.rdepends)
|
||||||
f.write("RRECOMMENDS = %s\n" % pkginfo.rrecommends)
|
f.write("RRECOMMENDS = %s\n" % pkginfo.rrecommends)
|
||||||
f.write("PKGSIZE = %d\n" % pkginfo.size)
|
f.write("PKGSIZE = %d\n" % pkginfo.size)
|
||||||
|
|
|
@ -19,9 +19,10 @@ import bb.utils
|
||||||
# How to display fields
|
# How to display fields
|
||||||
list_fields = ['DEPENDS', 'RDEPENDS', 'RRECOMMENDS', 'FILES', 'FILELIST', 'USER_CLASSES', 'IMAGE_CLASSES', 'IMAGE_FEATURES', 'IMAGE_LINGUAS', 'IMAGE_INSTALL', 'BAD_RECOMMENDATIONS']
|
list_fields = ['DEPENDS', 'RDEPENDS', 'RRECOMMENDS', 'FILES', 'FILELIST', 'USER_CLASSES', 'IMAGE_CLASSES', 'IMAGE_FEATURES', 'IMAGE_LINGUAS', 'IMAGE_INSTALL', 'BAD_RECOMMENDATIONS']
|
||||||
list_order_fields = ['PACKAGES']
|
list_order_fields = ['PACKAGES']
|
||||||
|
defaultval_fields = ['PKG', 'PKGE', 'PKGV', 'PKGR']
|
||||||
numeric_fields = ['PKGSIZE', 'IMAGESIZE']
|
numeric_fields = ['PKGSIZE', 'IMAGESIZE']
|
||||||
# Fields to monitor
|
# Fields to monitor
|
||||||
monitor_fields = ['RDEPENDS', 'RRECOMMENDS', 'PACKAGES', 'FILELIST', 'PKGSIZE', 'IMAGESIZE']
|
monitor_fields = ['RDEPENDS', 'RRECOMMENDS', 'PACKAGES', 'FILELIST', 'PKGSIZE', 'IMAGESIZE', 'PKG', 'PKGE', 'PKGV', 'PKGR']
|
||||||
# Percentage change to alert for numeric fields
|
# Percentage change to alert for numeric fields
|
||||||
monitor_numeric_threshold = 20
|
monitor_numeric_threshold = 20
|
||||||
# Image files to monitor (note that image-info.txt is handled separately)
|
# Image files to monitor (note that image-info.txt is handled separately)
|
||||||
|
@ -90,6 +91,10 @@ class ChangeRecord:
|
||||||
else:
|
else:
|
||||||
percentchg = 100
|
percentchg = 100
|
||||||
out = '%s changed from %s to %s (%s%d%%)' % (self.fieldname, self.oldvalue or "''", self.newvalue or "''", '+' if percentchg > 0 else '', percentchg)
|
out = '%s changed from %s to %s (%s%d%%)' % (self.fieldname, self.oldvalue or "''", self.newvalue or "''", '+' if percentchg > 0 else '', percentchg)
|
||||||
|
elif self.fieldname in defaultval_fields:
|
||||||
|
out = '%s changed from %s to %s' % (self.fieldname, self.oldvalue, self.newvalue)
|
||||||
|
if self.fieldname == 'PKG' and '[default]' in self.newvalue:
|
||||||
|
out += ' - may indicate debian renaming failure'
|
||||||
elif self.fieldname in ['pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm']:
|
elif self.fieldname in ['pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm']:
|
||||||
if self.oldvalue and self.newvalue:
|
if self.oldvalue and self.newvalue:
|
||||||
out = '%s changed:\n ' % self.fieldname
|
out = '%s changed:\n ' % self.fieldname
|
||||||
|
@ -299,6 +304,14 @@ def compare_dict_blobs(path, ablob, bblob, report_all):
|
||||||
adict = blob_to_dict(ablob)
|
adict = blob_to_dict(ablob)
|
||||||
bdict = blob_to_dict(bblob)
|
bdict = blob_to_dict(bblob)
|
||||||
|
|
||||||
|
defaultvals = {}
|
||||||
|
defaultvals['PKG'] = os.path.basename(path)
|
||||||
|
defaultvals['PKGE'] = adict.get('PE', '0')
|
||||||
|
defaultvals['PKGV'] = adict.get('PV', '')
|
||||||
|
defaultvals['PKGR'] = adict.get('PR', '')
|
||||||
|
for key in defaultvals:
|
||||||
|
defaultvals[key] = '%s [default]' % defaultvals[key]
|
||||||
|
|
||||||
changes = []
|
changes = []
|
||||||
keys = list(set(adict.keys()) | set(bdict.keys()))
|
keys = list(set(adict.keys()) | set(bdict.keys()))
|
||||||
for key in keys:
|
for key in keys:
|
||||||
|
@ -327,6 +340,13 @@ def compare_dict_blobs(path, ablob, bblob, report_all):
|
||||||
blist.sort()
|
blist.sort()
|
||||||
if ' '.join(alist) == ' '.join(blist):
|
if ' '.join(alist) == ' '.join(blist):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if key in defaultval_fields:
|
||||||
|
if not astr:
|
||||||
|
astr = defaultvals[key]
|
||||||
|
elif not bstr:
|
||||||
|
bstr = defaultvals[key]
|
||||||
|
|
||||||
chg = ChangeRecord(path, key, astr, bstr, key in monitor_fields)
|
chg = ChangeRecord(path, key, astr, bstr, key in monitor_fields)
|
||||||
changes.append(chg)
|
changes.append(chg)
|
||||||
return changes
|
return changes
|
||||||
|
|
Loading…
Reference in New Issue