Download sync db into DBPath/sync
The sync db should be stored in the sync/ folder. This cleans up DBPath to only have local/ and sync/ directories in it. A nice side effect is that the db are now in the right place so we can implement directly reading from them. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
68dcabdfbe
commit
a835599496
1 changed files with 8 additions and 4 deletions
|
@ -208,7 +208,7 @@ static int remove_olddir(const char *syncdbpath, alpm_list_t *dirlist)
|
||||||
*/
|
*/
|
||||||
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
||||||
{
|
{
|
||||||
char *dbfile, *dbfilepath;
|
char *dbfile, *dbfilepath, *syncpath;
|
||||||
const char *dbpath, *syncdbpath;
|
const char *dbpath, *syncdbpath;
|
||||||
alpm_list_t *newdirlist = NULL, *olddirlist = NULL;
|
alpm_list_t *newdirlist = NULL, *olddirlist = NULL;
|
||||||
alpm_list_t *onlynew = NULL, *onlyold = NULL;
|
alpm_list_t *onlynew = NULL, *onlyold = NULL;
|
||||||
|
@ -236,9 +236,13 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
||||||
sprintf(dbfile, "%s.db", db->treename);
|
sprintf(dbfile, "%s.db", db->treename);
|
||||||
|
|
||||||
dbpath = alpm_option_get_dbpath();
|
dbpath = alpm_option_get_dbpath();
|
||||||
|
len = strlen(dbpath) + 6;
|
||||||
|
MALLOC(syncpath, len, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
sprintf(syncpath, "%s%s", dbpath, "sync/");
|
||||||
|
|
||||||
ret = _alpm_download_single_file(dbfile, db->servers, dbpath, force);
|
ret = _alpm_download_single_file(dbfile, db->servers, syncpath, force);
|
||||||
free(dbfile);
|
free(dbfile);
|
||||||
|
free(syncpath);
|
||||||
|
|
||||||
if(ret == 1) {
|
if(ret == 1) {
|
||||||
/* files match, do nothing */
|
/* files match, do nothing */
|
||||||
|
@ -253,9 +257,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
||||||
syncdbpath = _alpm_db_path(db);
|
syncdbpath = _alpm_db_path(db);
|
||||||
|
|
||||||
/* form the path to the db location */
|
/* form the path to the db location */
|
||||||
len = strlen(dbpath) + strlen(db->treename) + 4;
|
len = strlen(dbpath) + strlen(db->treename) + 9;
|
||||||
MALLOC(dbfilepath, len, RET_ERR(PM_ERR_MEMORY, -1));
|
MALLOC(dbfilepath, len, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
sprintf(dbfilepath, "%s%s.db", dbpath, db->treename);
|
sprintf(dbfilepath, "%ssync/%s.db", dbpath, db->treename);
|
||||||
|
|
||||||
if(force) {
|
if(force) {
|
||||||
/* if forcing update, remove the old dir and extract the db */
|
/* if forcing update, remove the old dir and extract the db */
|
||||||
|
|
Loading…
Add table
Reference in a new issue