Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-10-13 21:18:03 +1000
committerAllan McRae <allan@archlinux.org>2010-10-14 13:17:40 +1000
commit24d77291da93fcd5d09df2b1d1d05474616f18a5 (patch)
tree044a03766199c24cb141f5d368e8d3b2fffc4ecf
parent5b17d8f27d9a490a461eb2946f7c209d42c5762e (diff)
Only write to local repos
We do not write to sync repos so kill the code for that. Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/be_local.c91
1 files changed, 38 insertions, 53 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 3b886096..cd6fac40 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -737,7 +737,6 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
mode_t oldmask;
alpm_list_t *lp = NULL;
int retval = 0;
- int local = 0;
char *pkgpath = NULL;
ALPM_LOG_FUNC;
@@ -751,8 +750,8 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
/* make sure we have a sane umask */
oldmask = umask(0022);
- if(strcmp(db->treename, "local") == 0) {
- local = 1;
+ if(strcmp(db->treename, "local") != 0) {
+ return(-1);
}
/* DESC */
@@ -788,63 +787,49 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
if(info->force) {
fprintf(fp, "%%FORCE%%\n\n");
}
- if(local) {
- if(info->url) {
- fprintf(fp, "%%URL%%\n"
- "%s\n\n", info->url);
- }
- if(info->licenses) {
- fputs("%LICENSE%\n", fp);
- for(lp = info->licenses; lp; lp = lp->next) {
- fprintf(fp, "%s\n", (char *)lp->data);
- }
- fprintf(fp, "\n");
- }
- if(info->arch) {
- fprintf(fp, "%%ARCH%%\n"
- "%s\n\n", info->arch);
- }
- if(info->builddate) {
- fprintf(fp, "%%BUILDDATE%%\n"
- "%ld\n\n", info->builddate);
- }
- if(info->installdate) {
- fprintf(fp, "%%INSTALLDATE%%\n"
- "%ld\n\n", info->installdate);
- }
- if(info->packager) {
- fprintf(fp, "%%PACKAGER%%\n"
- "%s\n\n", info->packager);
- }
- if(info->isize) {
- /* only write installed size, csize is irrelevant once installed */
- fprintf(fp, "%%SIZE%%\n"
- "%jd\n\n", (intmax_t)info->isize);
- }
- if(info->reason) {
- fprintf(fp, "%%REASON%%\n"
- "%u\n\n", info->reason);
- }
- } else {
- if(info->size) {
- fprintf(fp, "%%CSIZE%%\n"
- "%jd\n\n", (intmax_t)info->size);
- }
- if(info->isize) {
- fprintf(fp, "%%ISIZE%%\n"
- "%jd\n\n", (intmax_t)info->isize);
- }
- if(info->md5sum) {
- fprintf(fp, "%%MD5SUM%%\n"
- "%s\n\n", info->md5sum);
+ if(info->url) {
+ fprintf(fp, "%%URL%%\n"
+ "%s\n\n", info->url);
+ }
+ if(info->licenses) {
+ fputs("%LICENSE%\n", fp);
+ for(lp = info->licenses; lp; lp = lp->next) {
+ fprintf(fp, "%s\n", (char *)lp->data);
}
+ fprintf(fp, "\n");
+ }
+ if(info->arch) {
+ fprintf(fp, "%%ARCH%%\n"
+ "%s\n\n", info->arch);
+ }
+ if(info->builddate) {
+ fprintf(fp, "%%BUILDDATE%%\n"
+ "%ld\n\n", info->builddate);
+ }
+ if(info->installdate) {
+ fprintf(fp, "%%INSTALLDATE%%\n"
+ "%ld\n\n", info->installdate);
}
+ if(info->packager) {
+ fprintf(fp, "%%PACKAGER%%\n"
+ "%s\n\n", info->packager);
+ }
+ if(info->isize) {
+ /* only write installed size, csize is irrelevant once installed */
+ fprintf(fp, "%%SIZE%%\n"
+ "%jd\n\n", (intmax_t)info->isize);
+ }
+ if(info->reason) {
+ fprintf(fp, "%%REASON%%\n"
+ "%u\n\n", info->reason);
+ }
+
fclose(fp);
fp = NULL;
}
/* FILES */
- if(local && (inforeq & INFRQ_FILES)) {
+ if(inforeq & INFRQ_FILES) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sfiles", pkgpath);