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

View file

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