r10334 - /man-cgi/static-repository/bin/make-manpage-repo.sh
Author: jfs
Date: Wed Nov 6 21:11:53 2013
New Revision: 10334
URL: http://svn.debian.org/wsvn/?sc=1&rev=10334
Log:
- Load configuration file using absolute location
- Add support for DEBUG variable
- To reduce memory use, generate the compressed package list in a file and then read it
Modified:
man-cgi/static-repository/bin/make-manpage-repo.sh
Modified: man-cgi/static-repository/bin/make-manpage-repo.sh
URL: http://svn.debian.org/wsvn/man-cgi/static-repository/bin/make-manpage-repo.sh?rev=10334&op=diff
==============================================================================
--- man-cgi/static-repository/bin/make-manpage-repo.sh (original)
+++ man-cgi/static-repository/bin/make-manpage-repo.sh Wed Nov 6 21:11:53 2013
@@ -25,7 +25,26 @@
# License can be found in /usr/share/common-licenses/GPL-3
###############################################################################
-. ./config
+ME=$0
+MYDIR="`dirname $ME`"
+
+. ${MYDIR}/config
+
+# Setup temporary dir
+if [ -n "$TEMPDIR" ] ; then
+ mkdir -p $TEMPDIR
+ if [ ! -e "$TEMPDIR" ] ; then
+ printf "%s\n" "ERROR: Cannot create temporary directory $TEMPDIR"
+ exit 1
+ fi
+ if [ ! -w "$TEMPDIR" ] ; then
+ printf "%s\n" "ERROR: Temporary directory $TEMPDIR is not writable"
+ exit 1
+ fi
+ TMPDIR="$TEMPDIR"
+ export TMPDIR
+fi
+
# Establish some locking, to keep multiple updates from running
mkdir -p "$PUBLIC_HTML_DIR/manpages"
@@ -46,12 +65,12 @@
return 0
fi
deb="$1"
- #printf "%s\n" "INFO: Looking at package [$deb]"
+ [ -n "$DEBUG" ] && printf "%s\n" "INFO: Looking at package [$deb]"
name=`basename "$deb" | awk -F_ '{print $1}'`
cache_modtime=`stat -c %Y "$PUBLIC_HTML_DIR/manpages/$dist/.cache/$name" 2>/dev/null || printf "0"`
deb_modtime=`stat -c %Y "$DEBDIR/$deb"`
if [ "$cache_modtime" -ge "$deb_modtime" ]; then
- #printf "%s\n" "INFO: Skipping non-updated package [$DEBDIR/$deb]"
+ [ -n "$DEBUG" ] && printf "%s\n" "INFO: Skipping non-updated package [$DEBDIR/$deb]"
return 1
else
return 0
@@ -61,7 +80,7 @@
handle_deb() {
dist="$1"
deb="$2"
- pkg_updated "$deb" && ./fetch-man-pages.sh "$dist" "$deb" || true
+ pkg_updated "$deb" && ${MYDIR}/fetch-man-pages.sh "$dist" "$deb" || true
}
link_en_locale() {
@@ -95,11 +114,15 @@
mkdir -p "$PUBLIC_HTML_DIR/manpages/$dist/.cache" "$PUBLIC_HTML_DIR/manpages.gz/$dist" || true
link_en_locale "$dist"
for repo in $REPOS; do
- zcat "$DEBDIR/dists/$dist/$repo/binary-$ARCH/Packages.gz" | grep "^Filename:.*\.deb$" | awk '{print $2}' | sort -u | \
+ deblist=`tempfile -d $TEMPDIR --prefix=package-list` || { echo "ERROR: Cannot Create temporary file! " >&2; exit 1; }
+ [ -n "$DEBUG" ] && printf "%s\n" "INFO: Extracting package list to temporafy file $deblist"
+ zcat "$DEBDIR/dists/$dist/$repo/binary-$ARCH/Packages.gz" | grep "^Filename:.*\.deb$" | awk '{print $2}' | sort -u >$deblist
+ cat $deblist |
while read deb; do
handle_deb "$dist" "$deb"
done
+ rm $deblist
done
done
-./make-sitemaps.sh
+${MYDIR}/make-sitemaps.sh
Reply to: