2 if [ $(basename $0) = lib ];then
3 make -C debian/scripts sh.vars
4 . debian/scripts/sh.vars
9 eval echo $(sed -ne "s/^$(BASENAME):$msg://p" debian/scripts/messages)
12 echo -n "$(fetchmsg START "$@") "
21 fetchmsg ALREADY_DONE "$@"
31 if [ x$base = x ];then
32 echo "Danger, Will Robinson, Danger!" 1>&2
33 echo "Bash is very confused." 1>&2
36 if [ x$base = xlib ];then
37 echo "You can't call this directly." 1>&2
38 echo "This is a library that should be sourced." 1>&2
44 $(decompress_prog $1) $1
53 [ $1 != ${1%.tgz} -o $1 != ${1%.gz} -o $1 != ${1%.Z} ] && which="gunzip -c"
54 [ $1 != ${1%.bz2} ] && which="bunzip2 -c"
55 [ $1 != ${1%.bz} ] && which="bunzip -c"
61 [ $1 != ${1%.gz} ] && which=gz
62 [ $1 != ${1%.Z} ] && which=Z
63 [ $1 != ${1%.bz2} ] && which=bz2
64 [ $1 != ${1%.bz} ] && which=bz
70 f=$(echo "$1" | sed 's|:::.*||')
71 [ $f != ${f%.jar} ] && which=jarfile
72 [ $f != ${f%.zip} ] && which=zipfile
73 [ $f != ${f%.tgz} ] && which=tarball
74 [ $f != ${f%.tar.$(compress_ext $f)} ] && which=tarball
75 [ $f != ${f%.tar} ] && which=tarball
76 [ $f != ${f%.diff.$(compress_ext $f)} -o $1 != ${1%.patch.$(compress_ext $1)} ] && which=patch
77 [ $f != ${f%.diff} -o $1 != ${1%.patch} ] && which=patch
78 [ $f != ${f%.dsc} ] && which=dsc
82 local which file dir curd
88 [ "$file" = "${1#/}" ] && file="$curd/$file"
89 case "$(filetype_detect $file)" in
90 "jarfile") (cd $dir;fastjar -xf $file);;
91 "zipfile") (cd $dir;miniunzip -x $file);;
92 "tarball") $(decompress_prog $file) $file | (cd $dir;tar xvf -);;
93 *) echo "unsupported tarball";;
106 mkdir -p $SOURCE_DIR/$TAR_DIR
107 patch_dirs="$SRC_PATCH_DIR $SRC_ADD_PATCH_DIR"
108 stampfiletmpl=\$STAMP_DIR/\$d/\$f
109 logtmpl=\$STAMP_DIR/log/\$d/\$f
110 dirprep="\$STAMP_DIR/log/\$d \$STAMP_DIR/\$d"
111 patchapplydirtmpl=\$SOURCE_DIR/\$TAR_DIR
114 mkdir -p $SOURCE_DIR/$TAR_DIR $STAMP_DIR/patches
115 patch_dirs="$PATCH_DIR $ADD_PATCH_DIR"
116 stampfiletmpl=\$STAMP_DIR/patches/\$f
117 logtmpl=\$STAMP_DIR/log/\$d/\$f
118 dirprep=\$STAMP_DIR/log/\$d
119 patchapplydirtmpl=\$SOURCE_DIR/\$TAR_DIR
122 if [ "$DBS_UNIFIED" -o ! -e debian/fixpatch ];then
125 mkdir -p $STAMP_DIR/fixpatch
126 patch_dirs=debian/fixpatch
127 stampfiletmpl="$STAMP_DIR/fixpatch/\$(basename \$f)"
128 logtmpl=\$STAMP_DIR/log/fixpatch/\$f
129 dirprep=\$STAMP_DIR/log/fixpatch
130 patchapplydirtmpl=upstream
133 if [ "$DBS_UNIFIED" -o ! -e debian/fixpatch ];then
136 mkdir -p $STAMP_DIR/fixpatch
137 patch_dirs=debian/fixpatch
138 stampfiletmpl="$STAMP_DIR/fixpatch/\$(basename \$f)"
139 logtmpl=\$STAMP_DIR/log/fixpatch/\$f
140 dirprep=\$STAMP_DIR/log/fixpatch
141 patchapplydirtmpl=upstream
146 for d in $patch_dirs;do
150 eval mkdir -p $dirprep
151 for f in `(cd $d >/dev/null;find -type f ! -name 'chk-*' 2>/dev/null )|sort $reversesort`;do
152 eval stampfile=$stampfiletmpl
155 eval patchapplydir=$patchapplydirtmpl
156 if [ ! -e $stampfile ];then
158 if file2cat $file | (cd $patchapplydir;patch -p1 $reversepatch) > $log;then
173 # External api functions.
177 if [ "$DBS_UNIFIED" ];then
180 rm -rf $SOURCE_DIR $STAMP_DIR/upstream $STAMP_DIR/patches
181 rm -f $STAMP_DIR/{source.{clean,build,make}}
183 if [ x$SOURCE_DIR = x ];then
184 files=`find -type f -maxdepth 1 -mindepth 1`
185 dirs=`find -type d -maxdepth 1 -mindepth 1 ! -name 'debian' ! -name 'upstream'`
186 echo files=\"$files\"
191 source.patch() { cmd=source.patch; do.patching; }
192 fix.source.patch() { cmd=fix.source.patch; do.patching; }
193 unfix.source.patch() { cmd=unfix.source.patch; do.patching; }
194 patch.apply() { cmd=patch.apply; do.patching; }
196 if [ $(basename $0) = lib ];then