summaryrefslogtreecommitdiff
path: root/src/apk_adb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/apk_adb.c')
-rw-r--r--src/apk_adb.c15
1 files changed, 10 insertions, 5 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 '<':