summaryrefslogtreecommitdiffstats
path: root/scripts/inspect.in
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2006-01-14 18:44:11 +0000
committerAndreas Gruenbacher <agruen@suse.de>2006-01-14 18:44:11 +0000
commit5e61a8bda30e96bef5a1c6e265f4d6d19695102d (patch)
tree2744d8a7548af767ae1e71fad5063f5590f20f85 /scripts/inspect.in
parentb73c8212ecca40dffaa1cad31693fc25fc63eab2 (diff)
downloadquilt-5e61a8bda30e96bef5a1c6e265f4d6d19695102d.tar.gz
- Move scripts directory to quilt/scripts to simplify running quilt
directly from the source tree. - test/Makefile: merge into Makefile.in (target check). - Makefile.in: clean up.
Diffstat (limited to 'scripts/inspect.in')
-rw-r--r--scripts/inspect.in202
1 files changed, 0 insertions, 202 deletions
diff --git a/scripts/inspect.in b/scripts/inspect.in
deleted file mode 100644
index d318ad2..0000000
--- a/scripts/inspect.in
+++ /dev/null
@@ -1,202 +0,0 @@
-#! @BASH@
-
-# This script is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# See the COPYING and AUTHORS files for more details.
-
-: ${LIB=@LIB@} ${QUILT=@QUILT@}
-
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-cd ${SUBDIR:-.}
-
-usage() {
- echo "Usage: ${0##*/} specfile"
- exit 1
-}
-
-if [ "$1" = -v ]
-then
- verbose=1
- shift
-fi
-
-specfile=$1
-if [ $# -ne 1 -o ! -f "$specfile" ]
-then
- usage
-fi
-
-if [ "${specfile:0:1}" != / ]
-then
- specfile="$PWD/$specfile"
-fi
-sourcedir=${specfile%/*}
-
-tmpdir="$(gen_tempfile -d ${TMPDIR-/var/tmp}/${0##*/})"
-mkdir -p $tmpdir || exit 1
-trap "rm -rf $tmpdir" EXIT
-mkdir -p $tmpdir/build
-mkdir -p $tmpdir/bin
-
-# Redirect file descriptors
-if [ -n "$verbose" ]
-then
- exec 3>&1 4>/dev/null
-else
- exec 3>&1 4>&2 2>/dev/null
-fi
-
-# create md5 sums, also for uncompressed files
-echo -n "### md5sum: " >&4
-shopt -s nullglob
-for file in *
-do
- file=${file##*/}
- case "$file" in
- ready|bigpack|MD5SUMS|MD5SUMS.meta|*.spec|*.changes)
- continue
- ;;
- esac
- [ -f "$file" ] || continue
- echo -n "." >&4
- echo "md5sum < $file" >&2
- set -- $(md5sum < "$file")
- echo "$1 $file"
- case "$(file -b "$file")" in
- compress*|gzip*)
- echo -n "g" >&4
- echo "md5sum < <(gzip -cd $file)" >&2
- set -- $(gzip -cd "$file" | md5sum)
- echo "$1 $file"
- ;;
- bzip2*)
- echo -n "b" >&4
- echo "md5sum < <(bzip2 -cd $file)" >&2
- set -- $(bzip2 -cd "$file" | md5sum)
- echo "$1 $file"
- ;;
- esac
-done > $tmpdir/md5sums
-echo >&4
-shopt -u nullglob
-
-# wrapper script for patch and tar
-cat <<-'EOF' > $tmpdir/bin/wrapper
- #! @BASH@
-
- # find original data file by md5sum
- original_file() {
- local file=$1 md5sum
-
- set -- $(md5sum < $file)
- md5sum=$1
- while read md5sum_ file_
- do
- if [ $md5sum = $md5sum_ ]
- then
- echo $file_
- return 0
- fi
- done < $tmpdir/md5sums
-
- # Try harder
- if ! [ -e $tmpdir/more-md5sums ]
- then
- ( cd $RPM_BUILD_DIR
- find . -type f \
- | sed -e 's:^.\/::' \
- | xargs md5sum \
- ) > $tmpdir/more-md5sums
- fi
-
- while read md5sum_ file_
- do
- if [ $md5sum = $md5sum_ ]
- then
- echo $file_
- return 0
- fi
- done < $tmpdir/more-md5sums
-
- return 1
- }
-
- # Extract the -p option from the command line
- strip_option() {
- while [ $# -ne 0 -a "${1:0:2}" != -p ]
- do
- shift
- done
- if [ "${1:0:2}" = -p ]
- then
- [ "$1" = -p ] && set -- "$1$2"
- [ "$1" != -p1 ] && echo $1
- fi
- }
-
- for file in "$@"; do
- if [ -e "${file#-i}" ]; then
- inputfile=${file#-i}
- break
- fi
- done
- tmpdir=${RPM_BUILD_DIR%/*}
- rm -f $tmpdir/data
- if [ -z "$inputfile" ]; then
- # put data from stdin into tmpfile
- cat > $tmpdir/data
- fi
-
- unpackfile="$(original_file ${inputfile:-$tmpdir/data})"
- if [ -n "$unpackfile" ]
- then
- dir=${PWD/$RPM_BUILD_DIR}
- dir=${dir##/}
-
- case "${0##*/}" in
- patch)
- echo -n p >&4
- echo "${0##*/} ${dir:-.} $unpackfile" \
- $(strip_option "$@") >&3
- ;;
- tar)
- echo -n t >&4
- echo "${0##*/} ${dir:-.} $unpackfile" >&3
- ;;
- esac
- fi
-
- PATH=${PATH#*:}
- if [ -n "$inputfile" ]; then
- ${0##*/} "$@"
- else
- ${0##*/} "$@" < $tmpdir/data
- fi
-EOF
-chmod 755 $tmpdir/bin/wrapper
-ln -s wrapper $tmpdir/bin/patch
-ln -s wrapper $tmpdir/bin/tar
-
-# let rpm do all the dirty specfile stuff ...
-echo -n "### rpmbuild: " >&4
-
-export PATH="$tmpdir/bin:$PATH"
-rpmbuild --eval "%define _sourcedir $sourcedir" \
- --eval "%define _specdir $sourcedir" \
- --eval "%define _builddir $tmpdir/build" \
- --nodeps \
- -bp "$specfile" < /dev/null >&2
-status=$?
-echo >&4
-exit $status
-### Local Variables:
-### mode: shell-script
-### End:
-# vim:filetype=sh