1
1
openwrt/package/system/apk/patches/0100-add-add-force-reinstall-option.patch
Hannu Nyman 598c4b7fde apk: add help text for 'apk add --force-reinstall'
Add a help text for the new --force-reinstall option, so that users
will actually find the new option.

(Also refresh patches)

Improves: 91cff1a "apk: add --force-reinstall option"

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Link: https://github.com/openwrt/openwrt/pull/22426
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-03-16 14:52:56 +01:00

62 lines
2.0 KiB
Diff

From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 8 Mar 2026 13:41:16 +0000
Subject: [PATCH] add: add --force-reinstall option
Allow reinstalling already-installed packages without a version change.
Only the named packages are reinstalled, not their dependencies.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/src/app_add.c
+++ b/src/app_add.c
@@ -24,6 +24,7 @@ struct add_ctx {
OPT(OPT_ADD_initdb, "initdb") \
OPT(OPT_ADD_latest, APK_OPT_SH("l") "latest") \
OPT(OPT_ADD_no_chown, "no-chown") \
+ OPT(OPT_ADD_reinstall, "force-reinstall") \
OPT(OPT_ADD_upgrade, APK_OPT_SH("u") "upgrade") \
OPT(OPT_ADD_usermode, "usermode") \
OPT(OPT_ADD_virtual, APK_OPT_ARG APK_OPT_SH("t") "virtual")
@@ -41,6 +42,9 @@ static int add_parse_option(void *ctx, s
case OPT_ADD_latest:
actx->solver_flags |= APK_SOLVERF_LATEST;
break;
+ case OPT_ADD_reinstall:
+ actx->solver_flags |= APK_SOLVERF_REINSTALL;
+ break;
case OPT_ADD_upgrade:
actx->solver_flags |= APK_SOLVERF_UPGRADE;
break;
@@ -177,7 +181,7 @@ static int add_main(void *ctx, struct ap
apk_deps_add(&world, &dep);
apk_solver_set_name_flags(dep.name,
actx->solver_flags,
- actx->solver_flags);
+ actx->solver_flags & ~APK_SOLVERF_REINSTALL);
}
}
if (actx->virtpkg) {
@@ -185,7 +189,7 @@ static int add_main(void *ctx, struct ap
apk_deps_add(&world, &virtdep);
apk_solver_set_name_flags(virtdep.name,
actx->solver_flags,
- actx->solver_flags);
+ actx->solver_flags & ~APK_SOLVERF_REINSTALL);
}
r = apk_solver_commit(db, 0, world);
--- a/doc/apk-add.8.scd
+++ b/doc/apk-add.8.scd
@@ -30,6 +30,10 @@ To later upgrade or downgrade back to a
*apk add* supports the commit options described in *apk*(8), as well as the
following options:
+*--force-reinstall*
+ Allow reinstalling already-installed packages without a version
+ change. Only the named packages are reinstalled, not dependencies.
+
*--initdb*
Initialize a new package database.