Add IgnoreGroup and --ignoregroup option.

This will be used in the next commit.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Nathan Jones 2007-11-09 20:13:28 -05:00 committed by Dan McGee
parent 5cd6ffda72
commit 5c58b3d500
5 changed files with 45 additions and 0 deletions

View File

@ -68,6 +68,10 @@ Options
Instructs pacman to ignore any upgrades for this package when performing
a '\--sysupgrade'.
*IgnoreGroup =* group ...::
Instructs pacman to ignore any upgrades for all packages in this
group when performing a '\--sysupgrade'.
*Include =* path::
Include another config file. This file can include repositories or
general configuration options.

View File

@ -130,6 +130,10 @@ alpm_list_t *alpm_option_get_holdpkgs();
void alpm_option_add_holdpkg(const char *pkg);
void alpm_option_set_holdpkgs(alpm_list_t *holdpkgs);
alpm_list_t *alpm_option_get_ignoregrps();
void alpm_option_add_ignoregrp(const char *grp);
void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps);
time_t alpm_option_get_upgradedelay();
void alpm_option_set_upgradedelay(time_t delay);

View File

@ -100,6 +100,7 @@ void _alpm_handle_free(pmhandle_t *handle)
FREELIST(handle->noextract);
FREELIST(handle->ignorepkg);
FREELIST(handle->holdpkg);
FREELIST(handle->ignoregrp);
FREE(handle);
}
@ -211,6 +212,15 @@ alpm_list_t SYMEXPORT *alpm_option_get_holdpkgs()
return handle->holdpkg;
}
alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
{
if (handle == NULL) {
pm_errno = PM_ERR_HANDLE_NULL;
return NULL;
}
return handle->ignoregrp;
}
time_t SYMEXPORT alpm_option_get_upgradedelay()
{
if (handle == NULL) {
@ -461,6 +471,17 @@ void SYMEXPORT alpm_option_set_holdpkgs(alpm_list_t *holdpkgs)
if(holdpkgs) handle->holdpkg = holdpkgs;
}
void SYMEXPORT alpm_option_add_ignoregrp(const char *grp)
{
handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp));
}
void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps)
{
if(handle->ignoregrp) FREELIST(handle->ignoregrp);
if(ignoregrps) handle->ignoregrp = ignoregrps;
}
void SYMEXPORT alpm_option_set_upgradedelay(time_t delay)
{
handle->upgradedelay = delay;

View File

@ -55,6 +55,7 @@ typedef struct _pmhandle_t {
alpm_list_t *noextract; /* List of packages NOT to extract */ /*TODO is this used?*/
alpm_list_t *ignorepkg; /* List of packages to ignore */
alpm_list_t *holdpkg; /* List of packages which 'hold' pacman */
alpm_list_t *ignoregrp; /* List of groups to ignore */
/* options */
unsigned short usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */

View File

@ -309,6 +309,7 @@ static int parseargs(int argc, char *argv[])
{"cachedir", required_argument, 0, 1007},
{"asdeps", no_argument, 0, 1008},
{"logfile", required_argument, 0, 1009},
{"ignoregroup", required_argument, 0, 1010},
{0, 0, 0, 0}
};
@ -369,6 +370,7 @@ static int parseargs(int argc, char *argv[])
}
config->have_logfile = 1;
break;
case 1010: alpm_option_add_ignoregrp(strdup(optarg)); break;
case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break;
case 'F':
config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_UPGRADE);
@ -627,6 +629,19 @@ static int _parseconfig(const char *file, const char *givensection,
}
alpm_option_add_ignorepkg(p);
pm_printf(PM_LOG_DEBUG, "config: ignorepkg: %s\n", p);
} else if(strcmp(key, "IgnoreGroup") == 0 || strcmp(upperkey, "IGNOREGROUP") == 0) {
char *p = ptr;
char *q;
while((q = strchr(p, ' '))) {
*q = '\0';
alpm_option_add_ignoregrp(p);
pm_printf(PM_LOG_DEBUG, "config: ignoregroup: %s", p);
p = q;
p++;
}
alpm_option_add_ignoregrp(p);
pm_printf(PM_LOG_DEBUG, "config: ignoregroup: %s\n", p);
} else if(strcmp(key, "HoldPkg") == 0 || strcmp(upperkey, "HOLDPKG") == 0) {
char *p = ptr;
char *q;