Submitted By: Adam Zlehovszky Date: 2004.11.28 Initial Packages: 2.9.2 Description: This patch adds a new feature to pacman. If there are remove lines in .PKGINFO file, pacman will remove that files. diff -Naur pacman-2.9.2.orig/scripts/makepkg pacman-2.9.2/scripts/makepkg --- pacman-2.9.2.orig/scripts/makepkg 2004-09-25 19:59:49.000000000 +0200 +++ pacman-2.9.2/scripts/makepkg 2004-11-28 12:52:58.000000000 +0100 @@ -640,6 +640,9 @@ for it in "${depends[@]}"; do echo "depend = $it" >>.PKGINFO done +for it in "${removes[@]}"; do + echo "remove = $it" >>.PKGINFO +done for it in "${conflicts[@]}"; do echo "conflict = $it" >>.PKGINFO done diff -Naur pacman-2.9.2.orig/src/package.c pacman-2.9.2/src/package.c --- pacman-2.9.2.orig/src/package.c 2004-09-18 10:14:55.000000000 +0200 +++ pacman-2.9.2/src/package.c 2004-11-28 13:10:10.700853872 +0100 @@ -210,6 +210,8 @@ info->size = atol(tmp); } else if(!strcmp(key, "DEPEND")) { info->depends = list_add(info->depends, strdup(ptr)); + } else if(!strcmp(key, "REMOVE")) { + info->removes = list_add(info->removes, strdup(ptr)); } else if(!strcmp(key, "CONFLICT")) { info->conflicts = list_add(info->conflicts, strdup(ptr)); } else if(!strcmp(key, "REPLACES")) { @@ -256,6 +258,7 @@ pkg->files = NULL; pkg->backup = NULL; pkg->depends = NULL; + pkg->removes = NULL; pkg->groups = NULL; pkg->provides = NULL; pkg->replaces = NULL; @@ -272,6 +275,7 @@ FREELIST(pkg->files); FREELIST(pkg->backup); FREELIST(pkg->depends); + FREELIST(pkg->removes); FREELIST(pkg->conflicts); FREELIST(pkg->requiredby); FREELIST(pkg->groups); @@ -353,6 +357,9 @@ pm = list_sort(info->depends); list_display("Depends On :", pm); FREELIST(pm); + pm = list_sort(info->removes); + list_display("Removes :", pm); + FREELIST(pm); pm = list_sort(info->requiredby); list_display("Required By :", pm); FREELIST(pm); @@ -385,6 +392,9 @@ pm = list_sort(info->depends); list_display("Depends On :", pm); FREELIST(pm); + pm = list_sort(info->removes); + list_display("Remove :", pm); + FREELIST(pm); pm = list_sort(info->conflicts); list_display("Conflicts With :", pm); FREELIST(pm); diff -Naur pacman-2.9.2.orig/src/package.h pacman-2.9.2/src/package.h --- pacman-2.9.2.orig/src/package.h 2004-09-18 10:14:55.000000000 +0200 +++ pacman-2.9.2/src/package.h 2004-11-28 13:08:49.050266648 +0100 @@ -65,6 +65,7 @@ PMList *files; PMList *backup; PMList *depends; + PMList *removes; PMList *requiredby; PMList *conflicts; PMList *provides; diff -Naur pacman-2.9.2.orig/src/pacman.c pacman-2.9.2/src/pacman.c --- pacman-2.9.2.orig/src/pacman.c 2004-09-21 08:34:52.000000000 +0200 +++ pacman-2.9.2/src/pacman.c 2004-11-28 13:12:23.000000000 +0100 @@ -1431,9 +1431,10 @@ TAR *tar = NULL; char expath[PATH_MAX]; char pm_install[PATH_MAX]; + char rm_fname[PATH_MAX]; pkginfo_t *info = NULL; struct stat buf; - PMList *targ, *file, *lp, *j, *k; + PMList *targ, *file, *lp, *j, *k, *remove_list; PMList *alltargs = NULL; PMList *filenames = NULL; unsigned short real_pmo_upgrade; @@ -1668,6 +1669,21 @@ } /* + * Remove some files + * + */ + printf("removing some files... "); + fflush(stdout); + for (targ=alltargs; targ!=NULL; targ=targ->next) { + info=(pkginfo_t *)targ->data; + for (remove_list=info->removes; remove_list!=NULL; remove_list=remove_list->next) { + snprintf(rm_fname, PATH_MAX, "%s%s", pmo_root, (char *)remove_list->data); + remove(rm_fname); + } + } + printf("done.\n"); + + /* * Check for file conflicts * */