new: full implementation of remove and install functions
This commit is contained in:
@ -6,9 +6,10 @@
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int ret = EXIT_FAILURE;
|
||||
lm_pkg_t *pkg = NULL;
|
||||
lm_ctx_t ctx;
|
||||
lm_ctx_resolve_list_t *list = NULL;
|
||||
lm_pkg_t *pkg = NULL, *cur = NULL;
|
||||
lm_ctx_t ctx;
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
if (argc != 4) {
|
||||
printf("usage: %s <package name> <pool name> <pool url>\n", argv[0]);
|
||||
@ -50,23 +51,33 @@ int main(int argc, char *argv[]) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
printf("downloading package: %s (%s)...\n", pkg->name, pkg->version);
|
||||
printf("resolving package: %s (%s)...\n", pkg->name, pkg->version);
|
||||
|
||||
if (!lm_ctx_download(&ctx, pkg, NULL, NULL)) {
|
||||
printf("failed to download package: %s (%d)\n", lm_strerror(), lm_error());
|
||||
if ((list = lm_ctx_resolve(&ctx, pkg)) == NULL) {
|
||||
printf("failed to resolve package: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
printf("installing package: %s (%s)...\n", pkg->name, pkg->version);
|
||||
while ((cur = lm_ctx_resolve_next(list)) != NULL) {
|
||||
printf("downloading package: %s (%s)...\n", cur->name, cur->version);
|
||||
if (!lm_ctx_download(&ctx, cur, NULL, NULL)) {
|
||||
printf("failed to download package: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (!lm_ctx_install(&ctx, pkg, NULL, NULL)) {
|
||||
printf("failed to install the package: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
while ((cur = lm_ctx_resolve_next(list)) != NULL) {
|
||||
printf("installing package: %s (%s)...\n", cur->name, cur->version);
|
||||
if (!lm_ctx_install(&ctx, cur, NULL, NULL)) {
|
||||
printf("failed to install the package: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
ret = EXIT_SUCCESS;
|
||||
|
||||
end:
|
||||
lm_ctx_resolve_free(list);
|
||||
lm_ctx_free(&ctx);
|
||||
return ret;
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
[base]
|
||||
size = 314121
|
||||
[test]
|
||||
size = 3936
|
||||
maintainer = ngn
|
||||
pubkey = F9E70878C2FB389AEC2BA34CA3654DF5AD9F641D
|
BIN
examples/pools/test/LIST
Normal file
BIN
examples/pools/test/LIST
Normal file
Binary file not shown.
BIN
examples/pools/test/bar_1.mpf
Normal file
BIN
examples/pools/test/bar_1.mpf
Normal file
Binary file not shown.
BIN
examples/pools/test/bar_1.mpf.sig
Normal file
BIN
examples/pools/test/bar_1.mpf.sig
Normal file
Binary file not shown.
BIN
examples/pools/test/dummy_1.mpf
Normal file
BIN
examples/pools/test/dummy_1.mpf
Normal file
Binary file not shown.
BIN
examples/pools/test/dummy_1.mpf.sig
Normal file
BIN
examples/pools/test/dummy_1.mpf.sig
Normal file
Binary file not shown.
BIN
examples/pools/test/foo_1.mpf
Normal file
BIN
examples/pools/test/foo_1.mpf
Normal file
Binary file not shown.
BIN
examples/pools/test/foo_1.mpf.sig
Normal file
BIN
examples/pools/test/foo_1.mpf.sig
Normal file
Binary file not shown.
BIN
examples/pools/test/test_1.mpf
Normal file
BIN
examples/pools/test/test_1.mpf
Normal file
Binary file not shown.
BIN
examples/pools/test/test_1.mpf.sig
Normal file
BIN
examples/pools/test/test_1.mpf.sig
Normal file
Binary file not shown.
@ -21,7 +21,7 @@ int main(int argc, char *argv[]) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (lm_ctx_pool_add(&ctx, "base", "mptp://127.0.0.1:5858") == NULL) {
|
||||
if (lm_ctx_pool_add(&ctx, "test", "mptp://127.0.0.1:5858") == NULL) {
|
||||
printf("failed to add pool: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
Reference in New Issue
Block a user