pmb.helpers.pkgrel_bump.auto_apkindex_files: remove (MR 1912)
Replace the call to this function with the almost identical pmb.helpers.repo.apkindex_files(), so release channel related changes only need to be done in one place.
This commit is contained in:
parent
3ff0b18a08
commit
5a256f66de
|
@ -1,7 +1,6 @@
|
||||||
# Copyright 2020 Oliver Smith
|
# Copyright 2020 Oliver Smith
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
|
|
||||||
import pmb.helpers.file
|
import pmb.helpers.file
|
||||||
import pmb.helpers.pmaports
|
import pmb.helpers.pmaports
|
||||||
|
@ -44,29 +43,6 @@ def package(args, pkgname, reason="", dry=False):
|
||||||
path)
|
path)
|
||||||
|
|
||||||
|
|
||||||
def auto_apkindex_files(args):
|
|
||||||
"""
|
|
||||||
Get the paths to the APKINDEX files, that need to be analyzed, sorted by
|
|
||||||
arch. Relevant are the local pmbootstrap generated APKINDEX as well as the
|
|
||||||
APKINDEX from the pmOS binary repo.
|
|
||||||
|
|
||||||
:returns: {"armhf": "...../APKINDEX.tar.gz", ...}
|
|
||||||
"""
|
|
||||||
pmb.helpers.repo.update(args)
|
|
||||||
ret = {}
|
|
||||||
for arch in pmb.config.build_device_architectures:
|
|
||||||
ret[arch] = []
|
|
||||||
local = args.work + "/packages/" + arch + "/APKINDEX.tar.gz"
|
|
||||||
if os.path.exists(local):
|
|
||||||
ret[arch].append(local)
|
|
||||||
|
|
||||||
for mirror in args.mirrors_postmarketos:
|
|
||||||
path = (args.work + "/cache_apk_" + arch + "/APKINDEX." +
|
|
||||||
pmb.helpers.repo.hash(mirror) + ".tar.gz")
|
|
||||||
ret[arch].append(path)
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
def auto_apkindex_package(args, arch, aport, apk, dry=False):
|
def auto_apkindex_package(args, arch, aport, apk, dry=False):
|
||||||
"""
|
"""
|
||||||
Bump the pkgrel of a specific package if it is outdated in the given
|
Bump the pkgrel of a specific package if it is outdated in the given
|
||||||
|
@ -127,7 +103,8 @@ def auto(args, dry=False):
|
||||||
:returns: list of aport names, where the pkgrel needed to be changed
|
:returns: list of aport names, where the pkgrel needed to be changed
|
||||||
"""
|
"""
|
||||||
ret = []
|
ret = []
|
||||||
for arch, paths in auto_apkindex_files(args).items():
|
for arch in pmb.config.build_device_architectures:
|
||||||
|
paths = pmb.helpers.repo.apkindex_files(args, arch, alpine=False)
|
||||||
for path in paths:
|
for path in paths:
|
||||||
logging.info("scan " + path)
|
logging.info("scan " + path)
|
||||||
index = pmb.parse.apkindex.parse(args, path, False)
|
index = pmb.parse.apkindex.parse(args, path, False)
|
||||||
|
|
|
@ -40,9 +40,14 @@ def hash(url, length=8):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def urls(args, user_repository=True, postmarketos_mirror=True):
|
def urls(args, user_repository=True, postmarketos_mirror=True, alpine=True):
|
||||||
"""
|
"""
|
||||||
Get a list of repository URLs, as they are in /etc/apk/repositories.
|
Get a list of repository URLs, as they are in /etc/apk/repositories.
|
||||||
|
:param user_repository: add /mnt/pmbootstrap-packages
|
||||||
|
:param postmarketos_mirror: add postmarketos mirror URLs
|
||||||
|
:param alpine: add alpine mirror URLs
|
||||||
|
:returns: list of mirror strings, like ["/mnt/pmbootstrap-packages",
|
||||||
|
"http://...", ...]
|
||||||
"""
|
"""
|
||||||
ret = []
|
ret = []
|
||||||
|
|
||||||
|
@ -70,6 +75,7 @@ def urls(args, user_repository=True, postmarketos_mirror=True):
|
||||||
ret.append(f"{mirror}{mirrordir_pmos}")
|
ret.append(f"{mirror}{mirrordir_pmos}")
|
||||||
|
|
||||||
# Upstream Alpine Linux repositories
|
# Upstream Alpine Linux repositories
|
||||||
|
if alpine:
|
||||||
directories = ["main", "community"]
|
directories = ["main", "community"]
|
||||||
if mirrordir_alpine == "edge":
|
if mirrordir_alpine == "edge":
|
||||||
directories.append("testing")
|
directories.append("testing")
|
||||||
|
@ -78,20 +84,27 @@ def urls(args, user_repository=True, postmarketos_mirror=True):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def apkindex_files(args, arch=None):
|
def apkindex_files(args, arch=None, user_repository=True, pmos=True,
|
||||||
|
alpine=True):
|
||||||
"""
|
"""
|
||||||
Get a list of outside paths to all resolved APKINDEX.tar.gz files for a
|
Get a list of outside paths to all resolved APKINDEX.tar.gz files for a
|
||||||
specific arch.
|
specific arch.
|
||||||
:param arch: defaults to native
|
:param arch: defaults to native
|
||||||
|
:param user_repository: add path to index of locally built packages
|
||||||
|
:param pmos: add paths to indexes of postmarketos mirrors
|
||||||
|
:param alpine: add paths to indexes of alpine mirrors
|
||||||
|
:returns: list of absolute APKINDEX.tar.gz file paths
|
||||||
"""
|
"""
|
||||||
if not arch:
|
if not arch:
|
||||||
arch = args.arch_native
|
arch = args.arch_native
|
||||||
|
|
||||||
|
ret = []
|
||||||
# Local user repository (for packages compiled with pmbootstrap)
|
# Local user repository (for packages compiled with pmbootstrap)
|
||||||
|
if user_repository:
|
||||||
ret = [args.work + "/packages/" + arch + "/APKINDEX.tar.gz"]
|
ret = [args.work + "/packages/" + arch + "/APKINDEX.tar.gz"]
|
||||||
|
|
||||||
# Resolve the APKINDEX.$HASH.tar.gz files
|
# Resolve the APKINDEX.$HASH.tar.gz files
|
||||||
for url in urls(args, False):
|
for url in urls(args, False, pmos, alpine):
|
||||||
ret.append(args.work + "/cache_apk_" + arch + "/APKINDEX." +
|
ret.append(args.work + "/cache_apk_" + arch + "/APKINDEX." +
|
||||||
hash(url) + ".tar.gz")
|
hash(url) + ".tar.gz")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue