Date: 2005-08-26
Initial Package Version: 2.9.6
Origin: Miklos Vajna <vmiklos@frugalware.org>
Description: Adds the ability to install only the dependencies of packages,
but not the packages themselves.
 doc/pacman.8.in |    5 +++++
 src/pacman.c    |   33 +++++++++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 2 deletions(-)
diff -Naur pacman-2.9.6.orig/doc/pacman.8.in pacman-2.9.6/doc/pacman.8.in
--- pacman-2.9.6.orig/doc/pacman.8.in	2005-08-25 23:55:39.000000000 +0200
+++ pacman-2.9.6/doc/pacman.8.in	2005-08-26 00:52:56.000000000 +0200
@@ -92,6 +92,11 @@
 Using one --clean (or -c) switch will only remove \fIold\fP packages.
 Use it twice to remove \fIall\fP packages from the cache.
 .TP
+.B "\-e, \-\-dependsonly"
+Don't install the packages itself, only their dependencies. This can be
+handy if you want to install the packages themselves with different
+options or from source.
+.TP
 .B "\-g, \-\-groups"
 Display all the members for each package group specified.  If no group
 names are provided, all groups will be listed.
diff -Naur pacman-2.9.6.orig/src/pacman.c pacman-2.9.6/src/pacman.c
--- pacman-2.9.6.orig/src/pacman.c	2005-08-25 23:55:39.000000000 +0200
+++ pacman-2.9.6/src/pacman.c	2005-08-26 00:46:39.000000000 +0200
@@ -79,6 +79,7 @@
 unsigned short pmo_r_dbonly     = 0;
 unsigned short pmo_r_recurse    = 0;
 unsigned short pmo_s_clean      = 0;
+unsigned short pmo_s_dependsonly  = 0;
 unsigned short pmo_s_downloadonly = 0;
 PMList        *pmo_s_ignore     = NULL;
 unsigned short pmo_s_info       = 0;
@@ -1054,6 +1055,32 @@
 			FREELIST(list);
 		}
 
+		/* remove original targets from final if requested */
+		if (pmo_s_dependsonly)
+		{
+			k = NULL;
+			for(i = final; i; i = i->next)
+			{
+				syncpkg_t *s = (syncpkg_t*)i->data;
+				int keepit = 1;
+				for(j = targets; j; j = j->next)
+				{
+					if(!strcmp(j->data, s->pkg->name))
+					{
+						FREE(i->data);
+						keepit = 0;
+					}
+				}
+				if(keepit)
+				{
+					k = list_add(k, s);
+				}
+				i->data = NULL;
+			}
+			FREELIST(final);
+			final = k;
+		}
+
 		/* any packages in rmtargs need to be removed from final. */
 		/* rather than ripping out nodes from final, we just copy over */
 		/* our "good" nodes to a new list and reassign. */
@@ -3543,6 +3570,7 @@
 		{"cascade",    no_argument,       0, 'c'},
 		{"changelog",  no_argument,       0, 'c'},
 		{"nodeps",     no_argument,       0, 'd'},
+		{"dependsonly",no_argument,       0, 'e'},
 		{"orphans",    no_argument,       0, 'e'},
 		{"force",      no_argument,       0, 'f'},
 		{"groups",     no_argument,       0, 'g'},
@@ -3590,7 +3618,7 @@
 			case 'b': strcpy(pmo_dbpath, optarg); break;
 			case 'c': pmo_s_clean++; pmo_r_cascade = 1; pmo_q_changelog = 1; break;
 			case 'd': pmo_nodeps = 1; break;
-			case 'e': pmo_q_orphans = 1; break;
+			case 'e': pmo_q_orphans = 1; pmo_s_dependsonly = 1; break;
 			case 'f': pmo_force = 1; break;
 			case 'g': pmo_group = 1; break;
 			case 'i': pmo_q_info++; pmo_s_info++; break;
@@ -3928,6 +3956,7 @@
 			printf("options:\n");
 			printf("  -c, --clean         remove old packages from cache directory (use -cc for all)\n");
 			printf("  -d, --nodeps        skip dependency checks\n");
+			printf("  -e, --dependsonly   install dependencies only\n");
 			printf("  -f, --force         force install, overwrite conflicting files\n");
 			printf("  -g, --groups        view all members of a package group\n");
 			printf("  -i, --info          view package information\n");
@@ -4109,4 +4138,4 @@
 }
  
 
-/* vim: set ts=2 sw=2 noet: */
+/* vim: set ts=8 sw=2 noet: */
