aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-07-17 20:32:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-25 23:46:59 +0100
commit2a7f203dbe4fda5dba9137503e93669392719aba (patch)
tree5b55b05d13fa7a9449a1895ed7c6fbe4cfb9a695 /meta/classes
parentccfc13adedd97f57024420639053080e047529dc (diff)
downloadopenembedded-core-contrib-2a7f203dbe4fda5dba9137503e93669392719aba.tar.gz
packagefeed-stability.bbclass: copy all packages of a recipe
A recipes can generate several rpms such as a.rpm, a-dev.rpm, a-dbg.rpm, when update one of them in the repo, we'd better update all of them, otherwise, there might be a-dev.r0.1.rpm and a-dbg.r0.3.rpm in the repo, which looks strange. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/packagefeed-stability.bbclass103
1 files changed, 35 insertions, 68 deletions
diff --git a/meta/classes/packagefeed-stability.bbclass b/meta/classes/packagefeed-stability.bbclass
index 808a18f93a..df4c2babb6 100644
--- a/meta/classes/packagefeed-stability.bbclass
+++ b/meta/classes/packagefeed-stability.bbclass
@@ -133,8 +133,10 @@ def package_compare_impl(pkgtype, d):
pkgwritetask = 'package_write_%s' % pkgtype
files = []
- copypkgs = []
+ docopy = False
manifest, _ = oe.sstatesig.sstate_get_manifest_filename(pkgwritetask, d)
+ # Copy recipe's all packages if one of the packages are different to make
+ # they have the same PR.
with open(manifest, 'r') as f:
for line in f:
if line.startswith(prepath):
@@ -164,88 +166,53 @@ def package_compare_impl(pkgtype, d):
bb.warn('Unable to map %s back to package' % pkgbasename)
destpathspec = destpath
- oldfiles = glob.glob(destpathspec)
oldfile = None
- docopy = True
- if oldfiles:
- oldfile = oldfiles[-1]
- result = subprocess.call(['pkg-diff.sh', oldfile, srcpath])
- if result == 0:
- docopy = False
-
- files.append((pkgname, pkgbasename, srcpath, oldfile, destpath))
- bb.debug(2, '%s: package %s %s' % (pn, files[-1], docopy))
- if docopy:
- copypkgs.append(pkgname)
-
- # Ensure that dependencies on specific versions (such as -dev on the
- # main package) are copied in lock-step
- changed = True
- while changed:
- rpkgdict = {x[0]: x[1] for x in rpkglist}
- changed = False
- for pkgname, pkgbasename, srcpath, oldfile, destpath in files:
- rdeps = rdepends.get(pkgname, None)
- if not rdeps:
- continue
- rdepvers = bb.utils.explode_dep_versions2(rdeps)
- for rdep, versions in rdepvers.items():
- dep = rpkgdict.get(rdep, None)
- for version in versions:
- if version and version.startswith('= '):
- if dep in copypkgs and not pkgname in copypkgs:
- bb.debug(2, '%s: copying %s because it has a fixed version dependency on %s and that package is going to be copied' % (pn, pkgname, dep))
- changed = True
- copypkgs.append(pkgname)
- elif pkgname in copypkgs and not dep in copypkgs:
- bb.debug(2, '%s: copying %s because %s has a fixed version dependency on it and that package is going to be copied' % (pn, dep, pkgname))
- changed = True
- copypkgs.append(dep)
-
- # Read in old manifest so we can delete any packages we aren't going to replace or preserve
- pcmanifest = os.path.join(prepath, d.expand('pkg-compare-manifest-${MULTIMACH_TARGET_SYS}-${PN}'))
- try:
- with open(pcmanifest, 'r') as f:
- knownfiles = [x[3] for x in files if x[3]]
- for line in f:
- fn = line.rstrip()
- if fn:
- if fn in knownfiles:
- knownfiles.remove(fn)
- else:
+ if not docopy:
+ oldfiles = glob.glob(destpathspec)
+ if oldfiles:
+ oldfile = oldfiles[-1]
+ result = subprocess.call(['pkg-diff.sh', oldfile, srcpath])
+ if result != 0:
+ docopy = True
+ bb.note("%s and %s are different, will copy packages" % (oldfile, srcpath))
+ else:
+ docopy = True
+ bb.note("No old packages found for %s, will copy packages" % pkgname)
+
+ files.append((pkgname, pkgbasename, srcpath, destpath))
+
+ # Remove all the old files and copy again if docopy
+ if docopy:
+ bb.plain('Copying packages for recipe %s' % pn)
+ pcmanifest = os.path.join(prepath, d.expand('pkg-compare-manifest-${MULTIMACH_TARGET_SYS}-${PN}'))
+ try:
+ with open(pcmanifest, 'r') as f:
+ for line in f:
+ fn = line.rstrip()
+ if fn:
try:
os.remove(fn)
- bb.warn('Removed old package %s' % fn)
+ bb.note('Removed old package %s' % fn)
except OSError as e:
if e.errno == errno.ENOENT:
pass
- except IOError as e:
- if e.errno == errno.ENOENT:
- pass
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ pass
- # Create new manifest
- with open(pcmanifest, 'w') as f:
- for pkgname, pkgbasename, srcpath, oldfile, destpath in files:
- if pkgname in copypkgs:
- bb.warn('Copying %s' % pkgbasename)
+ # Create new manifest
+ with open(pcmanifest, 'w') as f:
+ for pkgname, pkgbasename, srcpath, destpath in files:
destdir = os.path.dirname(destpath)
bb.utils.mkdirhier(destdir)
- if oldfile:
- try:
- os.remove(oldfile)
- except OSError as e:
- if e.errno == errno.ENOENT:
- pass
if (os.stat(srcpath).st_dev == os.stat(destdir).st_dev):
# Use a hard link to save space
os.link(srcpath, destpath)
else:
shutil.copyfile(srcpath, destpath)
f.write('%s\n' % destpath)
- else:
- bb.warn('Not copying %s' % pkgbasename)
- f.write('%s\n' % oldfile)
-
+ else:
+ bb.plain('Not copying packages for %s' % pn)
do_cleanall_append() {
import errno