summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/alpm.h5
-rw-r--r--src/pacman/download.c4
-rw-r--r--src/pacman/package.c2
-rw-r--r--src/pacman/pacman.c2
-rw-r--r--src/pacman/sync.c14
5 files changed, 15 insertions, 12 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index a2337576..8eb1ece0 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -25,6 +25,9 @@
* Arch Linux Package Management library
*/
+#define PM_EXT_PKG ".pkg.tar.gz"
+#define PM_EXT_DB ".db.tar.gz"
+
/*
* Structures (opaque)
*/
@@ -44,7 +47,7 @@ typedef struct __pmdepmissing_t PM_DEPMISS; */
*/
/* Version */
-#define ALPM_VERSION "0.1.0"
+#define PM_VERSION "0.1.0"
int alpm_initialize(char *root);
int alpm_release();
diff --git a/src/pacman/download.c b/src/pacman/download.c
index e5ed2c6a..4d55888c 100644
--- a/src/pacman/download.c
+++ b/src/pacman/download.c
@@ -270,11 +270,11 @@ int downloadfiles(list_t *servers, const char *localpath, list_t *files)
snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn);
strncpy(sync_fnm, fn, 24);
/* drop filename extension */
- ptr = strstr(fn, ".db.tar.gz");
+ ptr = strstr(fn, PM_EXT_DB);
if(ptr && (ptr-fn) < 24) {
sync_fnm[ptr-fn] = '\0';
}
- ptr = strstr(fn, ".pkg.tar.gz");
+ ptr = strstr(fn, PM_EXT_PKG);
if(ptr && (ptr-fn) < 24) {
sync_fnm[ptr-fn] = '\0';
}
diff --git a/src/pacman/package.c b/src/pacman/package.c
index aa47d77f..36db89aa 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -178,7 +178,7 @@ int split_pkgname(char *target, char *name, char *version)
}
strncpy(tmp, p, 512);
/* trim file extension (if any) */
- if((p = strstr(tmp, ".pkg.tar.gz"))) {
+ if((p = strstr(tmp, PM_EXT_PKG))) {
*p = 0;
}
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index ad5a0436..83989ac3 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -609,7 +609,7 @@ void usage(int op, char *myname)
void version()
{
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("\\ '-. '-' '-' '-' \n");
printf(" '--' This program may be freely redistributed under\n");
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index da89a2b9..e4fe867c 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -87,12 +87,12 @@ static int sync_cleancache(int level)
char *str = i->data;
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));
continue;
}
/* we keep partially downloaded files */
- if(strstr(str, ".pkg.tar.gz.part")) {
+ if(strstr(str, PM_EXT_PKG".part")) {
continue;
}
if(split_pkgname(str, name, version) != 0) {
@@ -103,10 +103,10 @@ static int sync_cleancache(int level)
char *s = j->data;
char n[256], v[64];
- if(strstr(s, ".pkg.tar.gz") == NULL) {
+ if(strstr(s, PM_EXT_PKG) == NULL) {
continue;
}
- if(strstr(s, ".pkg.tar.gz.part")) {
+ if(strstr(s, PM_EXT_PKG".part")) {
continue;
}
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;
/* 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));
success = 1;
@@ -176,7 +176,7 @@ static int sync_synctree(list_t *syncs)
}
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) {
char ldir[PATH_MAX];
@@ -759,7 +759,7 @@ int pacman_sync(list_t *targets)
char /*str[PATH_MAX],*/ pkgname[PATH_MAX];
char *md5sum1, *md5sum2;
- snprintf(pkgname, PATH_MAX, "%s-%s.pkg.tar.gz", "", "");
+ snprintf(pkgname, PATH_MAX, "%s-%s"PM_EXT_PKG, "", "");
md5sum1 = NULL;
md5sum2 = NULL;