Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2007 11:47:18 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 130694 for review
Message-ID:  <200712121147.lBCBlIVG006582@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=130694

Change 130694 by gcooper@shiina-ibook on 2007/12/12 11:46:26

	- Make /usr/ports/packages a constant.
	- Prepare for $PKG_DIR support (add todo comment).

Affected files ...

.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo_local_freebsd.c#3 edit

Differences ...

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo_local_freebsd.c#3 (text+ko) ====

@@ -36,6 +36,8 @@
 #include "pkg_private.h"
 #include "pkg_repo_private.h"
 
+#define DEFAULT_PKG_DIR "/usr/ports/packages"
+
 static struct pkg *file_get_pkg(struct pkg_repo *, const char *);
 
 /**
@@ -74,6 +76,7 @@
 /**
  * @brief Retrieves a package from either . or /usr/ports/packages/All/
  * @todo Check if the file we opened is a package. If not try the next file.
+ * @todo Make DEFAULT_PKG_DIR pluggable via the $PKG_DIR environment variable.
  * @return a package object or NULL
  */
 static struct pkg *
@@ -85,12 +88,15 @@
 	assert(repo != NULL);
 	assert(pkg_name != NULL);
 
-	/* XXX Check the file is a package file after every attempt to open it */
+	/*
+	 * XXX Check the file is a package file after every
+	 * attempt to open it.
+	 */
 	snprintf(dir, MAXPATHLEN + 1,"%s.tbz", pkg_name);
 	fd = fopen(dir, "r");
 	if (fd == NULL) {
 		snprintf(dir, MAXPATHLEN + 1,
-		    "/usr/ports/packages/All/%s.tbz", pkg_name);
+		    DEFAULT_PKG_DIR "/All/%s.tbz", pkg_name);
 		fd = fopen(dir, "r");
 	}
 	if (fd == NULL) {
@@ -98,7 +104,7 @@
 	}
 	if (fd == NULL) {
 		snprintf(dir, MAXPATHLEN + 1,
-		    "/usr/ports/packages/All/%s", pkg_name);
+		    DEFAULT_PKG_DIR "/All/%s", pkg_name);
 		fd = fopen(dir, "r");
 	}
 	if (fd == NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712121147.lBCBlIVG006582>