summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/apk_adb.c15
-rw-r--r--src/apk_version.h1
-rw-r--r--src/package.c4
3 files changed, 14 insertions, 6 deletions
diff --git a/src/apk_adb.c b/src/apk_adb.c
index ea27a4d..25508c1 100644
--- a/src/apk_adb.c
+++ b/src/apk_adb.c
@@ -4,8 +4,6 @@
#include "apk_print.h"
#include "apk_version.h"
-#define APK_VERSION_CONFLICT 16
-
/* Few helpers to map old database to new one */
int apk_dep_split(apk_blob_t *b, apk_blob_t *bdep)
@@ -259,10 +257,17 @@ static apk_blob_t dependency_tostring(struct adb_obj *obj, char *buf, size_t buf
name = adb_ro_blob(obj, ADBI_DEP_NAME);
ver = adb_ro_blob(obj, ADBI_DEP_VERSION);
+ mask = adb_ro_int(obj, ADBI_DEP_MATCH) ?: APK_VERSION_EQUAL;
+
if (APK_BLOB_IS_NULL(name)) return APK_BLOB_NULL;
- if (APK_BLOB_IS_NULL(ver)) return name;
+ if (APK_BLOB_IS_NULL(ver)) {
+ if (mask & APK_VERSION_CONFLICT)
+ return APK_BLOB_PTR_LEN(buf,
+ snprintf(buf, bufsz, "!"BLOB_FMT,
+ BLOB_PRINTF(name)));
+ return name;
+ }
- mask = adb_ro_int(obj, ADBI_DEP_MATCH) ?: APK_VERSION_EQUAL;
return APK_BLOB_PTR_LEN(buf,
snprintf(buf, bufsz, "%s"BLOB_FMT"%s"BLOB_FMT,
(mask & APK_VERSION_CONFLICT) ? "!" : "",
@@ -295,7 +300,7 @@ static int dependency_fromstring(struct adb_obj *obj, apk_blob_t bdep)
if (!apk_blob_spn(bop, apk_spn_dependency_comparer, &bop, &bver))
goto fail;
- mask = 0;
+ mask &= APK_VERSION_CONFLICT;
for (i = 0; i < bop.len; i++) {
switch (bop.ptr[i]) {
case '<':
diff --git a/src/apk_version.h b/src/apk_version.h
index 0996207..59a7e57 100644
--- a/src/apk_version.h
+++ b/src/apk_version.h
@@ -17,6 +17,7 @@
#define APK_VERSION_LESS 2
#define APK_VERSION_GREATER 4
#define APK_VERSION_FUZZY 8
+#define APK_VERSION_CONFLICT 16
#define APK_DEPMASK_ANY (APK_VERSION_EQUAL|APK_VERSION_LESS|\
APK_VERSION_GREATER|APK_VERSION_FUZZY)
diff --git a/src/package.c b/src/package.c
index 001f7d5..0b2c7d8 100644
--- a/src/package.c
+++ b/src/package.c
@@ -457,10 +457,12 @@ int apk_deps_write(struct apk_database *db, struct apk_dependency_array *deps, s
void apk_dep_from_adb(struct apk_dependency *dep, struct apk_database *db, struct adb_obj *d)
{
+ int mask = adb_ro_int(d, ADBI_DEP_MATCH);
*dep = (struct apk_dependency) {
.name = apk_db_get_name(db, adb_ro_blob(d, ADBI_DEP_NAME)),
.version = apk_atomize_dup(&db->atoms, adb_ro_blob(d, ADBI_DEP_VERSION)),
- .result_mask = adb_ro_int(d, ADBI_DEP_MATCH) ?: APK_VERSION_EQUAL,
+ .conflict = !!(mask & APK_VERSION_CONFLICT),
+ .result_mask = (mask & ~APK_VERSION_CONFLICT) ?: APK_VERSION_EQUAL,
};
}