From owner-p4-projects@FreeBSD.ORG Wed Dec 12 11:47:19 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D2BFA16A46B; Wed, 12 Dec 2007 11:47:18 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5384F16A417 for ; Wed, 12 Dec 2007 11:47:18 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3471B13C455 for ; Wed, 12 Dec 2007 11:47:18 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBCBlI5a006586 for ; Wed, 12 Dec 2007 11:47:18 GMT (envelope-from gcooper@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBCBlIVG006582 for perforce@freebsd.org; Wed, 12 Dec 2007 11:47:18 GMT (envelope-from gcooper@FreeBSD.org) Date: Wed, 12 Dec 2007 11:47:18 GMT Message-Id: <200712121147.lBCBlIVG006582@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gcooper@FreeBSD.org using -f From: Garrett Cooper To: Perforce Change Reviews Cc: Subject: PERFORCE change 130694 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2007 11:47:19 -0000 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)