summaryrefslogtreecommitdiff
path: root/src/add.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-06-16 09:59:21 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-06-16 09:59:21 +0000
commit20a1217e866f9fe15c4de3ed28144084509e4ffa (patch)
tree2bc0c87439ef575dfd565fc081a51d501f4737ce /src/add.c
parentd8b1b851c713937bdb1a756f9419e3f97516d479 (diff)
downloadapk-tools-20a1217e866f9fe15c4de3ed28144084509e4ffa.tar.gz
apk-tools-20a1217e866f9fe15c4de3ed28144084509e4ffa.tar.bz2
apk-tools-20a1217e866f9fe15c4de3ed28144084509e4ffa.tar.xz
apk-tools-20a1217e866f9fe15c4de3ed28144084509e4ffa.zip
add: support for forced versions
Support version numbers specified with packages. For example: apk add 'busybox<1.14' apk add 'squid=>3.0'
Diffstat (limited to 'src/add.c')
-rw-r--r--src/add.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/add.c b/src/add.c
index d5dfb23..43e6340 100644
--- a/src/add.c
+++ b/src/add.c
@@ -122,11 +122,7 @@ static int add_main(void *ctx, int argc, char **argv)
md5_str(virtpkg->name->name, virtpkg->csum);
virtpkg->version = strdup("0");
virtpkg->description = strdup("virtual meta package");
- virtdep = (struct apk_dependency) {
- .name = virtpkg->name,
- .version = virtpkg->version,
- .result_mask = APK_VERSION_EQUAL,
- };
+ virtdep = apk_dep_from_pkg(&db, virtpkg);
virtdep.name->flags |= APK_NAME_TOPLEVEL | APK_NAME_VIRTUAL;
virtpkg = apk_db_pkg_add(&db, virtpkg);
}
@@ -143,17 +139,10 @@ static int add_main(void *ctx, int argc, char **argv)
goto err;
}
- dep = (struct apk_dependency) {
- .name = apk_db_get_name(&db, APK_BLOB_STR(pkg->name->name)),
- .version = pkg->version,
- .result_mask = APK_VERSION_EQUAL,
- };
- } else {
- dep = (struct apk_dependency) {
- .name = apk_db_get_name(&db, APK_BLOB_STR(argv[i])),
- .result_mask = APK_DEPMASK_REQUIRE,
- };
- }
+ dep = apk_dep_from_pkg(&db, pkg);
+ } else
+ dep = apk_dep_from_str(&db, argv[i]);
+
if (virtpkg) {
apk_deps_add(&virtpkg->depends, &dep);
} else {