- indented properly sync_cleancache()

- reworked sync_list()
- added a log
This commit is contained in:
Aurelien Foret 2005-05-09 09:14:10 +00:00
parent df5c0392fa
commit 2b0c91cff8
1 changed files with 98 additions and 91 deletions

View File

@ -152,6 +152,7 @@ static int sync_cleancache(int level)
return(1);
}
}
MSG(CL, "done.\n");
return(0);
}
@ -193,7 +194,7 @@ static int sync_synctree(list_t *syncs)
ERR(NL, "failed to synchronize %s\n", sync->treename);
success--;
} else if(ret < 0) {
MSG(NL, ":: %s is up to date\n", sync->treename);
MSG(NL, " %s is up to date\n", sync->treename);
} else {
snprintf(path, PATH_MAX, "%s%s/%s" PM_EXT_DB, root, dbpath, sync->treename);
if(alpm_db_update(sync->db, path, newmtime) == -1) {
@ -313,36 +314,38 @@ static int sync_info(list_t *syncs, list_t *targets)
static int sync_list(list_t *syncs, list_t *targets)
{
list_t *i, *treenames = NULL;
list_t *i;
list_t *ls = NULL;
if(targets) {
for(i = targets; i; i = i->next) {
list_t *j;
sync_t *sync = NULL;
for(j = syncs; j; j = j->next) {
for(j = syncs; j && !sync; j = j->next) {
sync_t *s = j->data;
if(strcmp(i->data, s->treename) == 0) {
MALLOC(sync, sizeof(sync_t));
sync->treename = i->data;
sync->db = s->db;
sync = s;
}
}
if(sync == NULL) {
ERR(NL, "repository \"%s\" was not found.\n", (char *)i->data);
list_free(treenames);
for(j = ls; j; j = j->next) {
j->data = NULL;
}
list_free(ls);
return(1);
}
treenames = list_add(treenames, sync);
ls = list_add(ls, sync);
}
} else {
treenames = syncs;
ls = syncs;
}
for(i = treenames; i; i = i->next) {
for(i = ls; i; i = i->next) {
PM_LIST *lp;
sync_t *sync = i->data;
@ -354,7 +357,10 @@ static int sync_list(list_t *syncs, list_t *targets)
}
if(targets) {
list_free(treenames);
for(i = ls; i; i = i->next) {
i->data = NULL;
}
list_free(ls);
}
return(0);
@ -424,6 +430,7 @@ int pacman_sync(list_t *targets)
}
if(pmo_s_upgrade) {
MSG(NL, ":: Starting local database upgrade...\n");
alpm_logaction("starting full system upgrade");
if(alpm_trans_sysupgrade() == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno));