summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorAllan McRae <mcrae_allan@hotmail.com>2007-12-22 12:28:08 +0100
committerDan McGee <dan@archlinux.org>2007-12-29 02:43:59 +0100
commitcca4ec647e6b5e1959206348360cc7412a5e8ed2 (patch)
treee52a308a9bc80bb7c3ecc3acab7f0fcb339f65ef /lib/libalpm/handle.c
parentd8a10a8e72a4a4c776f52ccdb66c0914b274ea4f (diff)
downloadpacman-cca4ec647e6b5e1959206348360cc7412a5e8ed2.tar.gz
pacman-cca4ec647e6b5e1959206348360cc7412a5e8ed2.tar.xz
Add remove counterparts to alpm_option_add_* functions
Fixes FS#7428. Added functions to remove cachedir, noupgrade, noextract, ignorepkg, holdpkg and ignoregrp. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> [Dan: fix whitespace] Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index ab6fc7eb..07828115 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -395,6 +395,29 @@ void SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
if(cachedirs) handle->cachedirs = cachedirs;
}
+int SYMEXPORT alpm_option_remove_cachedir(const char *cachedir)
+{
+ void *vdata = NULL;
+ char *newcachedir;
+ size_t cachedirlen;
+ /* verify cachedir ends in a '/' */
+ cachedirlen = strlen(cachedir);
+ if(cachedir[cachedirlen-1] != '/') {
+ cachedirlen += 1;
+ }
+ newcachedir = calloc(cachedirlen + 1, sizeof(char));
+ strncpy(newcachedir, cachedir, cachedirlen);
+ newcachedir[cachedirlen-1] = '/';
+ handle->cachedirs = alpm_list_remove(handle->cachedirs, newcachedir,
+ _alpm_str_cmp, &vdata);
+ FREE(newcachedir);
+ if(vdata != NULL) {
+ FREE(vdata);
+ return(1);
+ }
+ return(0);
+}
+
int SYMEXPORT alpm_option_set_logfile(const char *logfile)
{
char *oldlogfile = handle->logfile;
@@ -436,6 +459,18 @@ void SYMEXPORT alpm_option_set_noupgrades(alpm_list_t *noupgrade)
if(noupgrade) handle->noupgrade = noupgrade;
}
+int SYMEXPORT alpm_option_remove_noupgrade(const char *pkg)
+{
+ void *vdata = NULL;
+ handle->noupgrade = alpm_list_remove(handle->noupgrade, pkg,
+ _alpm_str_cmp, &vdata);
+ if(vdata != NULL) {
+ FREE(vdata);
+ return(1);
+ }
+ return(0);
+}
+
void SYMEXPORT alpm_option_add_noextract(const char *pkg)
{
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
@@ -447,6 +482,18 @@ void SYMEXPORT alpm_option_set_noextracts(alpm_list_t *noextract)
if(noextract) handle->noextract = noextract;
}
+int SYMEXPORT alpm_option_remove_noextract(const char *pkg)
+{
+ void *vdata = NULL;
+ handle->noextract = alpm_list_remove(handle->noextract, pkg,
+ _alpm_str_cmp, &vdata);
+ if(vdata != NULL) {
+ FREE(vdata);
+ return(1);
+ }
+ return(0);
+}
+
void SYMEXPORT alpm_option_add_ignorepkg(const char *pkg)
{
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
@@ -458,6 +505,18 @@ void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
if(ignorepkgs) handle->ignorepkg = ignorepkgs;
}
+int SYMEXPORT alpm_option_remove_ignorepkg(const char *pkg)
+{
+ void *vdata = NULL;
+ handle->ignorepkg = alpm_list_remove(handle->ignorepkg, pkg,
+ _alpm_str_cmp, &vdata);
+ if(vdata != NULL) {
+ FREE(vdata);
+ return(1);
+ }
+ return(0);
+}
+
void SYMEXPORT alpm_option_add_holdpkg(const char *pkg)
{
handle->holdpkg = alpm_list_add(handle->holdpkg, strdup(pkg));
@@ -469,6 +528,18 @@ void SYMEXPORT alpm_option_set_holdpkgs(alpm_list_t *holdpkgs)
if(holdpkgs) handle->holdpkg = holdpkgs;
}
+int SYMEXPORT alpm_option_remove_holdpkg(const char *pkg)
+{
+ void *vdata = NULL;
+ handle->holdpkg = alpm_list_remove(handle->holdpkg, pkg,
+ _alpm_str_cmp, &vdata);
+ if(vdata != NULL) {
+ FREE(vdata);
+ return(1);
+ }
+ return(0);
+}
+
void SYMEXPORT alpm_option_add_ignoregrp(const char *grp)
{
handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp));
@@ -480,6 +551,18 @@ void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps)
if(ignoregrps) handle->ignoregrp = ignoregrps;
}
+int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
+{
+ void *vdata = NULL;
+ handle->ignoregrp = alpm_list_remove(handle->ignoregrp, grp,
+ _alpm_str_cmp, &vdata);
+ if(vdata != NULL) {
+ FREE(vdata);
+ return(1);
+ }
+ return(0);
+}
+
void SYMEXPORT alpm_option_set_upgradedelay(time_t delay)
{
handle->upgradedelay = delay;