summaryrefslogtreecommitdiff
path: root/mk/scripts
diff options
context:
space:
mode:
authordmcmahill <dmcmahill@pkgsrc.org>2005-05-24 20:49:41 +0000
committerdmcmahill <dmcmahill@pkgsrc.org>2005-05-24 20:49:41 +0000
commite091685f10b519509bdf7b7cab0314b10376d57b (patch)
treea77d3eee19011911ea82ef1140f85a9cb66c989f /mk/scripts
parent203d5f8ff857e79c678c86be41440c1292187908 (diff)
downloadpkgsrc-e091685f10b519509bdf7b7cab0314b10376d57b.tar.gz
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.
Diffstat (limited to 'mk/scripts')
-rwxr-xr-xmk/scripts/binpkg-cache34
1 files changed, 27 insertions, 7 deletions
diff --git a/mk/scripts/binpkg-cache b/mk/scripts/binpkg-cache
index 77a7e0d142c..b52ff9ad586 100755
--- a/mk/scripts/binpkg-cache
+++ b/mk/scripts/binpkg-cache
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: binpkg-cache,v 1.3 2005/05/22 01:36:49 dmcmahill Exp $
+# $NetBSD: binpkg-cache,v 1.4 2005/05/24 20:49:41 dmcmahill Exp $
#
# Script for generating a cache file with information about
# all binary packages contained in a directory.
@@ -111,9 +111,19 @@ clean_and_exit1(){
all_cache_files=""
-process_binpkg_dir(){
- all_cache_files="${all_cache_files} ${d}/${cachefile}"
+#############################################################################
+#
+# 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(){
need_update=no
if test -f ${d}/${cachefile} ; then
stale_entries=`${FIND} ${d} -type f -name \*${PKG_SUFX} -newer ${d}/${cachefile} -print`
@@ -193,14 +203,20 @@ process_binpkg_dir(){
${PKG_INFO} -q -B ${f} >> ${tmpd}/${cachefile}
echo "pkgcache_end ${fn}" >> ${tmpd}/${cachefile}
done
- mv ${tmpd}/${cachefile} ${d}/${cachefile}
+ 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}?"
- clean_and_exit1
+ echo "This directory will be dropped from the master cache file."
+ echo "********** WARNING **********"
+ return
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}"
}
@@ -214,20 +230,24 @@ process_cache_files(){
fi
if test ! -f ${PACKAGES}/${cachefile} ; then
echo "${tab}Creating master cache file ${PACKAGES}/${cachefile}"
- mv ${tmpd}/${cachefile} ${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 ${tmpd}/${cachefile} ${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