]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm-compress-doc
- rel 0.snap.20.9 (sic!) for ac
[packages/rpm.git] / rpm-compress-doc
index 0f75bb4054dbbd07b08bb3239ba8a1c6c419fb27..766649dc304f647b406ab49eb537720ddb75fdae 100644 (file)
@@ -3,20 +3,35 @@
 # Compress documentation files found in $DOCDIR. Omit some files we don't
 # want to get compressed.
 #
-# $RPM_BUILD_DIR/__rpm_noautocompressdoc can contain whitespace delimated
-# list of patters to ommit.
+# /etc/rpm/noautocompressdoc and --noautocompressdoc= option can contain
+# whitespace delimated list of patters to omit.
 #
 
 #set -x
 
 COMPRESS_CMD="gzip -9nf"
-EXCLUDE_SUFFIXES="htm html jpg jpeg png gif pdf"
+EXCLUDE_SUFFIXES="htm html jpg jpeg png gif pdf css dia js HTM JPG PNG GIF PDF CSS JS"
 EXCLUDE_MASKS=
 RECOMPRESS_BZIP2=yes
 
-if test -f $RPM_BUILD_DIR/__rpm_noautocompressdoc ; then
-       EXCLUDE_MASKS=$(cat $RPM_BUILD_DIR/__rpm_noautocompressdoc | \
-                       xargs echo | sed -e 's/^ *//; s/ *$//; s/ \+/|/g')
+nocompressdoc=''
+while [ $# -gt 0 ]; do
+       case "$1" in
+         --noautocompressdoc=*)
+               EXCLUDE_MASKS=`echo "${1#--noautocompressdoc=}" | sed -e 's/^ *//;s/ *$//;s/ \+/|/g'`
+       esac
+       shift
+done
+
+if [ -r /etc/rpm/noautocompressdoc ]; then
+       exclude=$(cat /etc/rpm/noautocompressdoc | grep -v '^#' | xargs echo | sed -e 's/^ *//;s/ *$//;s/ \+/|/g')
+       if [ -n "${exclude}" ]; then
+               if [ -n "${EXCLUDE_MASKS}" ]; then
+                       EXCLUDE_MASKS="${EXCLUDE_MASKS}|${exclude}"
+               else
+                       EXCLUDE_MASKS="${exclude}"
+               fi
+       fi
 fi
 
 if [ "$DOCDIR" = "" ] ; then
@@ -34,10 +49,10 @@ fi
 
 FIND_CMD="find . -type f "
 for SUF in $EXCLUDE_SUFFIXES ; do
-       FIND_CMD="$FIND_CMD -a -not -name *.$SUF"
+       FIND_CMD="$FIND_CMD -a -not -name '*.$SUF'"
 done
 
-$FIND_CMD | while read FILENAME ; do
+eval $FIND_CMD | while read FILENAME ; do
        if test -n "$EXCLUDE_MASKS" ; then
                if eval "case \$(basename \"$FILENAME\") in
                         $EXCLUDE_MASKS ) true ;;
This page took 0.10227 seconds and 4 git commands to generate.