summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_comp
diff options
context:
space:
mode:
authorjmmv <jmmv>2012-02-27 22:42:26 +0000
committerjmmv <jmmv>2012-02-27 22:42:26 +0000
commit38f3835a1ee9501e776f77cf951d71688f19a72b (patch)
tree9dcc696afec44b99fa463031344743e3ba479441 /pkgtools/pkg_comp
parentf74477afca066c6387d19ade040ad84c0390f027 (diff)
downloadpkgsrc-38f3835a1ee9501e776f77cf951d71688f19a72b.tar.gz
Update to 1.36:
- Allow specifying packages by their basename, without a category. This affects the arguments to the 'build' command as well as the list of packages provided to AUTO_PACKAGES and BUILD_PACKAGES.
Diffstat (limited to 'pkgtools/pkg_comp')
-rw-r--r--pkgtools/pkg_comp/Makefile4
-rw-r--r--pkgtools/pkg_comp/files/pkg_comp.822
-rw-r--r--pkgtools/pkg_comp/files/pkg_comp.sh43
3 files changed, 53 insertions, 16 deletions
diff --git a/pkgtools/pkg_comp/Makefile b/pkgtools/pkg_comp/Makefile
index b1341b9c413..06ad7d55ee5 100644
--- a/pkgtools/pkg_comp/Makefile
+++ b/pkgtools/pkg_comp/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.47 2010/11/13 16:23:22 jmmv Exp $
+# $NetBSD: Makefile,v 1.48 2012/02/27 22:42:26 jmmv Exp $
-DISTNAME= pkg_comp-1.35
+DISTNAME= pkg_comp-1.36
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/pkg_comp/files/pkg_comp.8 b/pkgtools/pkg_comp/files/pkg_comp.8
index 2dff943b1d8..c9abb8f008a 100644
--- a/pkgtools/pkg_comp/files/pkg_comp.8
+++ b/pkgtools/pkg_comp/files/pkg_comp.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_comp.8,v 1.35 2010/04/15 09:42:45 jmmv Exp $
+.\" $NetBSD: pkg_comp.8,v 1.36 2012/02/27 22:42:27 jmmv Exp $
.\"
.\" pkg_comp - Build packages inside a clean chroot environment
.\" Copyright (c) 2002, 2003, 2004, 2005 Julio M. Merino Vidal <jmmv@NetBSD.org>
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd April 15, 2010
+.Dd February 27, 2012
.Dt PKG_COMP 8
.Os
.Sh NAME
@@ -155,7 +155,12 @@ issuing a maketemplate.
A list of packages to automatically build during the
.Sy auto
target.
-A package is in the form section/name, like misc/colorls.
+A package is in the form
+.Sq section/name ,
+like
+.Sq misc/colorls ,
+or a plain name like
+.Sq colorls .
Defaults to nothing.
.It AUTO_TARGET
The pkgsrc target to use when building packages in an automated fashion
@@ -173,7 +178,12 @@ Defaults to
A list of packages to automatically build after the
.Sy makeroot
target.
-A package is in the form section/name, like misc/colorls.
+A package is in the form
+.Sq section/name ,
+like
+.Sq misc/colorls ,
+or a plain name like
+.Sq colorls .
Defaults to nothing.
.It BUILD_TARGET
The pkgsrc target to use when building packages.
@@ -475,8 +485,8 @@ Create the chroot environment, based on the specs of the configuration file.
This step is required before trying any other, except maketemplate.
.It build
Builds the specified packages inside the chroot.
-You need to pass their names as relative paths inside pkgsrc, like
-.Pa pkgtools/pkg_comp .
+You can pass the package names as a relative path within pkgsrc or as the
+basename of the package directory (i.e. omitting the directory name).
.It install
Install the specified binary packages into the chroot.
Package names can contain globs.
diff --git a/pkgtools/pkg_comp/files/pkg_comp.sh b/pkgtools/pkg_comp/files/pkg_comp.sh
index 4deecf1f99d..aa5933389a4 100644
--- a/pkgtools/pkg_comp/files/pkg_comp.sh
+++ b/pkgtools/pkg_comp/files/pkg_comp.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: pkg_comp.sh,v 1.39 2010/11/13 16:23:22 jmmv Exp $
+# $NetBSD: pkg_comp.sh,v 1.40 2012/02/27 22:42:27 jmmv Exp $
#
# pkg_comp - Build packages inside a clean chroot environment
# Copyright (c) 2002, 2003, 2004, 2005 Julio M. Merino Vidal <jmmv@NetBSD.org>
@@ -701,13 +701,14 @@ pkg_build()
{
local failed invalid p pkgs script statfile
- pkgs="$*"
-
- # Check if all packages exist
- invalid=""
- for p in $pkgs; do
- if [ ! -d $REAL_PKGSRC/$p ]; then
- invalid="$invalid $p"
+ pkgs=
+ invalid=
+ for pkg in "${@}"; do
+ local match="$(find_pkg "${pkg}")"
+ if [ -z "${match}" ]; then
+ invalid="${invalid} ${pkg}"
+ else
+ pkgs="${pkgs} ${match}"
fi
done
if [ -n "$invalid" ]; then
@@ -754,6 +755,32 @@ EOF
fi
}
+# find_pkg name
+#
+# Checks if the given package exists and outputs its path within pkgsrc.
+# Outputs nothing if the package is not found.
+find_pkg()
+{
+ local name="${1}"
+
+ case "${name}" in
+ */*)
+ if [ -d "${REAL_PKGSRC}/${name}" ]; then
+ echo "${name}"
+ else
+ : # Not found; output nothing.
+ fi
+ ;;
+ *)
+ local match="$(cd "${REAL_PKGSRC}" && echo */"${name}")"
+ if [ -d "${REAL_PKGSRC}/${match}" ]; then
+ echo "${match}"
+ else
+ : # Not found; output nothing.
+ fi
+ esac
+}
+
# build_and_install pkg
#
# Builds a package and ensures it gets installed. The use of destdir to