forked from Mirror/pmbootstrap
aportgen: Allow retaining current branch when forking Alpine (MR 2271)
Often I find myself confused and subsequently frustrated by the behaviour of --fork-alpine as usually I apply whatever changes I want to the aports package before forking. This is due to that in the proper aports repo I can leverage the full power of git and apply patches or revert commits, whereas after the package has been forked to pmaports the context git needs to do this is lost. To fix that, this commit introduces --fork-alpine-retain-branch which works the same way as --fork-alpine except it doesn't change the aports branch to match the current channel.
This commit is contained in:
parent
96da7f161a
commit
d63ea90f2b
2 changed files with 31 additions and 15 deletions
|
@ -165,6 +165,10 @@ def get_upstream_aport(args, pkgname, arch=None):
|
||||||
pmb.helpers.git.clone(args, "aports_upstream")
|
pmb.helpers.git.clone(args, "aports_upstream")
|
||||||
aports_upstream_path = args.work + "/cache_git/aports_upstream"
|
aports_upstream_path = args.work + "/cache_git/aports_upstream"
|
||||||
|
|
||||||
|
if hasattr(args, "fork_alpine_retain_branch") and args.fork_alpine_retain_branch:
|
||||||
|
logging.info("Not changing aports branch as --fork-alpine-retain-branch was "
|
||||||
|
"used.")
|
||||||
|
else:
|
||||||
# Checkout branch
|
# Checkout branch
|
||||||
channel_cfg = pmb.config.pmaports.read_config_channel(args)
|
channel_cfg = pmb.config.pmaports.read_config_channel(args)
|
||||||
branch = channel_cfg["branch_aports"]
|
branch = channel_cfg["branch_aports"]
|
||||||
|
|
|
@ -832,9 +832,15 @@ def arguments():
|
||||||
aportgen = sub.add_parser("aportgen", help="generate a postmarketOS"
|
aportgen = sub.add_parser("aportgen", help="generate a postmarketOS"
|
||||||
" specific package build recipe"
|
" specific package build recipe"
|
||||||
" (aport/APKBUILD)")
|
" (aport/APKBUILD)")
|
||||||
aportgen.add_argument("--fork-alpine", help="fork the alpine upstream"
|
aportgen_fork_alpine = aportgen.add_mutually_exclusive_group()
|
||||||
|
aportgen_fork_alpine.add_argument("--fork-alpine", help="fork the alpine upstream"
|
||||||
" package", action="store_true",
|
" package", action="store_true",
|
||||||
dest="fork_alpine")
|
dest="fork_alpine")
|
||||||
|
aportgen_fork_alpine.add_argument("--fork-alpine-retain-branch",
|
||||||
|
help="fork the alpine upstream, but don't change "
|
||||||
|
"branch to match the current channel",
|
||||||
|
action="store_true",
|
||||||
|
dest="fork_alpine_retain_branch")
|
||||||
add_packages_arg(aportgen, nargs="+")
|
add_packages_arg(aportgen, nargs="+")
|
||||||
|
|
||||||
# Action: build
|
# Action: build
|
||||||
|
@ -930,6 +936,12 @@ def arguments():
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
setattr(args, "from_argparse", copy.deepcopy(args))
|
setattr(args, "from_argparse", copy.deepcopy(args))
|
||||||
setattr(args.from_argparse, "from_argparse", args.from_argparse)
|
setattr(args.from_argparse, "from_argparse", args.from_argparse)
|
||||||
|
|
||||||
|
if hasattr(args, "fork_alpine_retain_branch") and args.fork_alpine_retain_branch:
|
||||||
|
# fork_alpine_retain_branch largely matches the behaviour of fork_alpine, so
|
||||||
|
# just set fork_alpine here to reduce repetition.
|
||||||
|
args.fork_alpine = args.fork_alpine_retain_branch
|
||||||
|
|
||||||
pmb.helpers.args.init(args)
|
pmb.helpers.args.init(args)
|
||||||
|
|
||||||
if getattr(args, "go_mod_cache", None) is None:
|
if getattr(args, "go_mod_cache", None) is None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue