[Midnightbsd-cvs] src [12201] trunk/usr.sbin/mport/mport.c: add pkg leaf

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun May 26 11:21:45 EDT 2019


Revision: 12201
          http://svnweb.midnightbsd.org/src/?rev=12201
Author:   laffer1
Date:     2019-05-26 11:21:44 -0400 (Sun, 26 May 2019)
Log Message:
-----------
add pkg leaf

Modified Paths:
--------------
    trunk/usr.sbin/mport/mport.c

Modified: trunk/usr.sbin/mport/mport.c
===================================================================
--- trunk/usr.sbin/mport/mport.c	2019-05-25 17:42:06 UTC (rev 12200)
+++ trunk/usr.sbin/mport/mport.c	2019-05-26 15:21:44 UTC (rev 12201)
@@ -36,6 +36,7 @@
 #include <err.h>
 #include <dispatch/dispatch.h>
 #include <mport.h>
+#include "../libmport/mport.h"
 
 #define MPORT_TOOLS_PATH "/usr/libexec/"
 #define MPORT_LOCAL_PKG_PATH "/var/db/mport/downloads"
@@ -43,7 +44,7 @@
 static void usage(void);
 static void loadIndex(mportInstance *);
 static mportIndexEntry ** lookupIndex(mportInstance *, const char *);
-static int install_depends(mportInstance *, const char *, const char *);
+static int install_depends(mportInstance *, const char *, const char *, bool first);
 static int install(mportInstance *, const char *);
 static int cpeList(mportInstance *);
 static int configGet(mportInstance *, const char *);
@@ -244,26 +245,28 @@
 		__block int local_argc = argc;
 		__block char *const * local_argv = argv;
 		local_argv++;
-                if (local_argc > 2) {
-			int ch, qflag, oflag;
-			qflag = oflag = 0;
-		        while ((ch = getopt(local_argc, local_argv, "qo")) != -1) {
-				switch (ch) {
-			 		case 'q':
-					qflag = 1;
-					break;
-					case 'o':
-	                                oflag = 1;
-        	                        break;
+			if (local_argc > 2) {
+				int ch, qflag, oflag;
+				qflag = oflag = 0;
+				while ((ch = getopt(local_argc, local_argv, "qo")) != -1) {
+					switch (ch) {
+						case 'q':
+							qflag = 1;
+							break;
+						case 'o':
+							oflag = 1;
+							break;
+						default:
+							break;
+					}
 				}
+				local_argc -= optind;
+				local_argv += optind;
+
+				which(mport, *local_argv, qflag, oflag);
+			} else {
+				usage();
 			}
-			local_argc -= optind;
-			local_argv += optind;
-
-			which(mport, *local_argv, qflag, oflag);
-                } else {
-                        usage();
-                }
                 });
 	} else {
 		mport_instance_free(mport);
@@ -478,7 +481,7 @@
 
 /* recursive function */ 
 int
-install_depends(mportInstance *mport, const char *packageName, const char *version) {
+install_depends(mportInstance *mport, const char *packageName, const char *version, bool first) {
 	mportPackageMeta **packs;
 	mportDependsEntry **depends;
 
@@ -501,13 +504,15 @@
 	} else if (packs == NULL) {
 		/* Package is not installed */
 		while (*depends != NULL) {
-			install_depends(mport, (*depends)->d_pkgname, (*depends)->d_version);
+			install_depends(mport, (*depends)->d_pkgname, (*depends)->d_version, false);
 			depends++;
-        	}
+		}
+
 		if (mport_install(mport, packageName, version, NULL) != MPORT_OK) {
 			warnx("%s", mport_err_string());
 			return mport_err_code();
 		}
+
 		mport_index_depends_free_vec(depends);
 	} else {
 		/* already installed */
@@ -552,7 +557,7 @@
 		}
 	}
 
-	resultCode = install_depends(mport, (*indexEntry)->pkgname, (*indexEntry)->version);
+	resultCode = install_depends(mport, (*indexEntry)->pkgname, (*indexEntry)->version, true);
 
 	mport_index_entry_free_vec(indexEntry);
 



More information about the Midnightbsd-cvs mailing list