new: custom pool dirs and remove ctx path functions
This commit is contained in:
@ -2,23 +2,23 @@ CC = gcc
|
||||
|
||||
all: ../dist/client_install ../dist/client_remove ../dist/client_update ../dist/client_check ../dist/client_list ../dist/server
|
||||
|
||||
../dist/client_install: client/install.c client/*.h ../dist/libmp.so
|
||||
../dist/client_install: client/install.c ../dist/libmp.so
|
||||
mkdir -pv ../dist
|
||||
$(CC) -L../dist $< -lmp -o $@
|
||||
|
||||
../dist/client_remove: client/remove.c client/*.h ../dist/libmp.so
|
||||
../dist/client_remove: client/remove.c ../dist/libmp.so
|
||||
mkdir -pv ../dist
|
||||
$(CC) -L../dist $< -lmp -o $@
|
||||
|
||||
../dist/client_update: client/update.c client/*.h ../dist/libmp.so
|
||||
../dist/client_update: client/update.c ../dist/libmp.so
|
||||
mkdir -pv ../dist
|
||||
$(CC) -L../dist $< -lmp -o $@
|
||||
|
||||
../dist/client_check: client/check.c client/*.h ../dist/libmp.so
|
||||
../dist/client_check: client/check.c ../dist/libmp.so
|
||||
mkdir -pv ../dist
|
||||
$(CC) -L../dist $< -lmp -o $@
|
||||
|
||||
../dist/client_list: client/list.c client/*.h ../dist/libmp.so
|
||||
../dist/client_list: client/list.c ../dist/libmp.so
|
||||
mkdir -pv ../dist
|
||||
$(CC) -L../dist $< -lmp -o $@
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../../include/all.h"
|
||||
#include "./common.h"
|
||||
#include "../common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -10,27 +10,15 @@ int main(int argc, char *argv[]) {
|
||||
lm_entry_t entry;
|
||||
lm_ctx_t ctx;
|
||||
|
||||
lm_entry_init(&entry);
|
||||
|
||||
if (argc != 2) {
|
||||
printf("usage: %s <package name>\n", argv[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!mkdir_ifnot(ROOT_DIR)) {
|
||||
printf("failed to create root dir: %s\n", ROOT_DIR);
|
||||
return ret;
|
||||
}
|
||||
lm_entry_init(&entry);
|
||||
|
||||
lm_ctx_init(&ctx);
|
||||
|
||||
if (!lm_ctx_set_data(&ctx, DATA_DIR)) {
|
||||
printf("failed to set data dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_set_root(&ctx, ROOT_DIR)) {
|
||||
printf("failed to set root dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
if (!lm_ctx_init(&ctx, ROOT_DIR, NULL, DATA_DIR)) {
|
||||
printf("failed to init the ctx: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../../include/all.h"
|
||||
#include "./common.h"
|
||||
#include "../common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -11,34 +11,20 @@ int main(int argc, char *argv[]) {
|
||||
lm_ctx_t ctx;
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
char pooldir[strlen(TEMP_DIR) + 10];
|
||||
sprintf(pooldir, "%s/%s", TEMP_DIR, "pool");
|
||||
|
||||
if (argc != 4) {
|
||||
printf("usage: %s <package name> <pool name> <pool url>\n", argv[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!mkdir_ifnot(ROOT_DIR)) {
|
||||
printf("failed to create root dir: %s\n", ROOT_DIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lm_ctx_init(&ctx);
|
||||
|
||||
if (!lm_ctx_set_data(&ctx, DATA_DIR)) {
|
||||
printf("failed to set data dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
if (!lm_ctx_init(&ctx, ROOT_DIR, TEMP_DIR, DATA_DIR)) {
|
||||
printf("failed to init the ctx: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_set_temp(&ctx, TEMP_DIR)) {
|
||||
printf("failed to set temp dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_set_root(&ctx, ROOT_DIR)) {
|
||||
printf("failed to set root dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (lm_ctx_pool_add(&ctx, argv[2], argv[3]) == NULL) {
|
||||
if (lm_ctx_pool_add(&ctx, argv[2], argv[3], pooldir) == NULL) {
|
||||
printf("failed to add pool: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../../include/all.h"
|
||||
#include "./common.h"
|
||||
#include "../common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -11,9 +11,8 @@ int main(int argc, char *argv[]) {
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
lm_entry_init(&entry);
|
||||
lm_ctx_init(&ctx);
|
||||
|
||||
if (!lm_ctx_set_data(&ctx, DATA_DIR)) {
|
||||
if (!lm_ctx_init(&ctx, NULL, NULL, DATA_DIR)) {
|
||||
printf("failed to set data dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../../include/all.h"
|
||||
#include "./common.h"
|
||||
#include "../common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -17,25 +17,8 @@ int main(int argc, char *argv[]) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!mkdir_ifnot(ROOT_DIR)) {
|
||||
printf("failed to create root dir: %s\n", ROOT_DIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lm_ctx_init(&ctx);
|
||||
|
||||
if (!lm_ctx_set_data(&ctx, DATA_DIR)) {
|
||||
printf("failed to set data dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_set_temp(&ctx, TEMP_DIR)) {
|
||||
printf("failed to set temp dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_set_root(&ctx, ROOT_DIR)) {
|
||||
printf("failed to set root dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
if (!lm_ctx_init(&ctx, ROOT_DIR, TEMP_DIR, DATA_DIR)) {
|
||||
printf("failed to init the ctx: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../../include/all.h"
|
||||
#include "./common.h"
|
||||
#include "../common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -17,30 +17,8 @@ int main(int argc, char *argv[]) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!mkdir_ifnot(ROOT_DIR)) {
|
||||
printf("failed to create root dir: %s\n", ROOT_DIR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lm_ctx_init(&ctx);
|
||||
|
||||
if (!lm_ctx_set_data(&ctx, DATA_DIR)) {
|
||||
printf("failed to set data dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_set_temp(&ctx, TEMP_DIR)) {
|
||||
printf("failed to set temp dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_set_root(&ctx, ROOT_DIR)) {
|
||||
printf("failed to set root dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (lm_ctx_pool_add(&ctx, argv[1], argv[2]) == NULL) {
|
||||
printf("failed to add pool: %s (%d)\n", lm_strerror(), lm_error());
|
||||
if (!lm_ctx_init(&ctx, ROOT_DIR, TEMP_DIR, DATA_DIR)) {
|
||||
printf("failed to init the ctx: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
1
examples/pools/.gitignore
vendored
1
examples/pools/.gitignore
vendored
@ -1 +0,0 @@
|
||||
*/LIST_extracted
|
@ -1,10 +1,10 @@
|
||||
#include "../../include/all.h"
|
||||
#include "../common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
|
||||
#define DATA_DIR "./examples"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int ret = EXIT_FAILURE;
|
||||
lm_ctx_t ctx;
|
||||
@ -14,14 +14,12 @@ int main(int argc, char *argv[]) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
lm_ctx_init(&ctx);
|
||||
|
||||
if (!lm_ctx_set_data(&ctx, DATA_DIR)) {
|
||||
printf("failed to set data dir: %s (%d)\n", lm_strerror(), lm_error());
|
||||
if (!lm_ctx_init(&ctx, NULL, TEMP_DIR, NULL)) {
|
||||
printf("failed to init the ctx: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (lm_ctx_pool_add(&ctx, "test", "mptp://127.0.0.1:5858") == NULL) {
|
||||
if (lm_ctx_pool_add(&ctx, "test", "mptp://127.0.0.1:5858", "./examples/test") == NULL) {
|
||||
printf("failed to add pool: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
Reference in New Issue
Block a user