mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
- indented properly sync_cleancache()
- reworked sync_list() - added a log
This commit is contained in:
parent
df5c0392fa
commit
2b0c91cff8
@ -152,6 +152,7 @@ static int sync_cleancache(int level)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MSG(CL, "done.\n");
|
MSG(CL, "done.\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -193,7 +194,7 @@ static int sync_synctree(list_t *syncs)
|
|||||||
ERR(NL, "failed to synchronize %s\n", sync->treename);
|
ERR(NL, "failed to synchronize %s\n", sync->treename);
|
||||||
success--;
|
success--;
|
||||||
} else if(ret < 0) {
|
} 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 {
|
} else {
|
||||||
snprintf(path, PATH_MAX, "%s%s/%s" PM_EXT_DB, root, dbpath, sync->treename);
|
snprintf(path, PATH_MAX, "%s%s/%s" PM_EXT_DB, root, dbpath, sync->treename);
|
||||||
if(alpm_db_update(sync->db, path, newmtime) == -1) {
|
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)
|
static int sync_list(list_t *syncs, list_t *targets)
|
||||||
{
|
{
|
||||||
list_t *i, *treenames = NULL;
|
list_t *i;
|
||||||
|
list_t *ls = NULL;
|
||||||
|
|
||||||
if(targets) {
|
if(targets) {
|
||||||
for(i = targets; i; i = i->next) {
|
for(i = targets; i; i = i->next) {
|
||||||
list_t *j;
|
list_t *j;
|
||||||
sync_t *sync = NULL;
|
sync_t *sync = NULL;
|
||||||
|
|
||||||
for(j = syncs; j; j = j->next) {
|
for(j = syncs; j && !sync; j = j->next) {
|
||||||
sync_t *s = j->data;
|
sync_t *s = j->data;
|
||||||
|
|
||||||
if(strcmp(i->data, s->treename) == 0) {
|
if(strcmp(i->data, s->treename) == 0) {
|
||||||
MALLOC(sync, sizeof(sync_t));
|
sync = s;
|
||||||
sync->treename = i->data;
|
|
||||||
sync->db = s->db;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sync == NULL) {
|
if(sync == NULL) {
|
||||||
ERR(NL, "repository \"%s\" was not found.\n", (char *)i->data);
|
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);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
treenames = list_add(treenames, sync);
|
ls = list_add(ls, sync);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
treenames = syncs;
|
ls = syncs;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = treenames; i; i = i->next) {
|
for(i = ls; i; i = i->next) {
|
||||||
PM_LIST *lp;
|
PM_LIST *lp;
|
||||||
sync_t *sync = i->data;
|
sync_t *sync = i->data;
|
||||||
|
|
||||||
@ -354,7 +357,10 @@ static int sync_list(list_t *syncs, list_t *targets)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(targets) {
|
if(targets) {
|
||||||
list_free(treenames);
|
for(i = ls; i; i = i->next) {
|
||||||
|
i->data = NULL;
|
||||||
|
}
|
||||||
|
list_free(ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
@ -424,6 +430,7 @@ int pacman_sync(list_t *targets)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(pmo_s_upgrade) {
|
if(pmo_s_upgrade) {
|
||||||
|
MSG(NL, ":: Starting local database upgrade...\n");
|
||||||
alpm_logaction("starting full system upgrade");
|
alpm_logaction("starting full system upgrade");
|
||||||
if(alpm_trans_sysupgrade() == -1) {
|
if(alpm_trans_sysupgrade() == -1) {
|
||||||
ERR(NL, "%s\n", alpm_strerror(pm_errno));
|
ERR(NL, "%s\n", alpm_strerror(pm_errno));
|
||||||
|
Loading…
Reference in New Issue
Block a user