forked from Mirror/pmbootstrap
commands: move index command to pmb/commands (MR 2252)
Use the new command runner for pmbootstrap index. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
d4070c0e9e
commit
852ace63c4
5 changed files with 21 additions and 9 deletions
|
@ -217,4 +217,4 @@ def package_kernel(args: PmbArgs):
|
|||
except Exception as e:
|
||||
pmb.helpers.mount.umount_all(Chroot.native() / "mnt/linux")
|
||||
raise e
|
||||
pmb.build.other.index_repo(args, arch)
|
||||
pmb.build.other.index_repo(arch)
|
||||
|
|
|
@ -93,7 +93,7 @@ def is_necessary(arch, apkbuild, indexes=None):
|
|||
return False
|
||||
|
||||
|
||||
def index_repo(args: PmbArgs, arch=None):
|
||||
def index_repo(arch=None):
|
||||
"""Recreate the APKINDEX.tar.gz for a specific repo, and clear the parsing
|
||||
cache for that file for the current pmbootstrap session (to prevent
|
||||
rebuilding packages twice, in case the rebuild takes less than a second).
|
||||
|
|
|
@ -5,12 +5,12 @@ from __future__ import annotations
|
|||
import enum
|
||||
from typing import Generator, Optional
|
||||
from pathlib import Path, PosixPath, PurePosixPath
|
||||
import pmb.config
|
||||
from pmb.types import PmbArgs
|
||||
from pmb.helpers import frontend
|
||||
|
||||
from .base import Command
|
||||
from .log import Log
|
||||
from .index import Index
|
||||
|
||||
"""New way to model pmbootstrap subcommands that can be invoked without PmbArgs."""
|
||||
|
||||
|
@ -18,7 +18,6 @@ from .log import Log
|
|||
unmigrated_commands = [
|
||||
"init",
|
||||
"shutdown",
|
||||
"index",
|
||||
"work_migrate",
|
||||
"repo_bootstrap",
|
||||
"repo_missing",
|
||||
|
@ -59,9 +58,12 @@ def run_command(args: PmbArgs):
|
|||
return
|
||||
|
||||
command: Command
|
||||
# FIXME: would be nice to use match case...
|
||||
# Would be nice to use match case but we support Python 3.8
|
||||
if args.action == "log":
|
||||
command = Log(args.clear_log, int(args.lines))
|
||||
elif args.action == "index":
|
||||
# FIXME: should index support --arch?
|
||||
command = Index()
|
||||
else:
|
||||
raise NotImplementedError(f"Command '{args.action}' is not implemented.")
|
||||
|
||||
|
|
14
pmb/commands/index.py
Normal file
14
pmb/commands/index.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Copyright 2024 Caleb Connolly
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
from pmb import commands
|
||||
import pmb.build.other
|
||||
|
||||
class Index(commands.Command):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
pmb.build.other.index_repo()
|
||||
|
|
@ -251,10 +251,6 @@ def repo_missing(args: PmbArgs):
|
|||
print(json.dumps(missing, indent=4))
|
||||
|
||||
|
||||
def index(args: PmbArgs):
|
||||
pmb.build.index_repo(args)
|
||||
|
||||
|
||||
def initfs(args: PmbArgs):
|
||||
pmb.chroot.initfs.frontend(args)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue