diff options
author | q66 <q66@chimera-linux.org> | 2023-03-24 13:58:58 +0100 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-04-04 12:15:56 +0300 |
commit | 931dd6259e57da21bef59a38176cf31714ac41c0 (patch) | |
tree | 9c5b463873961be1eaa54bb58895f71627ed0c18 | |
parent | c97eab9bc0885283e23e76272d499593768e1c18 (diff) | |
download | apk-tools-931dd6259e57da21bef59a38176cf31714ac41c0.tar.gz apk-tools-931dd6259e57da21bef59a38176cf31714ac41c0.tar.bz2 apk-tools-931dd6259e57da21bef59a38176cf31714ac41c0.tar.xz apk-tools-931dd6259e57da21bef59a38176cf31714ac41c0.zip |
adb: restore provider_priority support
Fixes https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10826
Fixes https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10884
[TT: Remove ADBI_PKG_PASSWD for now.]
-rw-r--r-- | src/apk_adb.c | 6 | ||||
-rw-r--r-- | src/apk_adb.h | 4 | ||||
-rw-r--r-- | src/app_mkndx.c | 4 | ||||
-rw-r--r-- | src/app_mkpkg.c | 6 | ||||
-rw-r--r-- | src/database.c | 2 | ||||
-rw-r--r-- | src/package.c | 1 |
6 files changed, 11 insertions, 12 deletions
diff --git a/src/apk_adb.c b/src/apk_adb.c index febe359..0b3f36c 100644 --- a/src/apk_adb.c +++ b/src/apk_adb.c @@ -65,12 +65,12 @@ unsigned int adb_pkg_field_index(char f) MAP('D', ADBI_PI_DEPENDS), MAP('i', ADBI_PI_INSTALL_IF), MAP('p', ADBI_PI_PROVIDES), + MAP('k', ADBI_PI_PROVIDER_PRIORITY), MAP('o', ADBI_PI_ORIGIN), MAP('m', ADBI_PI_MAINTAINER), MAP('t', ADBI_PI_BUILD_TIME), MAP('c', ADBI_PI_REPO_COMMIT), MAP('r', ADBI_PI_REPLACES), - MAP('k', ADBI_PI_PRIORITY), }; if (f < 'A' || f-'A' >= ARRAY_SIZE(map)) return 0; return map[(unsigned char)f - 'A']; @@ -396,7 +396,7 @@ const struct adb_object_schema schema_pkginfo = { ADB_FIELD(ADBI_PI_BUILD_TIME, "build-time", scalar_int), ADB_FIELD(ADBI_PI_INSTALLED_SIZE,"installed-size",scalar_hsize), ADB_FIELD(ADBI_PI_FILE_SIZE, "file-size", scalar_hsize), - ADB_FIELD(ADBI_PI_PRIORITY, "priority", scalar_int), + ADB_FIELD(ADBI_PI_PROVIDER_PRIORITY, "provider-priority", scalar_int), ADB_FIELD(ADBI_PI_DEPENDS, "depends", schema_dependency_array), ADB_FIELD(ADBI_PI_PROVIDES, "provides", schema_dependency_array), ADB_FIELD(ADBI_PI_REPLACES, "replaces", schema_dependency_array), @@ -495,7 +495,7 @@ const struct adb_object_schema schema_package = { ADB_FIELD(ADBI_PKG_PATHS, "paths", schema_dir_array), ADB_FIELD(ADBI_PKG_SCRIPTS, "scripts", schema_scripts), ADB_FIELD(ADBI_PKG_TRIGGERS, "triggers", schema_string_array), - //ADB_FIELD(ADBI_PKG_PASSWD, "passwd", schema_string_array), + ADB_FIELD(ADBI_PKG_REPLACES_PRIORITY, "replaces-priority", scalar_int), }, }; diff --git a/src/apk_adb.h b/src/apk_adb.h index 5b8283c..765f19b 100644 --- a/src/apk_adb.h +++ b/src/apk_adb.h @@ -25,7 +25,7 @@ #define ADBI_PI_BUILD_TIME 0x0b #define ADBI_PI_INSTALLED_SIZE 0x0c #define ADBI_PI_FILE_SIZE 0x0d -#define ADBI_PI_PRIORITY 0x0e +#define ADBI_PI_PROVIDER_PRIORITY 0x0e #define ADBI_PI_DEPENDS 0x0f #define ADBI_PI_PROVIDES 0x10 #define ADBI_PI_REPLACES 0x11 @@ -71,7 +71,7 @@ #define ADBI_PKG_PATHS 0x02 #define ADBI_PKG_SCRIPTS 0x03 #define ADBI_PKG_TRIGGERS 0x04 -#define ADBI_PKG_PASSWD 0x05 +#define ADBI_PKG_REPLACES_PRIORITY 0x05 #define ADBI_PKG_MAX 0x06 struct adb_data_package { diff --git a/src/app_mkndx.c b/src/app_mkndx.c index 0b002f7..3313804 100644 --- a/src/app_mkndx.c +++ b/src/app_mkndx.c @@ -101,10 +101,10 @@ static int mkndx_parse_v2meta(struct apk_extract_ctx *ectx, struct apk_istream * FIELD("pkgdesc", ADBI_PI_DESCRIPTION), FIELD("pkgname", ADBI_PI_NAME), FIELD("pkgver", ADBI_PI_VERSION), - FIELD("provider_priority", 0), + FIELD("provider_priority", ADBI_PI_PROVIDER_PRIORITY), FIELD("provides", ADBI_PI_PROVIDES), FIELD("replaces", ADBI_PI_REPLACES), - FIELD("replaces_priority", ADBI_PI_PRIORITY), + FIELD("replaces_priority", 0), FIELD("size", ADBI_PI_INSTALLED_SIZE), FIELD("triggers", 0), FIELD("url", ADBI_PI_URL), diff --git a/src/app_mkpkg.c b/src/app_mkpkg.c index 85aa266..f1a121d 100644 --- a/src/app_mkpkg.c +++ b/src/app_mkpkg.c @@ -71,11 +71,9 @@ static int parse_info(struct mkpkg_ctx *ictx, struct apk_out *out, const char *o i = adb_s_field_by_name_blob(&schema_package, l); switch (i) { -#if 0 - case ADBI_PKG_xxx: + case ADBI_PKG_REPLACES_PRIORITY: ictx->package[i] = r; - break; -#endif + return 0; default: break; } diff --git a/src/database.c b/src/database.c index 86a396c..178aa0e 100644 --- a/src/database.c +++ b/src/database.c @@ -2570,7 +2570,7 @@ static int apk_db_install_v3meta(struct apk_extract_ctx *ectx, struct adb_obj *p // Extract the information not available in index adb_ro_obj(pkg, ADBI_PKG_PKGINFO, &pkginfo); apk_deps_from_adb(&ipkg->replaces, db, adb_ro_obj(&pkginfo, ADBI_PI_REPLACES, &obj)); - ipkg->replaces_priority = adb_ro_int(&pkginfo, ADBI_PI_PRIORITY); + ipkg->replaces_priority = adb_ro_int(pkg, ADBI_PKG_REPLACES_PRIORITY); ipkg->v3 = 1; adb_ro_obj(pkg, ADBI_PKG_SCRIPTS, &scripts); diff --git a/src/package.c b/src/package.c index ca60ccb..e1a8683 100644 --- a/src/package.c +++ b/src/package.c @@ -611,6 +611,7 @@ void apk_pkg_from_adb(struct apk_database *db, struct apk_package *pkg, struct a pkg->license = apk_atomize_dup(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_LICENSE)); pkg->arch = apk_atomize_dup(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_ARCH)); pkg->installed_size = adb_ro_int(pkginfo, ADBI_PI_INSTALLED_SIZE); + pkg->provider_priority = adb_ro_int(pkginfo, ADBI_PI_PROVIDER_PRIORITY); pkg->origin = apk_atomize_dup(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_ORIGIN)); pkg->maintainer = apk_atomize_dup(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_MAINTAINER)); pkg->build_time = adb_ro_int(pkginfo, ADBI_PI_BUILD_TIME); |