forked from Mirror/pmbootstrap
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:
parent
3d60673f64
commit
8a64c9da8f
4 changed files with 41 additions and 26 deletions
|
@ -15,6 +15,7 @@ from .index import Index
|
|||
from .repo_bootstrap import RepoBootstrap
|
||||
from .shutdown import Shutdown
|
||||
from .test import Test
|
||||
from .pkgrel_bump import PkgrelBump
|
||||
from .pull import Pull
|
||||
from .kconfig_check import KConfigCheck
|
||||
from .kconfig_edit import KConfigEdit
|
||||
|
@ -32,7 +33,6 @@ unmigrated_commands = [
|
|||
"flasher",
|
||||
"initfs",
|
||||
"qemu",
|
||||
"pkgrel_bump",
|
||||
"aportupgrade",
|
||||
"newapkbuild",
|
||||
"lint",
|
||||
|
@ -74,6 +74,8 @@ def run_command(args: PmbArgs):
|
|||
command = Shutdown()
|
||||
elif args.action == "test":
|
||||
command = Test(args.action_test)
|
||||
elif args.action == "pkgrel_bump":
|
||||
command = PkgrelBump(args.packages, args.dry, args.auto)
|
||||
elif args.action == "pull":
|
||||
command = Pull()
|
||||
elif args.action == "kconfig" and args.action_kconfig == "check":
|
||||
|
|
33
pmb/commands/pkgrel_bump.py
Normal file
33
pmb/commands/pkgrel_bump.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Copyright 2024 Stefan Hansson
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import sys
|
||||
|
||||
from pmb import commands
|
||||
from pmb.helpers import logging
|
||||
import pmb.helpers.pkgrel_bump
|
||||
|
||||
|
||||
class PkgrelBump(commands.Command):
|
||||
def __init__(self, packages: list[str], dry_run: bool, auto: bool) -> None:
|
||||
self.packages = packages
|
||||
self.dry_run = dry_run
|
||||
self.auto = auto
|
||||
|
||||
def run(self) -> None:
|
||||
would_bump = True
|
||||
|
||||
if self.auto:
|
||||
would_bump = bool(pmb.helpers.pkgrel_bump.auto(self.dry_run))
|
||||
else:
|
||||
# Each package must exist
|
||||
for package in self.packages:
|
||||
pmb.helpers.pmaports.find(package)
|
||||
|
||||
# Increase pkgrel
|
||||
for package in self.packages:
|
||||
pmb.helpers.pkgrel_bump.package(package, dry=self.dry_run)
|
||||
|
||||
if self.dry_run and would_bump:
|
||||
logging.info("Pkgrels of package(s) would have been bumped!")
|
||||
sys.exit(1)
|
Loading…
Add table
Add a link
Reference in a new issue