- added PM_EXT_PKG and PM_EXT_DB defines to alpm.h (taken from pacman 2.9.3)

- renamed ALPM_VERSION to PM_VERSION
This commit is contained in:
Aurelien Foret 2005-03-16 20:59:14 +00:00
parent d8cdd54a20
commit 2ce1105900
5 changed files with 15 additions and 12 deletions

View File

@ -25,6 +25,9 @@
* Arch Linux Package Management library * Arch Linux Package Management library
*/ */
#define PM_EXT_PKG ".pkg.tar.gz"
#define PM_EXT_DB ".db.tar.gz"
/* /*
* Structures (opaque) * Structures (opaque)
*/ */
@ -44,7 +47,7 @@ typedef struct __pmdepmissing_t PM_DEPMISS; */
*/ */
/* Version */ /* Version */
#define ALPM_VERSION "0.1.0" #define PM_VERSION "0.1.0"
int alpm_initialize(char *root); int alpm_initialize(char *root);
int alpm_release(); int alpm_release();

View File

@ -270,11 +270,11 @@ int downloadfiles(list_t *servers, const char *localpath, list_t *files)
snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn); snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn);
strncpy(sync_fnm, fn, 24); strncpy(sync_fnm, fn, 24);
/* drop filename extension */ /* drop filename extension */
ptr = strstr(fn, ".db.tar.gz"); ptr = strstr(fn, PM_EXT_DB);
if(ptr && (ptr-fn) < 24) { if(ptr && (ptr-fn) < 24) {
sync_fnm[ptr-fn] = '\0'; sync_fnm[ptr-fn] = '\0';
} }
ptr = strstr(fn, ".pkg.tar.gz"); ptr = strstr(fn, PM_EXT_PKG);
if(ptr && (ptr-fn) < 24) { if(ptr && (ptr-fn) < 24) {
sync_fnm[ptr-fn] = '\0'; sync_fnm[ptr-fn] = '\0';
} }

View File

@ -178,7 +178,7 @@ int split_pkgname(char *target, char *name, char *version)
} }
strncpy(tmp, p, 512); strncpy(tmp, p, 512);
/* trim file extension (if any) */ /* trim file extension (if any) */
if((p = strstr(tmp, ".pkg.tar.gz"))) { if((p = strstr(tmp, PM_EXT_PKG))) {
*p = 0; *p = 0;
} }

View File

@ -609,7 +609,7 @@ void usage(int op, char *myname)
void version() void version()
{ {
printf("\n"); printf("\n");
printf(" .--. Pacman v%s\n", ALPM_VERSION); printf(" .--. Pacman v%s\n", PM_VERSION);
printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2003 Judd Vinet <jvinet@zeroflux.org>\n"); printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2003 Judd Vinet <jvinet@zeroflux.org>\n");
printf("\\ '-. '-' '-' '-' \n"); printf("\\ '-. '-' '-' '-' \n");
printf(" '--' This program may be freely redistributed under\n"); printf(" '--' This program may be freely redistributed under\n");

View File

@ -87,12 +87,12 @@ static int sync_cleancache(int level)
char *str = i->data; char *str = i->data;
char name[256], version[64]; char name[256], version[64];
if(strstr(str, ".pkg.tar.gz") == NULL) { if(strstr(str, PM_EXT_PKG) == NULL) {
clean = list_add(clean, strdup(str)); clean = list_add(clean, strdup(str));
continue; continue;
} }
/* we keep partially downloaded files */ /* we keep partially downloaded files */
if(strstr(str, ".pkg.tar.gz.part")) { if(strstr(str, PM_EXT_PKG".part")) {
continue; continue;
} }
if(split_pkgname(str, name, version) != 0) { if(split_pkgname(str, name, version) != 0) {
@ -103,10 +103,10 @@ static int sync_cleancache(int level)
char *s = j->data; char *s = j->data;
char n[256], v[64]; char n[256], v[64];
if(strstr(s, ".pkg.tar.gz") == NULL) { if(strstr(s, PM_EXT_PKG) == NULL) {
continue; continue;
} }
if(strstr(s, ".pkg.tar.gz.part")) { if(strstr(s, PM_EXT_PKG".part")) {
continue; continue;
} }
if(split_pkgname(s, n, v) != 0) { if(split_pkgname(s, n, v) != 0) {
@ -166,7 +166,7 @@ static int sync_synctree(list_t *syncs)
sync_t *sync = (sync_t *)i->data; sync_t *sync = (sync_t *)i->data;
/* build a one-element list */ /* build a one-element list */
snprintf(path, PATH_MAX, "%s.db.tar.gz", sync->treename); snprintf(path, PATH_MAX, "%s"PM_EXT_DB, sync->treename);
files = list_add(files, strdup(path)); files = list_add(files, strdup(path));
success = 1; success = 1;
@ -176,7 +176,7 @@ static int sync_synctree(list_t *syncs)
} }
FREELIST(files); FREELIST(files);
snprintf(path, PATH_MAX, "%s/%s.db.tar.gz", pmo_dbpath, sync->treename); snprintf(path, PATH_MAX, "%s/%s"PM_EXT_DB, pmo_dbpath, sync->treename);
if(success) { if(success) {
char ldir[PATH_MAX]; char ldir[PATH_MAX];
@ -759,7 +759,7 @@ int pacman_sync(list_t *targets)
char /*str[PATH_MAX],*/ pkgname[PATH_MAX]; char /*str[PATH_MAX],*/ pkgname[PATH_MAX];
char *md5sum1, *md5sum2; char *md5sum1, *md5sum2;
snprintf(pkgname, PATH_MAX, "%s-%s.pkg.tar.gz", "", ""); snprintf(pkgname, PATH_MAX, "%s-%s"PM_EXT_PKG, "", "");
md5sum1 = NULL; md5sum1 = NULL;
md5sum2 = NULL; md5sum2 = NULL;