pmb.build.is_necessary(): Add optional apkindex_path parameter

This is necessary for pmbuilder (the componenet, that creates packages
in the upcoming binary package repository)
This commit is contained in:
Oliver Smith 2017-06-15 19:53:48 +02:00
parent 83eaa93c49
commit 906bda0e18
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 7 additions and 3 deletions

View File

@ -65,13 +65,14 @@ def copy_to_buildpath(args, package, suffix="native"):
"/home/user/build"], suffix=suffix)
def is_necessary(args, arch, apkbuild):
def is_necessary(args, arch, apkbuild, apkindex_path=None):
"""
Check if the package has already been built (because abuild's check
only works, if it is the same architecture!)
:param arch: package target architecture
:param apkbuild: from pmb.parse.apkbuild()
:param apkindex_path: override the APKINDEX.tar.gz path
:returns: boolean
"""
@ -80,9 +81,12 @@ def is_necessary(args, arch, apkbuild):
version_new = apkbuild["pkgver"] + "-r" + apkbuild["pkgrel"]
# Get old version from APKINDEX
if not apkindex_path:
apkindex_path = (args.work + "/packages/" + arch +
"/APKINDEX.tar.gz")
version_old = None
index_data = pmb.parse.apkindex.read(args, package,
args.work + "/packages/" + arch + "/APKINDEX.tar.gz", False)
index_data = pmb.parse.apkindex.read(args, package, apkindex_path,
False)
if index_data:
version_old = index_data["version"]