2005-03-14 20:51:43 -05:00
|
|
|
/*
|
|
|
|
* conf.c
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2011-01-05 23:45:15 -05:00
|
|
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
2009-07-01 03:08:33 -04:00
|
|
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2005-03-14 20:51:43 -05:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-12-10 23:55:22 -05:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-03-14 20:51:43 -05:00
|
|
|
*/
|
|
|
|
|
2007-03-05 17:13:33 -05:00
|
|
|
#include "config.h"
|
|
|
|
|
2011-05-05 12:12:49 -04:00
|
|
|
#include <errno.h>
|
|
|
|
#include <glob.h>
|
|
|
|
#include <limits.h>
|
2005-03-14 20:51:43 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2007-08-21 21:28:05 -04:00
|
|
|
#include <string.h> /* strdup */
|
2011-05-05 12:12:49 -04:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/utsname.h> /* uname */
|
|
|
|
#include <unistd.h>
|
2005-03-14 20:51:43 -05:00
|
|
|
|
|
|
|
/* pacman */
|
2007-03-05 17:13:33 -05:00
|
|
|
#include "conf.h"
|
2008-05-10 23:30:27 -04:00
|
|
|
#include "util.h"
|
2011-05-05 12:12:49 -04:00
|
|
|
#include "pacman.h"
|
2011-06-03 17:13:04 -04:00
|
|
|
#include "callback.h"
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2007-11-04 13:05:22 -05:00
|
|
|
/* global config variable */
|
|
|
|
config_t *config = NULL;
|
|
|
|
|
2007-04-14 17:26:39 -04:00
|
|
|
config_t *config_new(void)
|
2005-10-28 08:20:40 -04:00
|
|
|
{
|
2007-09-10 20:13:38 -04:00
|
|
|
config_t *newconfig = calloc(1, sizeof(config_t));
|
|
|
|
if(!newconfig) {
|
2008-05-10 23:30:27 -04:00
|
|
|
pm_fprintf(stderr, PM_LOG_ERROR,
|
|
|
|
_("malloc failure: could not allocate %zd bytes\n"),
|
|
|
|
sizeof(config_t));
|
2011-03-20 20:45:57 -04:00
|
|
|
return NULL;
|
2007-04-25 17:24:23 -04:00
|
|
|
}
|
2007-08-21 21:28:05 -04:00
|
|
|
/* defaults which may get overridden later */
|
2007-09-10 20:13:38 -04:00
|
|
|
newconfig->op = PM_OP_MAIN;
|
|
|
|
newconfig->logmask = PM_LOG_ERROR | PM_LOG_WARNING;
|
|
|
|
newconfig->configfile = strdup(CONFFILE);
|
2011-06-03 17:13:04 -04:00
|
|
|
newconfig->sigverify = PM_PGP_VERIFY_UNKNOWN;
|
2005-10-28 08:20:40 -04:00
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return newconfig;
|
2005-10-28 08:20:40 -04:00
|
|
|
}
|
|
|
|
|
2007-09-10 20:13:38 -04:00
|
|
|
int config_free(config_t *oldconfig)
|
2005-10-28 08:20:40 -04:00
|
|
|
{
|
2007-09-10 20:13:38 -04:00
|
|
|
if(oldconfig == NULL) {
|
2011-03-20 20:45:57 -04:00
|
|
|
return -1;
|
2005-10-28 08:20:40 -04:00
|
|
|
}
|
|
|
|
|
2008-08-24 17:24:53 -04:00
|
|
|
FREELIST(oldconfig->holdpkg);
|
2008-01-28 13:49:27 -05:00
|
|
|
FREELIST(oldconfig->syncfirst);
|
2011-06-03 17:13:04 -04:00
|
|
|
FREELIST(oldconfig->ignorepkg);
|
|
|
|
FREELIST(oldconfig->ignoregrp);
|
|
|
|
FREELIST(oldconfig->noupgrade);
|
|
|
|
FREELIST(oldconfig->noextract);
|
2007-09-10 20:13:38 -04:00
|
|
|
free(oldconfig->configfile);
|
2007-12-02 13:20:55 -05:00
|
|
|
free(oldconfig->rootdir);
|
|
|
|
free(oldconfig->dbpath);
|
|
|
|
free(oldconfig->logfile);
|
2011-06-03 17:13:04 -04:00
|
|
|
free(oldconfig->gpgdir);
|
|
|
|
FREELIST(oldconfig->cachedirs);
|
2009-04-04 04:17:30 -04:00
|
|
|
free(oldconfig->xfercommand);
|
2009-07-19 05:15:11 -04:00
|
|
|
free(oldconfig->print_format);
|
2011-06-03 17:13:04 -04:00
|
|
|
free(oldconfig->arch);
|
2007-09-10 20:13:38 -04:00
|
|
|
free(oldconfig);
|
|
|
|
oldconfig = NULL;
|
2005-10-28 08:20:40 -04:00
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return 0;
|
2005-10-28 08:20:40 -04:00
|
|
|
}
|
|
|
|
|
2011-05-05 12:12:49 -04:00
|
|
|
/** Helper function for download_with_xfercommand() */
|
|
|
|
static char *get_filename(const char *url) {
|
|
|
|
char *filename = strrchr(url, '/');
|
|
|
|
if(filename != NULL) {
|
|
|
|
filename++;
|
|
|
|
}
|
|
|
|
return filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Helper function for download_with_xfercommand() */
|
|
|
|
static char *get_destfile(const char *path, const char *filename) {
|
|
|
|
char *destfile;
|
|
|
|
/* len = localpath len + filename len + null */
|
|
|
|
size_t len = strlen(path) + strlen(filename) + 1;
|
|
|
|
destfile = calloc(len, sizeof(char));
|
|
|
|
snprintf(destfile, len, "%s%s", path, filename);
|
|
|
|
|
|
|
|
return destfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Helper function for download_with_xfercommand() */
|
|
|
|
static char *get_tempfile(const char *path, const char *filename) {
|
|
|
|
char *tempfile;
|
|
|
|
/* len = localpath len + filename len + '.part' len + null */
|
|
|
|
size_t len = strlen(path) + strlen(filename) + 6;
|
|
|
|
tempfile = calloc(len, sizeof(char));
|
|
|
|
snprintf(tempfile, len, "%s%s.part", path, filename);
|
|
|
|
|
|
|
|
return tempfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** External fetch callback */
|
|
|
|
static int download_with_xfercommand(const char *url, const char *localpath,
|
|
|
|
int force) {
|
|
|
|
int ret = 0;
|
|
|
|
int retval;
|
|
|
|
int usepart = 0;
|
|
|
|
struct stat st;
|
|
|
|
char *parsedcmd,*tempcmd;
|
|
|
|
char cwd[PATH_MAX];
|
|
|
|
int restore_cwd = 0;
|
|
|
|
char *destfile, *tempfile, *filename;
|
|
|
|
|
|
|
|
if(!config->xfercommand) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
filename = get_filename(url);
|
|
|
|
if(!filename) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
destfile = get_destfile(localpath, filename);
|
|
|
|
tempfile = get_tempfile(localpath, filename);
|
|
|
|
|
|
|
|
if(force && stat(tempfile, &st) == 0) {
|
|
|
|
unlink(tempfile);
|
|
|
|
}
|
|
|
|
if(force && stat(destfile, &st) == 0) {
|
|
|
|
unlink(destfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
tempcmd = strdup(config->xfercommand);
|
|
|
|
/* replace all occurrences of %o with fn.part */
|
|
|
|
if(strstr(tempcmd, "%o")) {
|
|
|
|
usepart = 1;
|
|
|
|
parsedcmd = strreplace(tempcmd, "%o", tempfile);
|
|
|
|
free(tempcmd);
|
|
|
|
tempcmd = parsedcmd;
|
|
|
|
}
|
|
|
|
/* replace all occurrences of %u with the download URL */
|
|
|
|
parsedcmd = strreplace(tempcmd, "%u", url);
|
|
|
|
free(tempcmd);
|
|
|
|
|
|
|
|
/* save the cwd so we can restore it later */
|
|
|
|
if(getcwd(cwd, PATH_MAX) == NULL) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("could not get current working directory\n"));
|
|
|
|
} else {
|
|
|
|
restore_cwd = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* cwd to the download directory */
|
|
|
|
if(chdir(localpath)) {
|
|
|
|
pm_printf(PM_LOG_WARNING, _("could not chdir to download directory %s\n"), localpath);
|
|
|
|
ret = -1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
/* execute the parsed command via /bin/sh -c */
|
|
|
|
pm_printf(PM_LOG_DEBUG, "running command: %s\n", parsedcmd);
|
|
|
|
retval = system(parsedcmd);
|
|
|
|
|
|
|
|
if(retval == -1) {
|
|
|
|
pm_printf(PM_LOG_WARNING, _("running XferCommand: fork failed!\n"));
|
|
|
|
ret = -1;
|
|
|
|
} else if(retval != 0) {
|
|
|
|
/* download failed */
|
|
|
|
pm_printf(PM_LOG_DEBUG, "XferCommand command returned non-zero status "
|
|
|
|
"code (%d)\n", retval);
|
|
|
|
ret = -1;
|
|
|
|
} else {
|
|
|
|
/* download was successful */
|
|
|
|
if(usepart) {
|
|
|
|
rename(tempfile, destfile);
|
|
|
|
}
|
|
|
|
ret = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
/* restore the old cwd if we have it */
|
|
|
|
if(restore_cwd && chdir(cwd) != 0) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
|
|
|
|
cwd, strerror(errno));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ret == -1) {
|
|
|
|
/* hack to let an user the time to cancel a download */
|
|
|
|
sleep(2);
|
|
|
|
}
|
|
|
|
free(destfile);
|
|
|
|
free(tempfile);
|
|
|
|
free(parsedcmd);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int config_set_arch(const char *arch)
|
|
|
|
{
|
|
|
|
if(strcmp(arch, "auto") == 0) {
|
|
|
|
struct utsname un;
|
|
|
|
uname(&un);
|
2011-06-03 17:13:04 -04:00
|
|
|
config->arch = strdup(un.machine);
|
2011-05-05 12:12:49 -04:00
|
|
|
} else {
|
2011-06-03 17:13:04 -04:00
|
|
|
config->arch = strdup(arch);
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
2011-06-03 17:13:04 -04:00
|
|
|
pm_printf(PM_LOG_DEBUG, "config: arch: %s\n", config->arch);
|
|
|
|
return 0;
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
|
|
|
|
2011-05-05 16:01:35 -04:00
|
|
|
static pgp_verify_t option_verifysig(const char *value)
|
|
|
|
{
|
|
|
|
pgp_verify_t level;
|
|
|
|
if(strcmp(value, "Always") == 0) {
|
|
|
|
level = PM_PGP_VERIFY_ALWAYS;
|
|
|
|
} else if(strcmp(value, "Optional") == 0) {
|
|
|
|
level = PM_PGP_VERIFY_OPTIONAL;
|
|
|
|
} else if(strcmp(value, "Never") == 0) {
|
|
|
|
level = PM_PGP_VERIFY_NEVER;
|
|
|
|
} else {
|
|
|
|
level = PM_PGP_VERIFY_UNKNOWN;
|
|
|
|
}
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: VerifySig = %s (%d)\n", value, level);
|
|
|
|
return level;
|
|
|
|
}
|
2011-05-05 12:12:49 -04:00
|
|
|
|
2011-06-03 17:13:04 -04:00
|
|
|
static int process_cleanmethods(alpm_list_t *values) {
|
|
|
|
alpm_list_t *i;
|
|
|
|
for(i = values; i; i = alpm_list_next(i)) {
|
|
|
|
const char *value = i->data;
|
|
|
|
if(strcmp(value, "KeepInstalled") == 0) {
|
|
|
|
config->cleanmethod |= PM_CLEAN_KEEPINST;
|
|
|
|
} else if(strcmp(value, "KeepCurrent") == 0) {
|
|
|
|
config->cleanmethod |= PM_CLEAN_KEEPCUR;
|
|
|
|
} else {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("invalid value for 'CleanMethod' : '%s'\n"),
|
|
|
|
value);
|
|
|
|
return 1;
|
|
|
|
}
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Add repeating options such as NoExtract, NoUpgrade, etc to libalpm
|
|
|
|
* settings. Refactored out of the parseconfig code since all of them did
|
|
|
|
* the exact same thing and duplicated code.
|
|
|
|
* @param ptr a pointer to the start of the multiple options
|
|
|
|
* @param option the string (friendly) name of the option, used for messages
|
2011-06-03 17:13:04 -04:00
|
|
|
* @param list the list to add the option to
|
2011-05-05 12:12:49 -04:00
|
|
|
*/
|
|
|
|
static void setrepeatingoption(char *ptr, const char *option,
|
2011-06-03 17:13:04 -04:00
|
|
|
alpm_list_t **list)
|
2011-05-05 12:12:49 -04:00
|
|
|
{
|
|
|
|
char *q;
|
|
|
|
|
|
|
|
while((q = strchr(ptr, ' '))) {
|
|
|
|
*q = '\0';
|
2011-06-03 17:13:04 -04:00
|
|
|
*list = alpm_list_add(*list, strdup(ptr));
|
2011-05-05 12:12:49 -04:00
|
|
|
pm_printf(PM_LOG_DEBUG, "config: %s: %s\n", option, ptr);
|
|
|
|
ptr = q;
|
|
|
|
ptr++;
|
|
|
|
}
|
2011-06-03 17:13:04 -04:00
|
|
|
*list = alpm_list_add(*list, strdup(ptr));
|
2011-05-05 12:12:49 -04:00
|
|
|
pm_printf(PM_LOG_DEBUG, "config: %s: %s\n", option, ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int _parse_options(const char *key, char *value,
|
|
|
|
const char *file, int linenum)
|
|
|
|
{
|
|
|
|
if(value == NULL) {
|
|
|
|
/* options without settings */
|
|
|
|
if(strcmp(key, "UseSyslog") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
config->usesyslog = 1;
|
2011-05-05 12:12:49 -04:00
|
|
|
pm_printf(PM_LOG_DEBUG, "config: usesyslog\n");
|
|
|
|
} else if(strcmp(key, "ILoveCandy") == 0) {
|
|
|
|
config->chomp = 1;
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: chomp\n");
|
|
|
|
} else if(strcmp(key, "VerbosePkgLists") == 0) {
|
|
|
|
config->verbosepkglists = 1;
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: verbosepkglists\n");
|
|
|
|
} else if(strcmp(key, "UseDelta") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
config->usedelta = 1;
|
2011-05-05 12:12:49 -04:00
|
|
|
pm_printf(PM_LOG_DEBUG, "config: usedelta\n");
|
|
|
|
} else if(strcmp(key, "TotalDownload") == 0) {
|
|
|
|
config->totaldownload = 1;
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: totaldownload\n");
|
|
|
|
} else if(strcmp(key, "CheckSpace") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
config->checkspace = 1;
|
2011-05-05 12:12:49 -04:00
|
|
|
} else {
|
|
|
|
pm_printf(PM_LOG_WARNING,
|
|
|
|
_("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"),
|
|
|
|
file, linenum, key, "options");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* options with settings */
|
|
|
|
if(strcmp(key, "NoUpgrade") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
setrepeatingoption(value, "NoUpgrade", &(config->noupgrade));
|
2011-05-05 12:12:49 -04:00
|
|
|
} else if(strcmp(key, "NoExtract") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
setrepeatingoption(value, "NoExtract", &(config->noextract));
|
2011-05-05 12:12:49 -04:00
|
|
|
} else if(strcmp(key, "IgnorePkg") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
setrepeatingoption(value, "IgnorePkg", &(config->ignorepkg));
|
2011-05-05 12:12:49 -04:00
|
|
|
} else if(strcmp(key, "IgnoreGroup") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
setrepeatingoption(value, "IgnoreGroup", &(config->ignoregrp));
|
2011-05-05 12:12:49 -04:00
|
|
|
} else if(strcmp(key, "HoldPkg") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
setrepeatingoption(value, "HoldPkg", &(config->holdpkg));
|
2011-05-05 12:12:49 -04:00
|
|
|
} else if(strcmp(key, "SyncFirst") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
setrepeatingoption(value, "SyncFirst", &(config->syncfirst));
|
|
|
|
} else if(strcmp(key, "CacheDir") == 0) {
|
|
|
|
setrepeatingoption(value, "CacheDir", &(config->cachedirs));
|
2011-05-05 12:12:49 -04:00
|
|
|
} else if(strcmp(key, "Architecture") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
if(!config->arch) {
|
2011-05-05 12:12:49 -04:00
|
|
|
config_set_arch(value);
|
|
|
|
}
|
|
|
|
} else if(strcmp(key, "DBPath") == 0) {
|
|
|
|
/* don't overwrite a path specified on the command line */
|
|
|
|
if(!config->dbpath) {
|
|
|
|
config->dbpath = strdup(value);
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: dbpath: %s\n", value);
|
|
|
|
}
|
|
|
|
} else if(strcmp(key, "RootDir") == 0) {
|
|
|
|
/* don't overwrite a path specified on the command line */
|
|
|
|
if(!config->rootdir) {
|
|
|
|
config->rootdir = strdup(value);
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: rootdir: %s\n", value);
|
|
|
|
}
|
|
|
|
} else if(strcmp(key, "GPGDir") == 0) {
|
|
|
|
if(!config->gpgdir) {
|
|
|
|
config->gpgdir = strdup(value);
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: gpgdir: %s\n", value);
|
|
|
|
}
|
|
|
|
} else if(strcmp(key, "LogFile") == 0) {
|
|
|
|
if(!config->logfile) {
|
|
|
|
config->logfile = strdup(value);
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: logfile: %s\n", value);
|
|
|
|
}
|
|
|
|
} else if(strcmp(key, "XferCommand") == 0) {
|
|
|
|
config->xfercommand = strdup(value);
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: xfercommand: %s\n", value);
|
|
|
|
} else if(strcmp(key, "CleanMethod") == 0) {
|
2011-06-03 17:13:04 -04:00
|
|
|
alpm_list_t *methods = NULL;
|
|
|
|
setrepeatingoption(value, "CleanMethod", &methods);
|
|
|
|
if(process_cleanmethods(methods)) {
|
|
|
|
FREELIST(methods);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
FREELIST(methods);
|
2011-05-05 12:12:49 -04:00
|
|
|
} else if(strcmp(key, "VerifySig") == 0) {
|
2011-05-05 16:01:35 -04:00
|
|
|
pgp_verify_t level = option_verifysig(value);
|
|
|
|
if(level != PM_PGP_VERIFY_UNKNOWN) {
|
2011-06-03 17:13:04 -04:00
|
|
|
config->sigverify = level;
|
2011-05-05 12:12:49 -04:00
|
|
|
} else {
|
2011-05-05 16:01:35 -04:00
|
|
|
pm_printf(PM_LOG_ERROR,
|
|
|
|
_("config file %s, line %d: directive '%s' has invalid value '%s'\n"),
|
|
|
|
file, linenum, key, value);
|
2011-05-05 12:12:49 -04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
pm_printf(PM_LOG_WARNING,
|
|
|
|
_("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"),
|
|
|
|
file, linenum, key, "options");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-06-28 00:11:43 -04:00
|
|
|
static int _add_mirror(alpm_db_t *db, char *value)
|
2011-05-05 12:12:49 -04:00
|
|
|
{
|
|
|
|
const char *dbname = alpm_db_get_name(db);
|
|
|
|
/* let's attempt a replacement for the current repo */
|
|
|
|
char *temp = strreplace(value, "$repo", dbname);
|
|
|
|
/* let's attempt a replacement for the arch */
|
2011-06-03 17:13:04 -04:00
|
|
|
const char *arch = config->arch;
|
2011-05-05 12:12:49 -04:00
|
|
|
char *server;
|
|
|
|
if(arch) {
|
|
|
|
server = strreplace(temp, "$arch", arch);
|
|
|
|
free(temp);
|
|
|
|
} else {
|
|
|
|
if(strstr(temp, "$arch")) {
|
|
|
|
free(temp);
|
|
|
|
pm_printf(PM_LOG_ERROR, _("The mirror '%s' contains the $arch"
|
|
|
|
" variable, but no Architecture is defined.\n"), value);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
server = temp;
|
|
|
|
}
|
|
|
|
|
2010-10-18 17:39:04 -04:00
|
|
|
if(alpm_db_add_server(db, server) != 0) {
|
2011-05-05 12:12:49 -04:00
|
|
|
/* pm_errno is set by alpm_db_setserver */
|
|
|
|
pm_printf(PM_LOG_ERROR, _("could not add server URL to database '%s': %s (%s)\n"),
|
2011-06-07 17:06:16 -04:00
|
|
|
dbname, server, alpm_strerror(alpm_errno(config->handle)));
|
2011-05-05 12:12:49 -04:00
|
|
|
free(server);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(server);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-06-03 17:13:04 -04:00
|
|
|
/** Sets up libalpm global stuff in one go. Called after the command line
|
2011-05-05 12:12:49 -04:00
|
|
|
* and inital config file parsing. Once this is complete, we can see if any
|
|
|
|
* paths were defined. If a rootdir was defined and nothing else, we want all
|
|
|
|
* of our paths to live under the rootdir that was specified. Safe to call
|
|
|
|
* multiple times (will only do anything the first time).
|
|
|
|
*/
|
2011-06-03 17:13:04 -04:00
|
|
|
static int setup_libalpm(void)
|
2011-05-05 12:12:49 -04:00
|
|
|
{
|
2011-05-05 12:42:42 -04:00
|
|
|
int ret = 0;
|
2011-06-03 17:13:04 -04:00
|
|
|
enum _pmerrno_t err;
|
2011-06-28 00:04:00 -04:00
|
|
|
alpm_handle_t *handle;
|
2011-06-03 17:13:04 -04:00
|
|
|
|
|
|
|
pm_printf(PM_LOG_DEBUG, "setup_libalpm called\n");
|
2011-05-05 12:42:42 -04:00
|
|
|
|
|
|
|
/* Configure root path first. If it is set and dbpath/logfile were not
|
|
|
|
* set, then set those as well to reside under the root. */
|
|
|
|
if(config->rootdir) {
|
|
|
|
char path[PATH_MAX];
|
|
|
|
if(!config->dbpath) {
|
2011-06-03 17:13:04 -04:00
|
|
|
snprintf(path, PATH_MAX, "%s/%s", config->rootdir, DBPATH + 1);
|
2011-05-05 12:42:42 -04:00
|
|
|
config->dbpath = strdup(path);
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
2011-05-05 12:42:42 -04:00
|
|
|
if(!config->logfile) {
|
2011-06-03 17:13:04 -04:00
|
|
|
snprintf(path, PATH_MAX, "%s/%s", config->rootdir, LOGFILE + 1);
|
2011-05-05 12:42:42 -04:00
|
|
|
config->logfile = strdup(path);
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
2011-06-03 17:13:04 -04:00
|
|
|
} else {
|
|
|
|
config->rootdir = strdup(ROOTDIR);
|
|
|
|
if(!config->dbpath) {
|
|
|
|
config->dbpath = strdup(DBPATH);
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
2011-05-05 12:42:42 -04:00
|
|
|
}
|
2011-06-03 17:13:04 -04:00
|
|
|
|
|
|
|
/* initialize library */
|
2011-06-07 14:15:43 -04:00
|
|
|
handle = alpm_initialize(config->rootdir, config->dbpath, &err);
|
|
|
|
if(!handle) {
|
2011-06-03 17:13:04 -04:00
|
|
|
pm_printf(PM_LOG_ERROR, _("failed to initialize alpm library (%s)\n"),
|
|
|
|
alpm_strerror(err));
|
2011-04-20 20:54:01 -04:00
|
|
|
if(err == PM_ERR_DB_VERSION) {
|
2011-06-07 21:42:15 -04:00
|
|
|
pm_printf(PM_LOG_ERROR, _(" try running pacman-db-upgrade\n"));
|
2011-04-20 20:54:01 -04:00
|
|
|
}
|
2011-06-03 17:13:04 -04:00
|
|
|
return -1;
|
|
|
|
}
|
2011-06-07 14:15:43 -04:00
|
|
|
config->handle = handle;
|
2011-06-03 17:13:04 -04:00
|
|
|
|
2011-06-07 14:15:43 -04:00
|
|
|
alpm_option_set_logcb(handle, cb_log);
|
|
|
|
alpm_option_set_dlcb(handle, cb_dl_progress);
|
2011-06-03 17:13:04 -04:00
|
|
|
|
|
|
|
config->logfile = config->logfile ? config->logfile : strdup(LOGFILE);
|
2011-06-07 14:15:43 -04:00
|
|
|
ret = alpm_option_set_logfile(handle, config->logfile);
|
2011-06-03 17:13:04 -04:00
|
|
|
if(ret != 0) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("problem setting logfile '%s' (%s)\n"),
|
2011-06-07 18:29:55 -04:00
|
|
|
config->logfile, alpm_strerror(alpm_errno(handle)));
|
2011-06-03 17:13:04 -04:00
|
|
|
return ret;
|
2011-05-05 12:42:42 -04:00
|
|
|
}
|
2011-05-05 12:12:49 -04:00
|
|
|
|
2011-05-05 12:42:42 -04:00
|
|
|
/* Set GnuPG's home directory. This is not relative to rootdir, even if
|
|
|
|
* rootdir is defined. Reasoning: gpgdir contains configuration data. */
|
2011-06-03 17:13:04 -04:00
|
|
|
config->gpgdir = config->gpgdir ? config->gpgdir : strdup(GPGDIR);
|
2011-06-15 13:02:29 -04:00
|
|
|
ret = alpm_option_set_gpgdir(handle, config->gpgdir);
|
2011-06-03 17:13:04 -04:00
|
|
|
if(ret != 0) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("problem setting gpgdir '%s' (%s)\n"),
|
2011-06-07 18:29:55 -04:00
|
|
|
config->gpgdir, alpm_strerror(alpm_errno(handle)));
|
2011-06-03 17:13:04 -04:00
|
|
|
return ret;
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
2011-05-05 12:42:42 -04:00
|
|
|
|
|
|
|
/* add a default cachedir if one wasn't specified */
|
2011-06-03 17:13:04 -04:00
|
|
|
if(config->cachedirs == NULL) {
|
2011-06-07 14:15:43 -04:00
|
|
|
alpm_option_add_cachedir(handle, CACHEDIR);
|
2011-06-03 17:13:04 -04:00
|
|
|
} else {
|
2011-06-07 14:15:43 -04:00
|
|
|
alpm_option_set_cachedirs(handle, config->cachedirs);
|
2011-06-03 17:13:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if(config->sigverify != PM_PGP_VERIFY_UNKNOWN) {
|
2011-06-07 14:15:43 -04:00
|
|
|
alpm_option_set_default_sigverify(handle, config->sigverify);
|
2011-06-03 17:13:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if(config->xfercommand) {
|
2011-06-07 14:15:43 -04:00
|
|
|
alpm_option_set_fetchcb(handle, download_with_xfercommand);
|
2011-05-05 12:42:42 -04:00
|
|
|
}
|
2011-06-03 17:13:04 -04:00
|
|
|
|
|
|
|
if(config->totaldownload) {
|
2011-06-07 14:15:43 -04:00
|
|
|
alpm_option_set_totaldlcb(handle, cb_dl_total);
|
2011-06-03 17:13:04 -04:00
|
|
|
}
|
|
|
|
|
2011-06-07 14:15:43 -04:00
|
|
|
alpm_option_set_arch(handle, config->arch);
|
|
|
|
alpm_option_set_checkspace(handle, config->checkspace);
|
|
|
|
alpm_option_set_usesyslog(handle, config->usesyslog);
|
|
|
|
alpm_option_set_usedelta(handle, config->usedelta);
|
2011-06-03 17:13:04 -04:00
|
|
|
|
2011-06-07 14:15:43 -04:00
|
|
|
alpm_option_set_ignorepkgs(handle, config->ignorepkg);
|
|
|
|
alpm_option_set_ignoregrps(handle, config->ignoregrp);
|
|
|
|
alpm_option_set_noupgrades(handle, config->noupgrade);
|
|
|
|
alpm_option_set_noextracts(handle, config->noextract);
|
2011-06-03 17:13:04 -04:00
|
|
|
|
2011-05-05 12:42:42 -04:00
|
|
|
return 0;
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
|
|
|
|
2011-06-07 20:40:55 -04:00
|
|
|
/**
|
|
|
|
* Allows parsing in advance of an entire config section before we start
|
|
|
|
* calling library methods.
|
|
|
|
*/
|
|
|
|
struct section_t {
|
|
|
|
/* useful for all sections */
|
|
|
|
char *name;
|
|
|
|
int is_options;
|
|
|
|
/* db section option gathering */
|
|
|
|
pgp_verify_t sigverify;
|
|
|
|
alpm_list_t *servers;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrap up a section once we have reached the end of it. This should be called
|
|
|
|
* when a subsequent section is encountered, or when we have reached the end of
|
|
|
|
* the root config file. Once called, all existing saved config pieces on the
|
|
|
|
* section struct are freed.
|
|
|
|
* @param section the current parsed and saved section data
|
|
|
|
* @param parse_options whether we are parsing options or repo data
|
|
|
|
* @return 0 on success, 1 on failure
|
|
|
|
*/
|
|
|
|
static int finish_section(struct section_t *section, int parse_options)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
alpm_list_t *i;
|
2011-06-28 00:11:43 -04:00
|
|
|
alpm_db_t *db;
|
2011-06-07 20:40:55 -04:00
|
|
|
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: finish section '%s'\n", section->name);
|
|
|
|
|
|
|
|
/* parsing options (or nothing)- nothing to do except free the pieces */
|
|
|
|
if(!section->name || parse_options || section->is_options) {
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we are not looking at options sections only, register a db */
|
2011-06-07 18:29:55 -04:00
|
|
|
db = alpm_db_register_sync(config->handle, section->name, section->sigverify);
|
2011-06-07 20:40:55 -04:00
|
|
|
if(db == NULL) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"),
|
|
|
|
section->name, alpm_strerror(alpm_errno(config->handle)));
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = section->servers; i; i = alpm_list_next(i)) {
|
|
|
|
char *value = alpm_list_getdata(i);
|
|
|
|
if(_add_mirror(db, value) != 0) {
|
|
|
|
pm_printf(PM_LOG_ERROR,
|
|
|
|
_("could not add mirror '%s' to database '%s' (%s)\n"),
|
|
|
|
value, section->name, alpm_strerror(alpm_errno(config->handle)));
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
free(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
alpm_list_free(section->servers);
|
|
|
|
section->servers = NULL;
|
|
|
|
section->sigverify = 0;
|
|
|
|
free(section->name);
|
|
|
|
section->name = NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
2011-05-05 12:12:49 -04:00
|
|
|
|
2011-06-07 18:56:57 -04:00
|
|
|
/** The "real" parseconfig. Each "Include" directive will recall this method so
|
|
|
|
* recursion and stack depth are limited to 10 levels. The publicly visible
|
|
|
|
* parseconfig calls this with a NULL section argument so we can recall from
|
|
|
|
* within ourself on an include.
|
|
|
|
* @param file path to the config file
|
2011-06-07 20:40:55 -04:00
|
|
|
* @param section the current active section
|
2011-06-07 18:56:57 -04:00
|
|
|
* @param parse_options whether to parse and call methods for the options
|
|
|
|
* section; if 0, parse and call methods for the repos sections
|
|
|
|
* @param depth the current recursion depth
|
2011-06-07 20:40:55 -04:00
|
|
|
* @return 0 on success, 1 on failure
|
|
|
|
*/
|
|
|
|
static int _parseconfig(const char *file, struct section_t *section,
|
2011-06-07 18:56:57 -04:00
|
|
|
int parse_options, int depth)
|
2011-05-05 12:12:49 -04:00
|
|
|
{
|
|
|
|
FILE *fp = NULL;
|
2011-06-09 14:41:08 -04:00
|
|
|
char line[PATH_MAX];
|
2011-05-05 12:12:49 -04:00
|
|
|
int linenum = 0;
|
|
|
|
int ret = 0;
|
2011-06-07 18:56:57 -04:00
|
|
|
const int max_depth = 10;
|
|
|
|
|
|
|
|
if(depth >= max_depth) {
|
|
|
|
pm_printf(PM_LOG_ERROR,
|
|
|
|
_("config parsing exceeded max recursion depth of %d.\n"), max_depth);
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2011-05-05 12:12:49 -04:00
|
|
|
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: attempting to read file %s\n", file);
|
|
|
|
fp = fopen(file, "r");
|
|
|
|
if(fp == NULL) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("config file %s could not be read.\n"), file);
|
2011-06-07 18:56:57 -04:00
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
while(fgets(line, PATH_MAX, fp)) {
|
2011-06-07 18:56:57 -04:00
|
|
|
char *key, *value, *ptr;
|
|
|
|
size_t line_len;
|
2011-05-05 12:42:42 -04:00
|
|
|
|
2011-05-05 12:12:49 -04:00
|
|
|
linenum++;
|
|
|
|
strtrim(line);
|
2011-06-07 18:56:57 -04:00
|
|
|
line_len = strlen(line);
|
2011-05-05 12:12:49 -04:00
|
|
|
|
|
|
|
/* ignore whole line and end of line comments */
|
2011-06-07 18:56:57 -04:00
|
|
|
if(line_len == 0 || line[0] == '#') {
|
2011-05-05 12:12:49 -04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if((ptr = strchr(line, '#'))) {
|
|
|
|
*ptr = '\0';
|
|
|
|
}
|
|
|
|
|
2011-06-07 18:56:57 -04:00
|
|
|
if(line[0] == '[' && line[line_len - 1] == ']') {
|
2011-05-05 16:16:52 -04:00
|
|
|
char *name;
|
2011-06-07 18:56:57 -04:00
|
|
|
/* only possibility here is a line == '[]' */
|
|
|
|
if(line_len <= 2) {
|
2011-05-05 12:12:49 -04:00
|
|
|
pm_printf(PM_LOG_ERROR, _("config file %s, line %d: bad section name.\n"),
|
|
|
|
file, linenum);
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2011-06-07 18:56:57 -04:00
|
|
|
/* new config section, skip the '[' */
|
|
|
|
name = strdup(line + 1);
|
|
|
|
name[line_len - 2] = '\0';
|
2011-06-07 20:40:55 -04:00
|
|
|
/* we're at a new section; perform any post-actions for the prior */
|
|
|
|
if(finish_section(section, parse_options)) {
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
2011-05-05 16:16:52 -04:00
|
|
|
}
|
2011-06-07 20:40:55 -04:00
|
|
|
pm_printf(PM_LOG_DEBUG, "config: new section '%s'\n", name);
|
|
|
|
section->name = name;
|
|
|
|
section->is_options = (strcmp(name, "options") == 0);
|
2011-05-05 12:12:49 -04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* directive */
|
|
|
|
/* strsep modifies the 'line' string: 'key \0 value' */
|
|
|
|
key = line;
|
|
|
|
value = line;
|
|
|
|
strsep(&value, "=");
|
|
|
|
strtrim(key);
|
|
|
|
strtrim(value);
|
|
|
|
|
|
|
|
if(key == NULL) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("config file %s, line %d: syntax error in config file- missing key.\n"),
|
|
|
|
file, linenum);
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
/* For each directive, compare to the camelcase string. */
|
2011-06-07 20:40:55 -04:00
|
|
|
if(section->name == NULL) {
|
2011-05-05 12:12:49 -04:00
|
|
|
pm_printf(PM_LOG_ERROR, _("config file %s, line %d: All directives must belong to a section.\n"),
|
|
|
|
file, linenum);
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
/* Include is allowed in both options and repo sections */
|
|
|
|
if(strcmp(key, "Include") == 0) {
|
2011-05-05 12:42:42 -04:00
|
|
|
glob_t globbuf;
|
|
|
|
int globret;
|
|
|
|
size_t gindex;
|
|
|
|
|
2011-05-05 12:12:49 -04:00
|
|
|
if(value == NULL) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"),
|
|
|
|
file, linenum, key);
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
/* Ignore include failures... assume non-critical */
|
|
|
|
globret = glob(value, GLOB_NOCHECK, NULL, &globbuf);
|
|
|
|
switch(globret) {
|
|
|
|
case GLOB_NOSPACE:
|
|
|
|
pm_printf(PM_LOG_DEBUG,
|
|
|
|
"config file %s, line %d: include globbing out of space\n",
|
|
|
|
file, linenum);
|
|
|
|
break;
|
|
|
|
case GLOB_ABORTED:
|
|
|
|
pm_printf(PM_LOG_DEBUG,
|
|
|
|
"config file %s, line %d: include globbing read error for %s\n",
|
|
|
|
file, linenum, value);
|
|
|
|
break;
|
|
|
|
case GLOB_NOMATCH:
|
|
|
|
pm_printf(PM_LOG_DEBUG,
|
|
|
|
"config file %s, line %d: no include found for %s\n",
|
|
|
|
file, linenum, value);
|
|
|
|
break;
|
|
|
|
default:
|
2011-05-05 12:42:42 -04:00
|
|
|
for(gindex = 0; gindex < globbuf.gl_pathc; gindex++) {
|
2011-05-05 12:12:49 -04:00
|
|
|
pm_printf(PM_LOG_DEBUG, "config file %s, line %d: including %s\n",
|
|
|
|
file, linenum, globbuf.gl_pathv[gindex]);
|
2011-06-07 20:40:55 -04:00
|
|
|
_parseconfig(globbuf.gl_pathv[gindex], section, parse_options, depth + 1);
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
globfree(&globbuf);
|
|
|
|
continue;
|
|
|
|
}
|
2011-06-07 20:40:55 -04:00
|
|
|
if(parse_options && section->is_options) {
|
2011-05-05 12:12:49 -04:00
|
|
|
/* we are either in options ... */
|
|
|
|
if((ret = _parse_options(key, value, file, linenum)) != 0) {
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2011-06-07 20:40:55 -04:00
|
|
|
} else if (!parse_options && !section->is_options) {
|
2011-05-05 12:12:49 -04:00
|
|
|
/* ... or in a repo section */
|
|
|
|
if(strcmp(key, "Server") == 0) {
|
|
|
|
if(value == NULL) {
|
|
|
|
pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"),
|
|
|
|
file, linenum, key);
|
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2011-06-07 20:40:55 -04:00
|
|
|
section->servers = alpm_list_add(section->servers, strdup(value));
|
2011-05-05 12:12:49 -04:00
|
|
|
} else if(strcmp(key, "VerifySig") == 0) {
|
2011-05-05 16:01:35 -04:00
|
|
|
pgp_verify_t level = option_verifysig(value);
|
|
|
|
if(level != PM_PGP_VERIFY_UNKNOWN) {
|
2011-06-07 20:40:55 -04:00
|
|
|
section->sigverify = level;
|
2011-05-05 12:12:49 -04:00
|
|
|
} else {
|
2011-05-05 16:01:35 -04:00
|
|
|
pm_printf(PM_LOG_ERROR,
|
|
|
|
_("config file %s, line %d: directive '%s' has invalid value '%s'\n"),
|
|
|
|
file, linenum, key, value);
|
2011-05-05 12:12:49 -04:00
|
|
|
ret = 1;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
pm_printf(PM_LOG_WARNING,
|
|
|
|
_("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"),
|
2011-06-07 20:40:55 -04:00
|
|
|
file, linenum, key, section->name);
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-07 20:40:55 -04:00
|
|
|
if(depth == 0) {
|
|
|
|
ret = finish_section(section, parse_options);
|
|
|
|
}
|
|
|
|
|
2011-05-05 12:12:49 -04:00
|
|
|
cleanup:
|
|
|
|
fclose(fp);
|
|
|
|
pm_printf(PM_LOG_DEBUG, "config: finished parsing %s\n", file);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Parse a configuration file.
|
2011-06-07 18:56:57 -04:00
|
|
|
* @param file path to the config file
|
2011-05-05 12:12:49 -04:00
|
|
|
* @return 0 on success, non-zero on error
|
|
|
|
*/
|
|
|
|
int parseconfig(const char *file)
|
|
|
|
{
|
2011-05-05 12:42:42 -04:00
|
|
|
int ret;
|
2011-06-07 20:40:55 -04:00
|
|
|
struct section_t section;
|
|
|
|
memset(§ion, 0, sizeof(struct section_t));
|
2011-05-05 12:42:42 -04:00
|
|
|
/* the config parse is a two-pass affair. We first parse the entire thing for
|
|
|
|
* the [options] section so we can get all default and path options set.
|
|
|
|
* Next, we go back and parse everything but [options]. */
|
|
|
|
|
2011-05-05 12:12:49 -04:00
|
|
|
/* call the real parseconfig function with a null section & db argument */
|
2011-05-05 12:42:42 -04:00
|
|
|
pm_printf(PM_LOG_DEBUG, "parseconfig: options pass\n");
|
2011-06-07 20:40:55 -04:00
|
|
|
if((ret = _parseconfig(file, §ion, 1, 0))) {
|
2011-05-05 12:42:42 -04:00
|
|
|
return ret;
|
|
|
|
}
|
2011-06-03 17:13:04 -04:00
|
|
|
if((ret = setup_libalpm())) {
|
2011-05-05 12:42:42 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
/* second pass, repo section parsing */
|
|
|
|
pm_printf(PM_LOG_DEBUG, "parseconfig: repo pass\n");
|
2011-06-07 20:40:55 -04:00
|
|
|
return _parseconfig(file, §ion, 0, 0);
|
2011-05-05 12:12:49 -04:00
|
|
|
}
|
|
|
|
|
2005-03-14 20:51:43 -05:00
|
|
|
/* vim: set ts=2 sw=2 noet: */
|