[pacman-dev] [PATCH] A variety of small changes

Allan McRae mcrae_allan at hotmail.com
Fri May 16 09:06:06 EDT 2008


1. makepkg - Reduces the missing arch error to a warning when only
generating intergity checks (-g or --geninteg flag)

2. libalpm - remove unused handle->uid from pmhandle_t.  The need to
check permissions should be determined by the frontend (and is in pacman).

3. libalpm - fix comment on noextract in pmhandle_t.

4. pacman - only ask for removal confirmation when the recusre or
cascade options add packages to the removal list

Signed-off-by: Allan McRae <mcrae_allan at hotmail.com>
---
 lib/libalpm/handle.c  |    1 -
 lib/libalpm/handle.h  |    3 +--
 scripts/makepkg.sh.in |    2 +-
 src/pacman/remove.c   |   35 +++++++++++++++++++----------------
 4 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 5f209d4..2b871b5 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -54,7 +54,6 @@ pmhandle_t *_alpm_handle_new()
 	handle->logstream = NULL;
 
 	/* see if we're root or not */
-	handle->uid = geteuid();
 	handle->root = NULL;
 	handle->dbpath = NULL;
 	handle->cachedirs = NULL;
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index 5051917..9c537b1 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -30,7 +30,6 @@
 
 typedef struct _pmhandle_t {
 	/* internal usage */
-	uid_t uid;              /* current UID */ /* TODO is this used? */
 	pmdb_t *db_local;       /* local db pointer */
 	alpm_list_t *dbs_sync;  /* List of (pmdb_t *) */
 	FILE *logstream;        /* log file stream pointer */
@@ -50,7 +49,7 @@ typedef struct _pmhandle_t {
 
 	/* package lists */
 	alpm_list_t *noupgrade;   /* List of packages NOT to be upgraded */
-	alpm_list_t *noextract;   /* List of packages NOT to extract */ /*TODO is this used?*/
+	alpm_list_t *noextract;   /* List of files NOT to extract */
 	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 */
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index cc44c68..8009ef0 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1315,7 +1315,7 @@ if [ "$arch" = 'any' ]; then
 fi
 
 if ! in_array $CARCH ${arch[@]}; then
-	if [ "$IGNOREARCH" = "0" ]; then
+	if [ "$IGNOREARCH" = "0"  -o "$GENINTEG" = "1" ]; then
 		error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgname" "$CARCH"
 		plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT"
 		plain "$(gettext "such as arch=('%s').")" "$CARCH"
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 4fe9bc8..9ae9262 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -121,23 +121,26 @@ int pacman_remove(alpm_list_t *targets)
 	/* Warn user in case of dangerous operation */
 	if(config->flags & PM_TRANS_FLAG_RECURSE ||
 	   config->flags & PM_TRANS_FLAG_CASCADE) {
-		/* list transaction targets */
-		alpm_list_t *lst = NULL;
-		/* create a new list of package names only */
-		for(i = alpm_trans_get_pkgs(); i; i = alpm_list_next(i)) {
-			pmpkg_t *pkg = alpm_list_getdata(i);
-			lst = alpm_list_add(lst, strdup(alpm_pkg_get_name(pkg)));
-		}
-		printf("\n");
-		list_display(_("Targets:"), lst);
-		FREELIST(lst);
-		/* get confirmation */
-		if(yesno(1, _("\nDo you want to remove these packages?")) == 0) {
-			trans_release();
-			FREELIST(finaltargs);
-			return(1);
+		/* check if recurse or cascade added packages to remove */
+		if(alpm_list_count(finaltargs) != alpm_list_count(alpm_trans_get_pkgs())) {
+			/* list transaction targets */
+			alpm_list_t *lst = NULL;
+			/* create a new list of package names only */
+			for(i = alpm_trans_get_pkgs(); i; i = alpm_list_next(i)) {
+				pmpkg_t *pkg = alpm_list_getdata(i);
+				lst = alpm_list_add(lst, strdup(alpm_pkg_get_name(pkg)));
+			}
+			printf("\n");
+			list_display(_("Targets:"), lst);
+			FREELIST(lst);
+			/* get confirmation */
+			if(yesno(1, _("\nDo you want to remove these packages?")) == 0) {
+				trans_release();
+				FREELIST(finaltargs);
+				return(1);
+			}
+			printf("\n");
 		}
-		printf("\n");
 	}
 
 	/* Step 3: actually perform the removal */
-- 
1.5.5.1





More information about the pacman-dev mailing list