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:
Oliver Smith 2020-04-13 01:16:52 +02:00
parent 3ff0b18a08
commit 5a256f66de
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 24 additions and 34 deletions

View File

@ -1,7 +1,6 @@
# Copyright 2020 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
import logging
import os
import pmb.helpers.file
import pmb.helpers.pmaports
@ -44,29 +43,6 @@ def package(args, pkgname, reason="", dry=False):
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):
"""
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
"""
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:
logging.info("scan " + path)
index = pmb.parse.apkindex.parse(args, path, False)

View File

@ -40,9 +40,14 @@ def hash(url, length=8):
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.
: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 = []
@ -70,28 +75,36 @@ def urls(args, user_repository=True, postmarketos_mirror=True):
ret.append(f"{mirror}{mirrordir_pmos}")
# Upstream Alpine Linux repositories
directories = ["main", "community"]
if mirrordir_alpine == "edge":
directories.append("testing")
for dir in directories:
ret.append(f"{args.mirror_alpine}{mirrordir_alpine}/{dir}")
if alpine:
directories = ["main", "community"]
if mirrordir_alpine == "edge":
directories.append("testing")
for dir in directories:
ret.append(f"{args.mirror_alpine}{mirrordir_alpine}/{dir}")
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
specific arch.
: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:
arch = args.arch_native
ret = []
# Local user repository (for packages compiled with pmbootstrap)
ret = [args.work + "/packages/" + arch + "/APKINDEX.tar.gz"]
if user_repository:
ret = [args.work + "/packages/" + arch + "/APKINDEX.tar.gz"]
# 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." +
hash(url) + ".tar.gz")