diff options
author | martti <martti@pkgsrc.org> | 2002-09-30 08:37:13 +0000 |
---|---|---|
committer | martti <martti@pkgsrc.org> | 2002-09-30 08:37:13 +0000 |
commit | e2a5a561e81e1b3ca7e8ac289fb344ed4fbf4e21 (patch) | |
tree | f2272341d22d555ed2407092b24bcb335456c6d2 /pkgtools | |
parent | 06308c9585572180b112b5afabac6a96c360ab5a (diff) | |
download | pkgsrc-e2a5a561e81e1b3ca7e8ac289fb344ed4fbf4e21.tar.gz |
distfetch helps you to fetch all the distfiles you need to compile
your packages. Only the required distfiles are downloaded.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/distfetch/DESCR | 2 | ||||
-rw-r--r-- | pkgtools/distfetch/Makefile | 33 | ||||
-rw-r--r-- | pkgtools/distfetch/PLIST | 5 | ||||
-rwxr-xr-x | pkgtools/distfetch/files/distfetch | 161 | ||||
-rw-r--r-- | pkgtools/distfetch/files/distfetch.1 | 108 | ||||
-rw-r--r-- | pkgtools/distfetch/files/distfetch.conf | 13 |
6 files changed, 322 insertions, 0 deletions
diff --git a/pkgtools/distfetch/DESCR b/pkgtools/distfetch/DESCR new file mode 100644 index 00000000000..b27cc89790d --- /dev/null +++ b/pkgtools/distfetch/DESCR @@ -0,0 +1,2 @@ +distfetch helps you to fetch all the distfiles you need to compile +your packages. Only the required distfiles are downloaded. diff --git a/pkgtools/distfetch/Makefile b/pkgtools/distfetch/Makefile new file mode 100644 index 00000000000..432977f8d96 --- /dev/null +++ b/pkgtools/distfetch/Makefile @@ -0,0 +1,33 @@ +# $NetBSD: Makefile,v 1.1.1.1 2002/09/30 08:37:13 martti Exp $ + +DISTNAME= distfetch-20020930 +CATEGORIES= pkgtools +MASTER_SITES= # empty +DISTFILES= # empty + +MAINTAINER= martti@netbsd.org +HOMEPAGE= http://www.pkgsrc.org/ +COMMENT= Script to fetch only required distribution files + +EXTRACT_ONLY= # defined +WRKSRC= ${WRKDIR} +NO_CHECKSUM= # defined +NO_PATCH= # defined +NO_CONFIGURE= # defined + +.include "../../mk/bsd.prefs.mk" + +do-build: +.for i in distfetch distfetch.1 distfetch.conf + ${SED} "s+__PREFIX__+${PREFIX}+g" < ${FILESDIR}/${i} > ${WRKSRC}/${i} +.endfor + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/distfetch ${PREFIX}/bin/distfetch + ${INSTALL_MAN} ${WRKSRC}/distfetch.1 ${PREFIX}/man/man1 + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/distfetch + ${INSTALL_DATA} ${WRKSRC}/distfetch.conf \ + ${PREFIX}/share/examples/distfetch/distfetch.conf + +.include "../../mk/bsd.pkg.mk" + diff --git a/pkgtools/distfetch/PLIST b/pkgtools/distfetch/PLIST new file mode 100644 index 00000000000..678356e1d6e --- /dev/null +++ b/pkgtools/distfetch/PLIST @@ -0,0 +1,5 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2002/09/30 08:37:13 martti Exp $ +bin/distfetch +man/man1/distfetch.1 +share/examples/distfetch/distfetch.conf +@dirrm share/examples/distfetch diff --git a/pkgtools/distfetch/files/distfetch b/pkgtools/distfetch/files/distfetch new file mode 100755 index 00000000000..08a5af78a61 --- /dev/null +++ b/pkgtools/distfetch/files/distfetch @@ -0,0 +1,161 @@ +#!/bin/sh +# +# $NetBSD: distfetch,v 1.1.1.1 2002/09/30 08:37:14 martti Exp $ +# +# Copyright (c) 2002 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Martti Kuparinen. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the NetBSD +# Foundation, Inc. and its contributors. +# 4. Neither the name of The NetBSD Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# +# This script helps you to fetch distfiles for packages. +# +# See also: +# +# - distfetch(1) +# - __PREFIX__/share/examples/distfetch/distfetch.conf +# +PATH="/sbin:/usr/sbin:/bin:/usr/bin:${PATH}" + +# Default settings +CONFIG="__PREFIX__/etc/distfetch.conf" +PKGSRCDIR="${PKGSRCDIR:=/usr/pkgsrc}" +DISTDIR="`cd ${PKGSRCDIR} && make -V DISTDIR`" +TEMPFILE="/tmp/`basename $0`.$$" +VERBOSE= + +usage() { + cat << EOF + +Usage: `basename $0` [options] + +Options: + + -c filename Location of the configuration file + -d directory Location of the distribution files + -s directory Location of pkgsrc + + -h This help text + -v Be more verbose + +Default settings: + + -c ${CONFIG} + -d ${DISTDIR} + -s ${PKGSRCDIR} + +Example: + + # `basename $0` -c ~/.distfetchrc + +EOF + exit 1 +} + +# +# main() +# + +# Read command line arguments +ARGV=`getopt c:d:hs:v $*` +[ $? != 0 ] && usage +set -- ${ARGV} +for i; do + case "${i}" in + -c) + CONFIG="${2}" + shift 2 + ;; + -d) + DISTDIR="${2}" + shift 2 + ;; + -h) + usage + ;; + -s) + PKGSRCDIR="${2}" + shift 2 + ;; + -v) + VERBOSE=YES + shift + ;; + --) + shift + break + ;; + esac +done + +# Check if DISTDIR could be set +DIRECTORY="`cd ${PKGSRCDIR} && make -V DISTDIR DISTDIR=${DISTDIR}`" +if [ "x${DIRECTORY}" != "x${DISTDIR}" ]; then + echo "Error: you already have DISTDIR=${DIRECTORY} in /etc/mk.conf" + exit 1 +fi +DISTDIR="${DIRECTORY}" +export DISTDIR + +# Read the configuration file +if [ ! -r "${CONFIG}" ]; then + echo "`basename $0`: ${CONFIG} not found" + exit 1 +fi +echo "Reading package list from ${CONFIG}" +PKGS= +for i in `sed -e 's+#.*++' -e '/^$/d' < ${CONFIG} | tr '\n' ' '` +do + if [ ! -d "${PKGSRCDIR}/${i}" ]; then + echo "Warning: unknown package ${i}" + continue + fi + echo "===> ${i}" + PKGS="${PKGS} ${i}" +done + +# Generate a list of missing files +echo "Processing packages" +(cd ${PKGSRCDIR} && make SITE_SPECIFIC_PKGS="${PKGS}" SPECIFIC_PKGS=1 \ + fetch-list) > "${TEMPFILE}" + +# Fetch distfiles into ${DISTDIR} +echo "Fetching missing distfiles into ${DISTDIR}" +if [ -z "${VERBOSE}" ]; then + sh "${TEMPFILE}" || exit 1 +else + echo "Running \"sh -x ${TEMPFILE}\"" + sh -x "${TEMPFILE}" || exit 1 +fi + +rm -f "${TEMPFILE}" +echo "All done" diff --git a/pkgtools/distfetch/files/distfetch.1 b/pkgtools/distfetch/files/distfetch.1 new file mode 100644 index 00000000000..8bb5214ab89 --- /dev/null +++ b/pkgtools/distfetch/files/distfetch.1 @@ -0,0 +1,108 @@ +.\" $NetBSD: distfetch.1,v 1.1.1.1 2002/09/30 08:37:13 martti Exp $ +.\" +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Martti Kuparinen. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 30, 2002 +.Dt DISTFETCH 1 +.Os +.Sh NAME +.Nm distfetch +.Nd fetch distribution files for packages +.Sh SYNOPSIS +.Nm +.Op Fl c Ar filename +.Op Fl d Ar destdir +.Op Fl h +.Op Fl s Ar srcdir +.Op Fl v +.Sh DESCRIPTION +.Nm +is a tool to fetch only required distfiles for the packages you +are going to install. +The packages are defined in a configuration file. +.Pp +The distfiles are stored in +.Pa /usr/pkgsrc/distfiles +but this can be changed by using the +.Fl d Ar destdir +argument or by setting the +.Pa DISTDIR +variable in +.Pa /etc/mk.conf . +.Pp +Usage information is shown with the +.Fl h +flag. +To get a better idea what's going on, use the +.Fl v +flag. +.Sh ENVIRONMENT +.Bl -tag -width PKGSRCDIR +.It Ev PKGSRCDIR +Location of the +.Nx +Package System. +By default this is +.Pa /usr/pkgsrc +but it can be changed either with the +.Fl s Ar srcdir +argument or by defining the +.Ev PKGSRCDIR +variable. +.El +.Sh FILES +The default configuration file is +.Pa __PREFIX__/etc/distfetch.conf +but this can be changed with the +.Fl c Ar filename +argument. +.Pp +An example of the configuration file can be found in the +.Pa __PREFIX__/share/examples/distfetch +directory. +.Sh AUTHORS +This script was written by +.An Martti Kuparinen Aq martti@netbsd.org +and improved by several other +.Nx +users. +.Sh BUGS +It is not possible to use +.Fl d Ar destdir +if +.Pa /etc/mk.conf +has a +.Pa DISTDIR +setting. diff --git a/pkgtools/distfetch/files/distfetch.conf b/pkgtools/distfetch/files/distfetch.conf new file mode 100644 index 00000000000..1bdd50504aa --- /dev/null +++ b/pkgtools/distfetch/files/distfetch.conf @@ -0,0 +1,13 @@ +# +# $NetBSD: distfetch.conf,v 1.1.1.1 2002/09/30 08:37:13 martti Exp $ +# +# Syntax: +# ======= +# +# <category>/<name> +# + +# Define your packages here +shells/bash2 +shells/bash2-doc +x11/kde3 |