1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 11:29:46 +03:00

pmb: Migrate pkgrel_bump to Command (MR 2411)

Also remove args from functions that don't actually need it to
faciliate this.

This does not attempt to fix any of the bugs with pkgrel_bump.
This commit is contained in:
Stefan Hansson 2024-09-26 17:39:33 +02:00
parent 3d60673f64
commit 8a64c9da8f
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 41 additions and 26 deletions

View file

@ -3,7 +3,6 @@
from pmb.core.arch import Arch
from pmb.helpers import logging
from pmb.types import PmbArgs
import pmb.helpers.file
import pmb.helpers.pmaports
import pmb.helpers.repo
@ -11,7 +10,7 @@ import pmb.parse
import pmb.parse.apkindex
def package(args: PmbArgs, pkgname: str, reason="", dry: bool = False) -> None:
def package(pkgname: str, reason="", dry: bool = False) -> None:
"""Increase the pkgrel in the APKBUILD of a specific package.
:param pkgname: name of the package
@ -54,7 +53,7 @@ def package(args: PmbArgs, pkgname: str, reason="", dry: bool = False) -> None:
)
def auto_apkindex_package(args: PmbArgs, arch, aport, apk, dry: bool = False) -> bool:
def auto_apkindex_package(arch, aport, apk, dry: bool = False) -> bool:
"""Bump the pkgrel of a specific package if it is outdated in the given APKINDEX.
:param arch: the architecture, e.g. "armhf"
@ -103,13 +102,13 @@ def auto_apkindex_package(args: PmbArgs, arch, aport, apk, dry: bool = False) ->
# Increase pkgrel
if len(missing):
package(args, pkgname, reason=", missing depend(s): " + ", ".join(missing), dry=dry)
package(pkgname, reason=", missing depend(s): " + ", ".join(missing), dry=dry)
return True
return False
def auto(args: PmbArgs, dry=False) -> list[str]:
def auto(dry=False) -> list[str]:
""":returns: list of aport names, where the pkgrel needed to be changed"""
ret = []
for arch in Arch.supported():
@ -128,6 +127,6 @@ def auto(args: PmbArgs, dry=False) -> list[str]:
logging.warning(f"{pkgname}: origin '{origin}' aport not found")
continue
aport = pmb.parse.apkbuild(aport_path)
if auto_apkindex_package(args, arch, aport, apk, dry):
if auto_apkindex_package(arch, aport, apk, dry):
ret.append(pkgname)
return ret