more work to backport pacman_sync from pacman 2.9.5
This commit is contained in:
parent
80bae750cd
commit
686e8eaeb5
3 changed files with 169 additions and 45 deletions
|
@ -22,7 +22,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <libtar.h>
|
||||||
|
#include <zlib.h>
|
||||||
/* pacman */
|
/* pacman */
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -54,9 +57,41 @@ pmsync_t *sync_new(int type, pmpkg_t *lpkg, pmpkg_t *spkg)
|
||||||
return(sync);
|
return(sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sync_parsedb(char *archive)
|
/* It returns a PMList of packages extracted from the given archive
|
||||||
|
* (the archive must have been generated by gensync)
|
||||||
|
*/
|
||||||
|
PMList *sync_load_archive(char *archive)
|
||||||
{
|
{
|
||||||
return(0);
|
PMList *lp = NULL;
|
||||||
|
DIR *dir = NULL;
|
||||||
|
TAR *tar = NULL;
|
||||||
|
tartype_t gztype = {
|
||||||
|
(openfunc_t)_alpm_gzopen_frontend,
|
||||||
|
(closefunc_t)gzclose,
|
||||||
|
(readfunc_t)gzread,
|
||||||
|
(writefunc_t)gzwrite
|
||||||
|
};
|
||||||
|
|
||||||
|
if(tar_open(&tar, archive, &gztype, O_RDONLY, 0, TAR_GNU) == -1) {
|
||||||
|
pm_errno = PM_ERR_NOT_A_FILE;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* readdir tmp_dir */
|
||||||
|
/* for each subdir, parse %s/desc and %s/depends */
|
||||||
|
|
||||||
|
tar_close(tar);
|
||||||
|
|
||||||
|
return(lp);
|
||||||
|
|
||||||
|
error:
|
||||||
|
if(tar) {
|
||||||
|
tar_close(tar);
|
||||||
|
}
|
||||||
|
if(dir) {
|
||||||
|
closedir(dir);
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sync_sysupgrade(PMList **data)
|
int sync_sysupgrade(PMList **data)
|
||||||
|
@ -85,12 +120,12 @@ int sync_sysupgrade(PMList **data)
|
||||||
lpkg->name, lpkg->version, spkg->name, spkg->version);
|
lpkg->name, lpkg->version, spkg->name, spkg->version);
|
||||||
} else {
|
} else {
|
||||||
pmsync_t *sync = sync_new(PM_SYSUPG_REPLACE, lpkg, spkg);
|
pmsync_t *sync = sync_new(PM_SYSUPG_REPLACE, lpkg, spkg);
|
||||||
|
|
||||||
if(sync == NULL) {
|
if(sync == NULL) {
|
||||||
pm_errno = PM_ERR_MEMORY;
|
pm_errno = PM_ERR_MEMORY;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (to be replaced by %s-%s)",
|
||||||
|
lpkg->name, lpkg->version, spkg->name, spkg->version);
|
||||||
targets = pm_list_add(targets, sync);
|
targets = pm_list_add(targets, sync);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +145,6 @@ int sync_sysupgrade(PMList **data)
|
||||||
|
|
||||||
for(k = db_get_pkgcache(j->data); !spkg && k; k = k->next) {
|
for(k = db_get_pkgcache(j->data); !spkg && k; k = k->next) {
|
||||||
pmpkg_t *sp = k->data;
|
pmpkg_t *sp = k->data;
|
||||||
|
|
||||||
if(!strcmp(local->name, sp->name)) {
|
if(!strcmp(local->name, sp->name)) {
|
||||||
spkg = sp;
|
spkg = sp;
|
||||||
}
|
}
|
||||||
|
@ -139,6 +173,8 @@ int sync_sysupgrade(PMList **data)
|
||||||
pm_errno = PM_ERR_MEMORY;
|
pm_errno = PM_ERR_MEMORY;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (upgrade: %s => %s)",
|
||||||
|
local->name, local->version, local->version, spkg->version);
|
||||||
targets = pm_list_add(targets, sync);
|
targets = pm_list_add(targets, sync);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,24 +210,23 @@ int sync_addtarget(pmdb_t *db, PMList *dbs_sync, pmtrans_t *trans, char *name)
|
||||||
for(j = dbs_sync; j && !sync; j = j->next) {
|
for(j = dbs_sync; j && !sync; j = j->next) {
|
||||||
pmdb_t *dbs = j->data;
|
pmdb_t *dbs = j->data;
|
||||||
if(strcmp(dbs->treename, targline) == 0) {
|
if(strcmp(dbs->treename, targline) == 0) {
|
||||||
sync = alpm_db_readpkg(dbs, targ);
|
sync = db_scan(dbs, targ, INFRQ_DESC|INFRQ_DEPENDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
targ = targline;
|
targ = targline;
|
||||||
for(j = dbs_sync; j && !sync; j = j->next) {
|
for(j = dbs_sync; j && !sync; j = j->next) {
|
||||||
pmdb_t *dbs = j->data;
|
pmdb_t *dbs = j->data;
|
||||||
sync = alpm_db_readpkg(dbs, targ);
|
sync = db_scan(dbs, targ, INFRQ_DESC|INFRQ_DEPENDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sync == NULL) {
|
if(sync == NULL) {
|
||||||
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
|
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if not a sysupgrade, compare versions and determine if it is necessary */
|
/* if not a sysupgrade, compare versions and determine if it is necessary */
|
||||||
if(!trans->flags & PM_TRANS_FLAG_SYSUPG) {
|
if(!trans->flags & PM_TRANS_FLAG_SYSUPG) {
|
||||||
local = alpm_db_readpkg(db, name);
|
local = db_get_pkgfromcache(db, name);
|
||||||
if(local) {
|
if(local) {
|
||||||
cmp = alpm_pkg_vercmp(local->version, sync->version);
|
cmp = alpm_pkg_vercmp(local->version, sync->version);
|
||||||
if(cmp > 0) {
|
if(cmp > 0) {
|
||||||
|
@ -200,6 +235,7 @@ int sync_addtarget(pmdb_t *db, PMList *dbs_sync, pmtrans_t *trans, char *name)
|
||||||
if(!yesno(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] ", lpkgname, lpkgver)) {
|
if(!yesno(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] ", lpkgname, lpkgver)) {
|
||||||
}*/
|
}*/
|
||||||
_alpm_log(PM_LOG_WARNING, "%s-%s: local version is newer -- skipping");
|
_alpm_log(PM_LOG_WARNING, "%s-%s: local version is newer -- skipping");
|
||||||
|
FREE(sync);
|
||||||
return(0);
|
return(0);
|
||||||
} else if(cmp == 0) {
|
} else if(cmp == 0) {
|
||||||
/* versions are identical */
|
/* versions are identical */
|
||||||
|
@ -207,6 +243,7 @@ int sync_addtarget(pmdb_t *db, PMList *dbs_sync, pmtrans_t *trans, char *name)
|
||||||
if(!yesno(":: %s-%s: is up to date. Upgrade anyway? [Y/n] ", lpkgname, lpkgver)) {
|
if(!yesno(":: %s-%s: is up to date. Upgrade anyway? [Y/n] ", lpkgname, lpkgver)) {
|
||||||
}*/
|
}*/
|
||||||
_alpm_log(PM_LOG_WARNING, "%s-%s: is up to date -- skipping");
|
_alpm_log(PM_LOG_WARNING, "%s-%s: is up to date -- skipping");
|
||||||
|
FREE(sync);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,17 +257,54 @@ int sync_addtarget(pmdb_t *db, PMList *dbs_sync, pmtrans_t *trans, char *name)
|
||||||
|
|
||||||
int sync_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
|
int sync_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
|
||||||
{
|
{
|
||||||
PMList *i;
|
|
||||||
PMList *trail = NULL;
|
|
||||||
PMList *list = NULL;
|
PMList *list = NULL;
|
||||||
|
PMList *trail = NULL;
|
||||||
|
PMList *i;
|
||||||
|
|
||||||
|
if(trans->packages == NULL) {
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Resolve targets dependencies */
|
/* Resolve targets dependencies */
|
||||||
for(i = trans->packages; i; i = i->next) {
|
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
|
||||||
pmpkg_t *sync = i->data;
|
TRANS_CB(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
|
||||||
if(resolvedeps(handle->db_local, handle->dbs_sync, sync, list, trail) == -1) {
|
|
||||||
/* pm_errno is set by resolvedeps */
|
list = pm_list_new();
|
||||||
goto error;
|
trail = pm_list_new();
|
||||||
|
|
||||||
|
for(i = trans->packages; i; i = i->next) {
|
||||||
|
pmpkg_t *sync = i->data;
|
||||||
|
_alpm_log(PM_LOG_FLOW1, "resolving dependencies for package %s", sync->name);
|
||||||
|
if(resolvedeps(handle->db_local, handle->dbs_sync, sync, list, trail) == -1) {
|
||||||
|
/* pm_errno is set by resolvedeps */
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
/* ORE
|
||||||
|
if called from makepkg, reason should be set to REASON_DEPEND */
|
||||||
|
sync->reason = PM_PKG_REASON_EXPLICIT;
|
||||||
}
|
}
|
||||||
|
FREELISTPTR(trail);
|
||||||
|
|
||||||
|
for(i = list; i; i = i->next) {
|
||||||
|
pmpkg_t *sync = i->data;
|
||||||
|
if(sync == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(!pkg_isin(sync, trans->packages)) {
|
||||||
|
pmpkg_t *pkg = db_scan(sync->data, sync->name, INFRQ_DESC|INFRQ_DEPENDS);
|
||||||
|
if(pkg == NULL) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, "could not find package \"%s\" in repository %s",
|
||||||
|
sync->name, ((pmdb_t *)sync->data)->treename);
|
||||||
|
pm_errno = PM_ERR_PKG_NOT_FOUND;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
pkg->reason = PM_PKG_REASON_DEPEND;
|
||||||
|
trans->packages = pm_list_add(trans->packages, pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FREELISTPTR(list);
|
||||||
|
|
||||||
|
TRANS_CB(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ORE
|
/* ORE
|
||||||
|
@ -250,6 +324,8 @@ int sync_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
FREELISTPTR(list);
|
||||||
|
FREELISTPTR(trail);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,22 @@
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
|
typedef struct __syncpkg_t { /* ORE: not used for now */
|
||||||
|
pmpkg_t *pkg;
|
||||||
|
pmdb_t *db;
|
||||||
|
} pmsyncpkg_t;
|
||||||
|
|
||||||
typedef struct __pmsync_t {
|
typedef struct __pmsync_t {
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
pmpkg_t *lpkg;
|
pmpkg_t *lpkg;
|
||||||
pmpkg_t *spkg;
|
pmpkg_t *spkg;
|
||||||
|
pmdb_t *dbs; /* ORE: not used for now */
|
||||||
} pmsync_t;
|
} pmsync_t;
|
||||||
|
|
||||||
pmsync_t *sync_new(int type, pmpkg_t *lpkg, pmpkg_t *spkg);
|
pmsync_t *sync_new(int type, pmpkg_t *lpkg, pmpkg_t *spkg);
|
||||||
|
|
||||||
|
PMList *sync_load_archive(char *archive);
|
||||||
|
|
||||||
/*int sync_findpkg(char *name, PMList *dbs, pmsyncpkg_t **sync);
|
/*int sync_findpkg(char *name, PMList *dbs, pmsyncpkg_t **sync);
|
||||||
pmsyncpkg_t *find_pkginsync(char *needle, PMList *haystack);
|
pmsyncpkg_t *find_pkginsync(char *needle, PMList *haystack);
|
||||||
PMList *rm_pkginsync(char *needle, PMList *haystack);*/
|
PMList *rm_pkginsync(char *needle, PMList *haystack);*/
|
||||||
|
|
|
@ -170,11 +170,12 @@ static int sync_synctree(list_t *syncs)
|
||||||
list_t *files = NULL;
|
list_t *files = NULL;
|
||||||
char *mtime = NULL;
|
char *mtime = NULL;
|
||||||
char newmtime[16] = "";
|
char newmtime[16] = "";
|
||||||
char lastupdate[16] = "";
|
char *lastupdate;
|
||||||
sync_t *sync = (sync_t *)i->data;
|
sync_t *sync = (sync_t *)i->data;
|
||||||
|
|
||||||
/* get the lastupdate time */
|
/* get the lastupdate time */
|
||||||
if(alpm_db_getlastupdate(sync->db, lastupdate) == -1) {
|
lastupdate = alpm_db_getinfo(sync->db, PM_DB_LASTUPDATE);
|
||||||
|
if(lastupdate == NULL) {
|
||||||
vprint("failed to get lastupdate time for %s (no big deal)\n", sync->treename);
|
vprint("failed to get lastupdate time for %s (no big deal)\n", sync->treename);
|
||||||
}
|
}
|
||||||
mtime = lastupdate;
|
mtime = lastupdate;
|
||||||
|
@ -364,16 +365,16 @@ int pacman_sync(list_t *targets)
|
||||||
int confirm = 0;
|
int confirm = 0;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
list_t *final = NULL;
|
list_t *final = NULL;
|
||||||
list_t *i, *j;
|
list_t *i;
|
||||||
PM_LIST *lp, *data;
|
PM_LIST *data;
|
||||||
char *root;
|
char *root;
|
||||||
char ldir[PATH_MAX];
|
char ldir[PATH_MAX];
|
||||||
int varcache = 1;
|
int varcache = 1;
|
||||||
int done = 0;
|
int done;
|
||||||
int count = 0;
|
int count;
|
||||||
sync_t *current = NULL;
|
sync_t *current;
|
||||||
list_t *processed = NULL;
|
list_t *processed;
|
||||||
list_t *files = NULL;
|
list_t *files;
|
||||||
|
|
||||||
if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
|
if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
|
||||||
ERR(NL, "error: no usable package repositories configured.");
|
ERR(NL, "error: no usable package repositories configured.");
|
||||||
|
@ -426,6 +427,8 @@ int pacman_sync(list_t *targets)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pmo_s_upgrade) {
|
if(pmo_s_upgrade) {
|
||||||
|
PM_LIST *lp;
|
||||||
|
|
||||||
alpm_logaction("starting full system upgrade");
|
alpm_logaction("starting full system upgrade");
|
||||||
|
|
||||||
if(alpm_sync_sysupgrade(&data) == -1) {
|
if(alpm_sync_sysupgrade(&data) == -1) {
|
||||||
|
@ -488,16 +491,16 @@ int pacman_sync(list_t *targets)
|
||||||
data = NULL;
|
data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_display("targets:", targets);
|
||||||
|
|
||||||
/* and add targets to it
|
/* and add targets to it
|
||||||
*/
|
*/
|
||||||
for(i = targets; i; i = i->next) {
|
for(i = targets; i; i = i->next) {
|
||||||
char *targ = i->data;
|
char *targ = i->data;
|
||||||
|
|
||||||
printf("TARGET=%s\n", targ);
|
|
||||||
|
|
||||||
if(alpm_trans_addtarget(targ) == -1) {
|
if(alpm_trans_addtarget(targ) == -1) {
|
||||||
if(pm_errno == PM_ERR_PKG_NOT_FOUND) {
|
if(pm_errno == PM_ERR_PKG_NOT_FOUND) {
|
||||||
PM_GRP *grp;
|
PM_GRP *grp;
|
||||||
|
list_t *j;
|
||||||
/* target not found: check if it's a group */
|
/* target not found: check if it's a group */
|
||||||
for(j = pmc_syncs; j && !grp; j = j->next) {
|
for(j = pmc_syncs; j && !grp; j = j->next) {
|
||||||
sync_t *sync = j->data;
|
sync_t *sync = j->data;
|
||||||
|
@ -544,6 +547,7 @@ int pacman_sync(list_t *targets)
|
||||||
|
|
||||||
/* list targets */
|
/* list targets */
|
||||||
if(!pmo_s_printuris) {
|
if(!pmo_s_printuris) {
|
||||||
|
PM_LIST *lp;
|
||||||
list_t *list = NULL;
|
list_t *list = NULL;
|
||||||
char *str;
|
char *str;
|
||||||
unsigned long totalsize = 0;
|
unsigned long totalsize = 0;
|
||||||
|
@ -567,22 +571,28 @@ int pacman_sync(list_t *targets)
|
||||||
FREELIST(list);
|
FREELIST(list);
|
||||||
FREE(str);
|
FREE(str);
|
||||||
}*/
|
}*/
|
||||||
/* ORE
|
for(lp = alpm_list_first(alpm_trans_getinfo(PM_TRANS_PACKAGES)); lp; lp = alpm_list_next(lp)) {
|
||||||
for(i = final; i; i = i->next) {
|
char *pkgname, *pkgver;
|
||||||
MALLOC(str, strlen(s->pkg->name)+strlen(s->pkg->version)+2);
|
PM_PKG *pkg = alpm_list_getdata(lp);
|
||||||
sprintf(str, "%s-%s", s->pkg->name, s->pkg->version);
|
|
||||||
|
pkgname = alpm_pkg_getinfo(pkg, PM_PKG_NAME);
|
||||||
|
pkgver = alpm_pkg_getinfo(pkg, PM_PKG_VERSION);
|
||||||
|
|
||||||
|
MALLOC(str, strlen(pkgname)+strlen(pkgver)+2);
|
||||||
|
sprintf(str, "%s-%s", pkgname, pkgver);
|
||||||
list = list_add(list, str);
|
list = list_add(list, str);
|
||||||
totalsize += s->pkg->size;
|
|
||||||
}*/
|
totalsize += (int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE);
|
||||||
|
}
|
||||||
mb = (double)(totalsize / 1048576.0);
|
mb = (double)(totalsize / 1048576.0);
|
||||||
/* round up to 0.1 */
|
/* round up to 0.1 */
|
||||||
if(mb < 0.1) {
|
if(mb < 0.1) {
|
||||||
mb = 0.1;
|
mb = 0.1;
|
||||||
}
|
}
|
||||||
printf("\nTargets: ");
|
MSG(NL, "\nTargets: ");
|
||||||
str = buildstring(list);
|
str = buildstring(list);
|
||||||
indentprint(str, 9);
|
indentprint(str, 9);
|
||||||
printf("\n\nTotal Package Size: %.1f MB\n", mb);
|
MSG(NL, "\nTotal Package Size: %.1f MB\n", mb);
|
||||||
FREELIST(list);
|
FREELIST(list);
|
||||||
FREE(str);
|
FREE(str);
|
||||||
}
|
}
|
||||||
|
@ -593,7 +603,8 @@ int pacman_sync(list_t *targets)
|
||||||
MSG(NL, "\nBeginning download...\n");
|
MSG(NL, "\nBeginning download...\n");
|
||||||
confirm = 1;
|
confirm = 1;
|
||||||
} else {
|
} else {
|
||||||
confirm = yesno("\nProceed with download? [Y/n] ");
|
MSG(NL, "\n");
|
||||||
|
confirm = yesno("Proceed with download? [Y/n] ");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* don't get any confirmation if we're called from makepkg */
|
/* don't get any confirmation if we're called from makepkg */
|
||||||
|
@ -604,7 +615,8 @@ int pacman_sync(list_t *targets)
|
||||||
MSG(NL, "\nBeginning upgrade process...\n");
|
MSG(NL, "\nBeginning upgrade process...\n");
|
||||||
confirm = 1;
|
confirm = 1;
|
||||||
} else {
|
} else {
|
||||||
confirm = yesno("\nProceed with upgrade? [Y/n] ");
|
MSG(NL, "\n");
|
||||||
|
confirm = yesno("Proceed with upgrade? [Y/n] ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,27 +625,56 @@ int pacman_sync(list_t *targets)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ORE
|
/* group sync records by repository and download */
|
||||||
group sync records by repository and download */
|
|
||||||
|
|
||||||
alpm_get_option(PM_OPT_ROOT, (long *)&root);
|
alpm_get_option(PM_OPT_ROOT, (long *)&root);
|
||||||
snprintf(ldir, PATH_MAX, "%s"CACHEDIR, root);
|
snprintf(ldir, PATH_MAX, "%s"CACHEDIR, root);
|
||||||
|
done = 0;
|
||||||
|
count = 0;
|
||||||
|
processed = NULL;
|
||||||
|
current = NULL;
|
||||||
while(!done) {
|
while(!done) {
|
||||||
|
PM_LIST *lp;
|
||||||
|
printf("in while\n");
|
||||||
if(current) {
|
if(current) {
|
||||||
processed = list_add(processed, current);
|
processed = list_add(processed, current);
|
||||||
current = NULL;
|
current = NULL;
|
||||||
}
|
}
|
||||||
for(i = final; i; i = i->next) {
|
for(lp = alpm_list_first(alpm_trans_getinfo(PM_TRANS_PACKAGES)); lp; lp = alpm_list_next(lp)) {
|
||||||
|
PM_PKG *sync = alpm_list_getdata(lp);
|
||||||
if(current == NULL) {
|
if(current == NULL) {
|
||||||
|
PM_DB *dbs = alpm_pkg_getinfo(sync, PM_PKG_SYNCDB);
|
||||||
/* we're starting on a new repository */
|
/* we're starting on a new repository */
|
||||||
|
if(!list_is_ptrin(dbs, processed)) {
|
||||||
|
/* ORE
|
||||||
|
current = dbs;*/
|
||||||
|
current = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*if(current && !strcmp(current->treename, sync->dbs->sync->treename)) {
|
/*if(current && !strcmp(current->treename, sync->dbs->sync->treename)) {
|
||||||
|
struct stat buf;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
|
if(pmo_s_printuris) {
|
||||||
|
snprintf(path, PATH_MAX, "%s-%s%s", sync->pkg->name, sync->pkg->version, PKGEXT);
|
||||||
|
files = list_add(files, strdup(path));
|
||||||
|
} else {
|
||||||
|
snprintf(path, PATH_MAX, "%s/%s-%s%s",
|
||||||
|
ldir, sync->pkg->name, sync->pkg->version, PKGEXT);
|
||||||
|
if(stat(path, &buf)) {
|
||||||
|
// file is not in the cache dir, so add it to the list //
|
||||||
|
snprintf(path, PATH_MAX, "%s-%s%s", sync->pkg->name, sync->pkg->version, PKGEXT);
|
||||||
|
files = list_add(files, strdup(path));
|
||||||
|
} else {
|
||||||
|
vprint(" %s-%s%s is already in the cache\n", sync->pkg->name, sync->pkg->version, PKGEXT);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if(files) {
|
if(files) {
|
||||||
if(pmo_s_printuris) {
|
if(pmo_s_printuris) {
|
||||||
|
list_t *j;
|
||||||
server_t *server = (server_t*)current->servers->data;
|
server_t *server = (server_t*)current->servers->data;
|
||||||
for(j = files; j; j = j->next) {
|
for(j = files; j; j = j->next) {
|
||||||
if(!strcmp(server->protocol, "file")) {
|
if(!strcmp(server->protocol, "file")) {
|
||||||
|
@ -708,11 +749,10 @@ int pacman_sync(list_t *targets)
|
||||||
|
|
||||||
if(strcmp(md5sum1, md5sum2) != 0) {
|
if(strcmp(md5sum1, md5sum2) != 0) {
|
||||||
retval = 1;
|
retval = 1;
|
||||||
ERR(NL, "error: archive %s is corrupted\n", pkgname);
|
ERR(NL, "archive %s is corrupted\n", pkgname);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(md5sum2);
|
FREE(md5sum2);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(retval) {
|
if(retval) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
Loading…
Add table
Reference in a new issue