PERFORCE change 130694 for review
Garrett Cooper
gcooper at FreeBSD.org
Wed Dec 12 03:47:19 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=130694
Change 130694 by gcooper at 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)
More information about the p4-projects
mailing list