head 1.23;
access;
symbols
pkgsrc-2023Q4:1.23.0.30
pkgsrc-2023Q4-base:1.23
pkgsrc-2023Q3:1.23.0.28
pkgsrc-2023Q3-base:1.23
pkgsrc-2023Q2:1.23.0.26
pkgsrc-2023Q2-base:1.23
pkgsrc-2023Q1:1.23.0.24
pkgsrc-2023Q1-base:1.23
pkgsrc-2022Q4:1.23.0.22
pkgsrc-2022Q4-base:1.23
pkgsrc-2022Q3:1.23.0.20
pkgsrc-2022Q3-base:1.23
pkgsrc-2022Q2:1.23.0.18
pkgsrc-2022Q2-base:1.23
pkgsrc-2022Q1:1.23.0.16
pkgsrc-2022Q1-base:1.23
pkgsrc-2021Q4:1.23.0.14
pkgsrc-2021Q4-base:1.23
pkgsrc-2021Q3:1.23.0.12
pkgsrc-2021Q3-base:1.23
pkgsrc-2021Q2:1.23.0.10
pkgsrc-2021Q2-base:1.23
pkgsrc-2021Q1:1.23.0.8
pkgsrc-2021Q1-base:1.23
pkgsrc-2020Q4:1.23.0.6
pkgsrc-2020Q4-base:1.23
pkgsrc-2020Q3:1.23.0.4
pkgsrc-2020Q3-base:1.23
pkgsrc-2020Q2:1.23.0.2
pkgsrc-2020Q2-base:1.23
pkgsrc-2020Q1:1.22.0.12
pkgsrc-2020Q1-base:1.22
pkgsrc-2019Q4:1.22.0.14
pkgsrc-2019Q4-base:1.22
pkgsrc-2019Q3:1.22.0.10
pkgsrc-2019Q3-base:1.22
pkgsrc-2019Q2:1.22.0.8
pkgsrc-2019Q2-base:1.22
pkgsrc-2019Q1:1.22.0.6
pkgsrc-2019Q1-base:1.22
pkgsrc-2018Q4:1.22.0.4
pkgsrc-2018Q4-base:1.22
pkgsrc-2018Q3:1.22.0.2
pkgsrc-2018Q3-base:1.22
pkgsrc-2018Q2:1.21.0.66
pkgsrc-2018Q2-base:1.21
pkgsrc-2018Q1:1.21.0.64
pkgsrc-2018Q1-base:1.21
pkgsrc-2017Q4:1.21.0.62
pkgsrc-2017Q4-base:1.21
pkgsrc-2017Q3:1.21.0.60
pkgsrc-2017Q3-base:1.21
pkgsrc-2017Q2:1.21.0.56
pkgsrc-2017Q2-base:1.21
pkgsrc-2017Q1:1.21.0.54
pkgsrc-2017Q1-base:1.21
pkgsrc-2016Q4:1.21.0.52
pkgsrc-2016Q4-base:1.21
pkgsrc-2016Q3:1.21.0.50
pkgsrc-2016Q3-base:1.21
pkgsrc-2016Q2:1.21.0.48
pkgsrc-2016Q2-base:1.21
pkgsrc-2016Q1:1.21.0.46
pkgsrc-2016Q1-base:1.21
pkgsrc-2015Q4:1.21.0.44
pkgsrc-2015Q4-base:1.21
pkgsrc-2015Q3:1.21.0.42
pkgsrc-2015Q3-base:1.21
pkgsrc-2015Q2:1.21.0.40
pkgsrc-2015Q2-base:1.21
pkgsrc-2015Q1:1.21.0.38
pkgsrc-2015Q1-base:1.21
pkgsrc-2014Q4:1.21.0.36
pkgsrc-2014Q4-base:1.21
pkgsrc-2014Q3:1.21.0.34
pkgsrc-2014Q3-base:1.21
pkgsrc-2014Q2:1.21.0.32
pkgsrc-2014Q2-base:1.21
pkgsrc-2014Q1:1.21.0.30
pkgsrc-2014Q1-base:1.21
pkgsrc-2013Q4:1.21.0.28
pkgsrc-2013Q4-base:1.21
pkgsrc-2013Q3:1.21.0.26
pkgsrc-2013Q3-base:1.21
pkgsrc-2013Q2:1.21.0.24
pkgsrc-2013Q2-base:1.21
pkgsrc-2013Q1:1.21.0.22
pkgsrc-2013Q1-base:1.21
pkgsrc-2012Q4:1.21.0.20
pkgsrc-2012Q4-base:1.21
pkgsrc-2012Q3:1.21.0.18
pkgsrc-2012Q3-base:1.21
pkgsrc-2012Q2:1.21.0.16
pkgsrc-2012Q2-base:1.21
pkgsrc-2012Q1:1.21.0.14
pkgsrc-2012Q1-base:1.21
pkgsrc-2011Q4:1.21.0.12
pkgsrc-2011Q4-base:1.21
pkgsrc-2011Q3:1.21.0.10
pkgsrc-2011Q3-base:1.21
pkgsrc-2011Q2:1.21.0.8
pkgsrc-2011Q2-base:1.21
pkgsrc-2011Q1:1.21.0.6
pkgsrc-2011Q1-base:1.21
pkgsrc-2010Q4:1.21.0.4
pkgsrc-2010Q4-base:1.21
pkgsrc-2010Q3:1.21.0.2
pkgsrc-2010Q3-base:1.21
pkgsrc-2010Q2:1.20.0.4
pkgsrc-2010Q2-base:1.20
pkgsrc-2010Q1:1.20.0.2
pkgsrc-2010Q1-base:1.20
pkgsrc-2009Q4:1.17.0.22
pkgsrc-2009Q4-base:1.17
pkgsrc-2009Q3:1.17.0.20
pkgsrc-2009Q3-base:1.17
pkgsrc-2009Q2:1.17.0.18
pkgsrc-2009Q2-base:1.17
pkgsrc-2009Q1:1.17.0.16
pkgsrc-2009Q1-base:1.17
pkgsrc-2008Q4:1.17.0.14
pkgsrc-2008Q4-base:1.17
pkgsrc-2008Q3:1.17.0.12
pkgsrc-2008Q3-base:1.17
cube-native-xorg:1.17.0.10
cube-native-xorg-base:1.17
pkgsrc-2008Q2:1.17.0.8
pkgsrc-2008Q2-base:1.17
cwrapper:1.17.0.6
pkgsrc-2008Q1:1.17.0.4
pkgsrc-2008Q1-base:1.17
pkgsrc-2007Q4:1.17.0.2
pkgsrc-2007Q4-base:1.17
pkgsrc-2007Q3:1.15.0.10
pkgsrc-2007Q3-base:1.15
pkgsrc-2007Q2:1.15.0.8
pkgsrc-2007Q2-base:1.15
pkgsrc-2007Q1:1.15.0.6
pkgsrc-2007Q1-base:1.15
jlam-pkgviews:1.15.0.4
jlam-pkgviews-base:1.15
pkgsrc-2006Q4:1.15.0.2
pkgsrc-2006Q4-base:1.15
pkgsrc-2006Q3:1.13.0.2
pkgsrc-2006Q3-base:1.13
pkgsrc-2006Q2:1.10.0.2
pkgsrc-2006Q2-base:1.10
pkgsrc-2006Q1:1.7.0.2
pkgsrc-2006Q1-base:1.7
pkgsrc-2005Q4:1.6.0.6
pkgsrc-2005Q4-base:1.6
pkgsrc-2005Q3:1.6.0.4
pkgsrc-2005Q3-base:1.6
pkgsrc-2005Q2:1.6.0.2
pkgsrc-2005Q2-base:1.6;
locks; strict;
comment @# @;
1.23
date 2020.05.30.03.36.45; author khorben; state Exp;
branches;
next 1.22;
commitid t0x18l0m2Bj4ndaC;
1.22
date 2018.08.22.20.48.37; author maya; state Exp;
branches;
next 1.21;
commitid FMEpDDTKwDQBR9PA;
1.21
date 2010.07.21.12.29.46; author spz; state Exp;
branches;
next 1.20;
1.20
date 2010.03.13.11.45.16; author spz; state Exp;
branches;
next 1.19;
1.19
date 2010.03.12.20.19.15; author spz; state Exp;
branches;
next 1.18;
1.18
date 2010.02.27.12.00.54; author spz; state Exp;
branches;
next 1.17;
1.17
date 2007.10.13.17.46.12; author rillig; state Exp;
branches;
next 1.16;
1.16
date 2007.10.13.17.29.26; author rillig; state Exp;
branches;
next 1.15;
1.15
date 2006.12.15.13.15.06; author martti; state Exp;
branches;
next 1.14;
1.14
date 2006.12.15.12.46.24; author martti; state Exp;
branches;
next 1.13;
1.13
date 2006.07.28.20.52.35; author dmcmahill; state Exp;
branches;
next 1.12;
1.12
date 2006.07.28.18.41.53; author dmcmahill; state Exp;
branches;
next 1.11;
1.11
date 2006.07.28.02.41.07; author dmcmahill; state Exp;
branches;
next 1.10;
1.10
date 2006.06.21.14.13.27; author dmcmahill; state Exp;
branches;
next 1.9;
1.9
date 2006.06.08.11.18.04; author dmcmahill; state Exp;
branches;
next 1.8;
1.8
date 2006.06.06.11.10.31; author dmcmahill; state Exp;
branches;
next 1.7;
1.7
date 2006.01.05.22.19.42; author dmcmahill; state Exp;
branches;
next 1.6;
1.6
date 2005.05.24.21.48.22; author dmcmahill; state Exp;
branches;
next 1.5;
1.5
date 2005.05.24.20.56.47; author dmcmahill; state Exp;
branches;
next 1.4;
1.4
date 2005.05.24.20.49.41; author dmcmahill; state Exp;
branches;
next 1.3;
1.3
date 2005.05.22.01.36.49; author dmcmahill; state Exp;
branches;
next 1.2;
1.2
date 2005.05.19.03.58.40; author dmcmahill; state Exp;
branches;
next 1.1;
1.1
date 2005.05.17.21.46.59; author dmcmahill; state Exp;
branches;
next ;
desc
@@
1.23
log
@Typo
@
text
@#!/bin/sh
#
# $NetBSD: binpkg-cache,v 1.22 2018/08/22 20:48:37 maya Exp $
#
# Script for generating a cache file with information about
# all binary packages contained in a directory.
#
# Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Dan McMahill.
#
# 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.
#
# 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.
#
TMPDIR=${TMPDIR:-/tmp}
PACKAGES=${PACKAGES:-/usr/pkgsrc/packages/}
AWK=${AWK:-awk}
CMP=${CMP:-cmp}
FIND=${FIND:-find}
GREP=${GREP:-grep}
GZIP_CMD=${GZIP_CMD:-gzip}
BZIP2=${BZIP2:-bzip2}
PKG_INFO=${PKG_INFO:-pkg_info}
PKG_SUFX=${PKG_SUFX:-.tgz}
SED=${SED:-sed}
SORT=${SORT:-sort}
STAT=${STAT:-stat}
cachefile=.pkgcache
summaryfile=pkg_summary
cacheversion=20050428
prompt="----> "
tab=" "
tmpd=${TMPDIR}/pkg-cache.$$
mkdir -m 0700 ${tmpd}
if test $? -ne 0 ; then
echo "ERROR: Could not create temporary directory ${tmpd}"
echo "Either you do not have write permission to ${tmpd} or"
echo "${tmpd} already exists"
exit 1
fi
all_dirs=${tmpd}/all_dirs
prog=$0
usage(){
echo "$prog - Generates cache files for each directory containing binary"
echo " packages. This cache file can then be used by the README.html"
echo " generation code to avoid having to call pkg_info(1) over and over"
echo " on the same binary package. In addition, pkg_summary.gz files for"
echo " use by the pkgtools/pkg_chk package may be generated."
echo " "
echo "Usage: $prog [-d|--debug] [-v|--verbose] [-s|--summary] [-p|--packages
]"
echo " "
echo " $prog -h|--help"
echo " "
echo " $prog -V|--version"
echo " "
echo "The options supported by $prog are: "
echo " "
echo " -d|--debug Enables debugging output"
echo " "
echo " -F|--force Forces a rebuild of the cache files even if they are"
echo " otherwise up to date."
echo " "
echo " -h|--help Displays this help message"
echo " "
echo " -p|--packages Specifies the top level directory to be searched"
echo " for binary packages."
echo " "
echo " -s|--summary Enables the creation of pkg_summary.gz files in each"
echo " directory containing binary packages. The pkg_summary.gz"
echo " file is used by the pkgtools/pkg_chk package."
echo " "
echo " -v|--verbose Enables verbose output from the script."
echo " "
echo " -V|--version Displays the version of this script and exits."
echo " "
echo "Returns 0 on success, 1 on errors, 2 if the packages"
echo "directory does not exist."
echo " "
echo "Example: $prog -v --packages /usr/pkgsrc/packages"
echo " "
}
clean_and_exit0(){
rm -fr ${tmpd}
exit 0
}
clean_and_exit1(){
rm -fr ${tmpd}
exit 1
}
clean_and_exit2(){
rm -fr ${tmpd}
exit 2
}
all_cache_files=""
#############################################################################
#
# process_binpkg_dir()
#
# Process a directory by checking to see if a cache file exists. If the
# cache file exists, make sure it is up to date. If the file does not
# exist, create one.
#
# also keep track of this directory so it can be added to the master
# cache.
#
process_binpkg_dir(){
rdir=`${GREP} "^${d} " ${all_dirs} | ${AWK} '{print $2}'`
need_update=no
if test -f ${d}/${cachefile} ; then
stale_entries=`${FIND} ${d} -type f -name \*${PKG_SUFX} -newer ${d}/${cachefile} -print`
# FIX_ME
#
# We also should find cache entries for files which no longer exist
# and nuke them. Right now we simply declare the entire cache out
# of date. Once we implement incremental updates to the cache,
# we need to remove the entries but not mark the entire cache as
# bad.
$if_debug echo " Checking for cache entries with no corresponding pkg."
# get the list of what pkgs belong in the cache
rm -f ${tmpd}/pkg_list ${tmpd}/cache_pkg_list
${FIND} ${d}/ -name \*${PKG_SUFX} -print | \
${SED} -e "s;^${d}/*;${rdir}/;g" -e 's;//;/;g' | \
${SORT} > ${tmpd}/pkg_list
# and get the list of what is in the cache
${AWK} '/pkgcache_begin/ {gsub(/pkgcache_begin[ \t]*/, ""); print}' \
${d}/${cachefile} | ${SORT} > ${tmpd}/cache_pkg_list
if ${CMP} -s ${tmpd}/pkg_list ${tmpd}/cache_pkg_list ; then
$if_debug echo " No extra cache entries in ${d}/${cachefile}"
else
$if_debug echo "Package list:"
$if_debug cat ${tmpd}/pkg_list
$if_debug echo "Cache list:"
$if_debug cat ${tmpd}/cache_pkg_list
echo " Entries found in ${d}/${cachefile} but no packages found"
need_update=yes
fi
else
stale_entries=""
fi
if test "X${force}" = "Xyes" -o "X${need_update}" = "Xyes" ; then
need_update=yes
echo "${tab}Forcing rebuild of cache ${d}/${cachefile}."
elif test ! -f ${d}/${cachefile} ; then
need_update=yes
echo "${tab}Missing cache file. ${d}/${cachefile} will be generated."
elif test -n "${stale_entries}" ; then
need_update=yes
echo "${tab}Stale cache file. ${d}/${cachefile} will be regenerated."
else
${GREP} "pkgcache_version ${cacheversion}" ${d}/${cachefile} >/dev/null 2>&1
if test $? -ne 0 ; then
need_update=yes
echo "${tab}Invalid version cache file. ${d}/${cachefile} will be regenerated."
echo "Need version ${cacheversion} but the file has"
${GREP} "^pkgcache_version " ${d}/${cachefile}
else
$if_verbose echo "${tab}Cache file ${d}/${cachefile} is up to date."
fi
fi
if test "${build_summary}" = "yes" -a ! -f ${d}/${summaryfile}.gz ; then
echo "${tab}Summary file ${d}/${summaryfile}.gz is missing and will be created."
need_update=yes
fi
if test "${build_summary}" = "yes" -a ${d}/${summaryfile}.gz -ot ${d}/${cachefile} ; then
echo "${tab}Summary file ${d}/${summaryfile}.gz is out of date and will be regenerated."
need_update=yes
fi
# FIX_ME
# We should use stale_entries in a way where we only update the
# cache file entries corresponding to these if we're rebuilding
# due to stale entries. That should save a good bit of time.
#
if test "X${need_update}" = "Xyes" ; then
echo "pkgcache_version ${cacheversion}" > ${tmpd}/${cachefile}
rm -f ${tmpd}/${summaryfile}
touch ${tmpd}/${summaryfile}
for f in ${d}/*${PKG_SUFX} ; do
fn=`grep "^${d} " ${all_dirs} | ${AWK} '{print $2}'`"/"`basename ${f}`
$if_debug echo " Adding ${fn} (${f}) to the cache"
echo " " >> ${tmpd}/${cachefile}
# stat(1) needs to be added to the bootstrap kit
# first if we want to use it here
#eval $(${STAT} -s ${f} 2>/dev/null)
echo "pkgcache_begin ${fn}" >> ${tmpd}/${cachefile}
#echo "pkgcache_mtime=${st_mtime}" >> ${tmpd}/${cachefile}
$if_debug echo "${PKG_INFO} -q -B ${f}"
${PKG_INFO} -q -B ${f} >> ${tmpd}/${cachefile}
if test "${build_summary}" = "yes" ; then
$if_debug echo "${PKG_INFO} -X ${f}"
${PKG_INFO} -X ${f} >> ${tmpd}/${summaryfile}
fi
echo "pkgcache_end ${fn}" >> ${tmpd}/${cachefile}
done
if test -f ${d}/${cachefile} ; then
rm -f ${d}/${cachefile}
fi
mv -f ${tmpd}/${cachefile} ${d}/${cachefile}
if test $? -ne 0 ; then
echo "********** WARNING **********"
echo "move of ${tmpd}/${cachefile} to ${d}/${cachefile} failed!"
echo "Perhaps you do not have write permissions to ${d}?"
echo "This directory will be dropped from the master cache file."
echo "********** WARNING **********"
return
fi
if test "${build_summary}" = "yes" ; then
if test -f ${d}/${summaryfile}.gz ; then
rm -f ${d}/${summaryfile}.gz
fi
cat ${tmpd}/${summaryfile} | ${GZIP_CMD} > ${d}/${summaryfile}.gz
if test $? -ne 0 ; then
echo "********** WARNING **********"
echo "${GZIP_CMD} of ${tmpd}/${summaryfile} to ${d}/${summaryfile}.gz failed!"
echo "Perhaps you do not have write permissions to ${d}?"
echo "********** WARNING **********"
return
fi
# if it's there, update it, otherwise don't bother
if test -f ${d}/${summaryfile}.bz2 ; then
rm -f ${d}/${summaryfile}.bz2
cat ${tmpd}/${summaryfile} | ${BZIP2} > ${d}/${summaryfile}.bz2
if test $? -ne 0 ; then
echo "********** WARNING **********"
echo "${BZIP2} of ${tmpd}/${summaryfile} to ${d}/${summaryfile}.bz2 failed!"
echo "Perhaps you do not have write permissions to ${d}?"
echo "********** WARNING **********"
return
fi
fi
fi
fi
# if we got here, then this directory should have a good cache file in
# it and we should be able to add it to the master cache file
all_cache_files="${all_cache_files} ${d}/${cachefile}"
}
process_cache_files(){
echo "${prompt}Checking master cache file ${PACKAGES}/${cachefile}"
echo "pkgcache_version ${cacheversion}" > ${tmpd}/${cachefile}
if test -n "${all_cache_files}" ; then
for c in ${all_cache_files} ; do
echo "pkgcache_cachefile ${c}" >> ${tmpd}/${cachefile}
done
fi
if test ! -f ${PACKAGES}/${cachefile} ; then
echo "${tab}Creating master cache file ${PACKAGES}/${cachefile}"
mv -f ${tmpd}/${cachefile} ${PACKAGES}/${cachefile}
if test $? -ne 0 ; then
echo "********** ERROR **********"
echo "move of ${tmpd}/${cachefile} to ${PACKAGES}/${cachefile} failed!"
echo "Perhaps you do not have write permissions to ${PACKAGES}?"
echo "********** ERROR **********"
clean_and_exit1
fi
elif ${CMP} -s ${tmpd}/${cachefile} ${PACKAGES}/${cachefile} ; then
echo "${tab}Master cache file ${PACKAGES}/${cachefile} is up to date"
else
echo "${tab}Updating master cache file ${PACKAGES}/${cachefile}"
mv -f ${tmpd}/${cachefile} ${PACKAGES}/${cachefile}
if test $? -ne 0 ; then
echo "********** ERROR **********"
echo "move of ${tmpd}/${cachefile} to ${PACKAGES}/${cachefile} failed!"
echo "Perhaps you do not have write permissions to ${PACKAGES}?"
echo "********** ERROR **********"
clean_and_exit1
fi
fi
}
######################################################################
#
# Handle command line options
#
######################################################################
if_debug=: # either ":" or ""
if_verbose=: # either ":" or ""
force=no
build_summary=no
while
test -n "$1"
do
case "$1" in
# Turn on debugging
-d|--debug)
if_debug=""
if_verbose=""
shift
;;
# Force a rebuilde of the cache
-F|--force)
force=yes
shift
;;
# Help
-h|--help)
usage
exit 0
;;
# Use the specified packages directory
-p|--packages)
PACKAGES=$2
shift 2
;;
# Build the pkg_summary.gz files
-s|--summary)
build_summary=yes
shift
;;
# Version
-V|--version)
${AWK} '/^#[ \t]*\$NetBSD/ {gsub(/,v/,"",$3);printf("%s: Version %s, %s\n",$3,$4,$5); exit 0;}' $prog
exit 0
;;
# Turn on verbose output, but not as noisy as debug
-v|--verbose)
if_verbose=""
shift
;;
-*) echo "$prog: ERROR: $1 is not a valid option"
usage
clean_and_exit1
;;
*)
break
;;
esac
done
if test $# -ne 0 ; then
echo "$0: $* is invalid"
usage
clean_and_exit1
fi
if test ! -d ${PACKAGES} ; then
echo "Packages directory ${PACKAGES} seems to be missing"
clean_and_exit2
fi
# put a trailing / after ${PACKAGES} in case ${PACKAGES} is
# a link.
# pass 1, we find all directories under PACKAGES. Note that this
# may contain some directories more than once depending on what sort
# of soft links may be in place
rm -f ${all_dirs}.tmp
for d in `${FIND} ${PACKAGES}/ -type d -follow -print` ; do
cname=`(cd ${d} && pwd -P)`
rname=`echo ${d} | ${SED} "s;^${PACKAGES}/*;;g"`
echo "${cname} ${rname}" >> ${all_dirs}.tmp
done
${SORT} -u -k1,1 ${all_dirs}.tmp > ${all_dirs}
$if_debug echo "Full directory list:"
$if_debug cat ${all_dirs}.tmp
$if_debug echo "Unique directory list:"
$if_debug cat ${all_dirs}
for d in `${AWK} '{print $1}' ${all_dirs}` ; do
$if_debug echo "${prompt}Processing directory ${d}"
is_pkg_dir=no
for f in ${d}/*${PKG_SUFX} ; do
if test -f "${f}" -a ! -h "${f}" ; then
${PKG_INFO} ${f} >/dev/null 2>&1
if test $? -eq 0 ; then
is_pkg_dir=yes
break
fi
fi
done
if test "X${is_pkg_dir}" = "Xyes" ; then
$if_verbose echo "${prompt}Checking cache in ${d}"
process_binpkg_dir
else
$if_debug echo "${prompt}no binary packages in ${d}"
fi
done
process_cache_files
clean_and_exit0
@
1.22
log
@Remove clauses 3,4 from TNF-only copyright blocks.
This is based on the decision The NetBSD Foundation made in 2008 to
do so, which was already applied to src.
This change has been applied to code which is likely not in other
repositories.
ok board@@, reviewed by riastradh@@
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.21 2010/07/21 12:29:46 spz Exp $
d75 1
a75 1
echo " use by the pkgtools/pkg_chk pacakge may be generated."
@
1.21
log
@give the readme creation scripts the option to be a lot less talkative,
by optionally disabling progress report type output.
This will make the daily pkgmastr mail a lot smaller without dropping
useful information.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.20 2010/03/13 11:45:16 spz Exp $
a21 7
# 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.
@
1.20
log
@fix file permission != directory permission problem for the pkg_summary.bz2
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.19 2010/03/12 20:19:15 spz Exp $
d201 1
a201 1
echo "${tab}Cache file ${d}/${cachefile} is up to date."
d329 1
a329 1
verbose=no
d341 1
a341 1
verbose=yes
d376 1
a376 1
verbose=yes
d434 1
a434 1
echo "${prompt}Checking cache in ${d}"
@
1.19
log
@update pkg_summary.bz2 files if existing (and the pkg_summary.gz gets updated)
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.18 2010/02/27 12:00:54 spz Exp $
d269 1
@
1.18
log
@delete the summary and cache files in case the dir is writeable, but the
file isn't (as suggested by bouyer@@)
fix typo in output message
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.17 2007/10/13 17:46:12 rillig Exp $
d51 1
d267 11
@
1.17
log
@The "debug" variable was often used like "if [ $debug = yes ]; then ...;
fi". There is an easier way to solve the same problem with much less
code.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.16 2007/10/13 17:29:26 rillig Exp $
d209 1
a209 1
echo "${tab}Summary file ${d}/${summaryfile}.gz is out of date and will be regnerated."
d241 3
d255 3
@
1.16
log
@The --database option doesn't exist.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.15 2006/12/15 13:15:06 martti Exp $
d158 1
a158 3
if test "X${DEBUG}" = "Xyes" ; then
echo " Checking for cache entries with no corresponding pkg."
fi
d170 1
a170 3
if test "X${DEBUG}" = "Xyes" ; then
echo " No extra cache entries in ${d}/${cachefile}"
fi
d172 4
a175 6
if test "X${DEBUG}" = "Xyes" ; then
echo "Package list:"
cat ${tmpd}/pkg_list
echo "Cache list:"
cat ${tmpd}/cache_pkg_list
fi
d224 1
a224 3
if test "X${DEBUG}" = "Xyes" ; then
echo " Adding ${fn} (${f}) to the cache"
fi
d232 1
a232 1
if test "X${DEBUG}" = "Xyes" ; then echo "${PKG_INFO} -q -B ${f}" ; fi
d236 1
a236 1
if test "X${DEBUG}" = "Xyes" ; then echo "${PKG_INFO} -X ${f}" ; fi
d309 1
a309 1
DEBUG=no
d321 1
a321 1
DEBUG=yes
d355 1
a355 1
# Turn on verbose output, but not as noisy as DEBUG
d397 4
a400 6
if test "X${DEBUG}" = "Xyes" ; then
echo "Full directory list:"
cat ${all_dirs}.tmp
echo "Unique directory list:"
cat ${all_dirs}
fi
d403 1
a403 3
if test "X${DEBUG}" = "Xyes" ; then
echo "${prompt}Processing directory ${d}"
fi
d418 1
a418 3
if test "X${DEBUG}" = "Xyes" ; then
echo "${prompt}no binary packages in ${d}"
fi
a425 1
@
1.15
log
@Remove trailing tabs.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.14 2006/12/15 12:46:24 martti Exp $
a92 2
echo " -f|--database Writes the database into file specified by "
echo " "
@
1.14
log
@Remove trailing spaces.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.13 2006/07/28 20:52:35 dmcmahill Exp $
d260 1
a260 1
d436 1
a436 1
@
1.13
log
@Update the usage output to reflect current reality. Noted by Stoned
Elipot.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.12 2006/07/28 18:41:53 dmcmahill Exp $
d212 1
a212 1
if test "${build_summary}" = "yes" -a ! -f ${d}/${summaryfile}.gz ; then
d222 1
a222 1
# We should use stale_entries in a way where we only update the
d225 1
a225 1
#
d376 1
a376 1
*)
d394 1
a394 1
# put a trailing / after ${PACKAGES} in case ${PACKAGES} is
@
1.12
log
@remove spurious empty line at the top of the summary files
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.11 2006/07/28 02:41:07 dmcmahill Exp $
d80 2
a81 1
echo " on the same binary package."
d83 1
a83 1
echo "Usage: $prog [-d|--debug] [-v|--verbose] [-p|--packages ]"
d95 3
d103 7
a109 1
echo " -v|--version Displays the version of this script and exits."
@
1.11
log
@Allow the binpkg-cache script to also generate pkg_summary.gz files
if requested. Suggested by Joerg Sonnenberger.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.10 2006/06/21 14:13:27 dmcmahill Exp $
d218 2
a219 1
echo "" > ${tmpd}/${summaryfile}
@
1.10
log
@When producing the list of directories containing binary packages, do
some extra processing to ensure that we have a list of unique directories.
Otherwise we end up with two problems:
- cache files get rebuilt all the time because they get built once for each
path to the directory in question and since the path ends up in the cache,
it is always declared out of date.
- we end up with multiple links to the same binary package in the README.html
files.
Committed during the freeze becuase this is a real bug which is encountered
daily.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.9 2006/06/08 11:18:04 dmcmahill Exp $
d50 1
d58 1
d202 9
d218 1
d230 7
a236 2
if test "X${DEBUG}" = "Xyes" ; then
echo "${PKG_INFO} -q -B ${f}"
a237 1
${PKG_INFO} -q -B ${f} >> ${tmpd}/${cachefile}
d249 12
d311 1
d342 6
@
1.9
log
@undo most of the last commit which was a mistake.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.7 2006/01/05 22:19:42 dmcmahill Exp $
d70 1
d136 1
d154 1
a154 1
${SED} -e "s;^${PACKAGES}/*;;g" -e 's;//;/;g' | \
d166 6
d208 1
a208 1
fn=`echo $f | ${SED} "s;^${PACKAGES}/*;;g"`
d350 5
d356 13
@
1.8
log
@When using find to search for the "All" directories containing binary
packages, use -follow. Hopefully this will pick up all of the binary
packages again after the ftp.netbsd.org reorganization.
@
text
@d57 1
a57 1
cacheversion=20060203
d213 1
a213 9
# The output of pkg_info contains the dependency information first
# (from the -n) followed by all the build definitions (-B).
# To make the dependency information easier to parse later, we
# want to prefix it with DEPENDS+=. Right now the only way I see
# to figure out when the DEPENDS section ends in the pkg_info output
# is by looking for a blank line.
${PKG_INFO} -q -Bn ${f} | \
${AWK} '/^$/ {x=1; print; next;} x==0 {printf("DEPENDS+=");} {print}' \
>> ${tmpd}/${cachefile}
a307 1
echo "Generating version ${cacheversion} of the cache files."
@
1.7
log
@Fix a bug which caused the README.html generation to fail when the packages
directory did not exist. Now the generation completes with a warning that
no binary packages were found. Reported in PR pkg/32351.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.6 2005/05/24 21:48:22 dmcmahill Exp $
d57 1
a57 1
cacheversion=20050428
d213 9
a221 1
${PKG_INFO} -q -B ${f} >> ${tmpd}/${cachefile}
d316 1
d351 1
a351 1
for d in `${FIND} ${PACKAGES}/ -type d -print` ; do
@
1.6
log
@Add more error checking. PACKAGES must exist. No extra command line args taken.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.5 2005/05/24 20:56:47 dmcmahill Exp $
d8 1
a8 1
# Copyright (c) 2005 The NetBSD Foundation, Inc.
d98 3
d115 5
d337 1
a337 1
clean_and_exit1
@
1.5
log
@improve the message when an invalid cache file version is found
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.4 2005/05/24 20:49:41 dmcmahill Exp $
d321 11
@
1.4
log
@Improve error checking. Specifically, after a new cache file is
created in a temp directory, issue a warning if we fail to install
it in the package directory. If the error happens on the top
level (master) cache file, then error out. For a subdirectory,
issue a warning and drop that directory from the master cache.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.3 2005/05/22 01:36:49 dmcmahill Exp $
d176 3
a178 1
echo "${tab}Old version cache file. ${d}/${cachefile} will be regenerated."
@
1.3
log
@use find ${DIR}/ -name \*${SUFX} instead of ls ${DIR}/*${SUFX} when
generating a list of possibles packages. Avoids proglems with too long
of a command line for ls. While here change find to ${FIND}.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.2 2005/05/19 03:58:40 dmcmahill Exp $
d114 12
a126 2
all_cache_files="${all_cache_files} ${d}/${cachefile}"
d206 1
a206 1
mv ${tmpd}/${cachefile} ${d}/${cachefile}
d208 1
d211 3
a213 1
clean_and_exit1
d217 3
d233 1
a233 1
mv ${tmpd}/${cachefile} ${PACKAGES}/${cachefile}
d235 1
d238 1
d245 1
a245 1
mv ${tmpd}/${cachefile} ${PACKAGES}/${cachefile}
d247 1
d250 1
@
1.2
log
@- if the mv of the temporary cache file to the real one fails, usually
due to a directory permissions error, then error out.
- when the master cache has just been newly created, don't also report
that the master cache is up to date.
Both were suggested by Christian Hattemer.
@
text
@d3 1
a3 1
# $NetBSD: binpkg-cache,v 1.1 2005/05/17 21:46:59 dmcmahill Exp $
d48 1
d119 1
a119 1
stale_entries=`find ${d} -type f -name \*${PKG_SUFX} -newer ${d}/${cachefile} -print`
d133 3
a135 1
ls ${d}/*${PKG_SUFX} | ${SED} "s;^${PACKAGES}/*;;g" | ${SORT} > ${tmpd}/pkg_list
d301 1
a301 1
for d in `find ${PACKAGES}/ -type d -print` ; do
@
1.1
log
@Rework the README.html generation code. Major changes are:
- completely redo the code which decides on the machine architecture,
operating system, and operating system version for the binary packages.
The old way just used to directory names to take a guess. The new
way creates a cache file containing meta-data for all the binary packages
in each "All" directory. This cache file is consulted when generating
the lists of available binary packages. The meta-data is obtained with
pkg_info so it should always be correct even if you do something silly
like mix OS_VERSION or MACHINE_ARCH packages up in the same directory.
Among the benefits are: works when PACKAGES is not $PKGSRC/packages,
works with a more or less arbitrary subdirectory structure, works
when there are subdirectories for multiple operating systems.
This portion of the fix should address PR25390.
The cache files are only updated when the contents of an "All" directory
changes or if the cache file format changes. There is some room for
improving the updating of the cache files, but its not too bad the way
it is.
- fix up some of the awk code so that generadme.awk works with Solaris
nawk as well as NetBSD's nawk and gawk (for pre-2.0 systems).
- remove some "if ! foo" shell constructs to increase portability.
- be more consistent with what variables get passed to mkreadme from
make and which ones are determined automatically. Mostly this meant
moving stuff into mkreadme to make it easier to run it standalone.
@
text
@d3 1
a3 1
# $NetBSD$
d194 5
d214 7
a220 3
cp ${tmpd}/${cachefile} ${PACKAGES}/${cachefile}
fi
if ${CMP} -s ${tmpd}/${cachefile} ${PACKAGES}/${cachefile} ; then
d225 5
@