Commits

Piotr Findeisen  committed 41dd18d

scripts and source separated

  • Participants
  • Parent commits e019245

Comments (0)

Files changed (7)

 all:: update_version
 
 
-ADDDEPS := src/make-wrapper.sh src/gzip-wrapper.sh src/version.py src/helpers.py
+ADDDEPS := src/version.py src/helpers.py
 
 build/unihistext: src/unihistext src/unihistext.py $(ADDDEPS)
 all:: build/unihistext
 
 build/uninormalize build/unihistext:
 	mkdir -p `dirname $@`
-	#{ cd src && ./make-wrapper.sh unihistext ; } > $@
-	./src/make-wrapper.sh $^ > $@
+	./scripts/make-wrapper.sh $^ > $@
 	chmod +x $@
 
 update_version: $(TMPVERSIONFILE)
 .PHONY: $(TMPVERSIONFILE)
 
 $(TMPVERSIONFILE) src/version.py:
-	{ echo "version = \"unknown\""; cd src && ./version-gen.sh | sed -e "s/^.*\$$/version = \"&\"/"; } > $@
+	{ echo "version = \"unknown\""; ./scripts/version-gen.sh | sed -e "s/^.*\$$/version = \"&\"/"; } > $@
 #.PHONY: src/version.py
 
 clean:

File scripts/gzip-wrapper.sh

+#!/bin/bash
+die() { echo "$0: $@" >&2; exit 1; }
+program=__PROGNAME__
+dir=/tmp/.wrap.__SHA1__.`whoami`.`hostname`
+if ! test -d $dir; then
+    rm -rf $dir || die "Can't remove $dir"
+    mkdir $dir || die "Can't create $dir/"
+    cat $0 | { while :; do read -r l || die "Read failed"; [ "$l" = "EOF" ] && break; done; cat; } | tar zxf - -C $dir || die "Unpacking failed"
+fi
+exec $dir/$program "$@"
+EOF

File scripts/make-wrapper.sh

+#!/bin/bash -e
+
+program=$1
+shift
+#files=$@
+
+wrapper=`dirname $0`/gzip-wrapper.sh
+tmp="/tmp/`basename $0`-$$"
+tgz="$tmp.tgz"
+out="$tmp.out"
+csf="$tmp.csf"
+
+tar czvf "$tgz" "$program" "$@" >&2
+{ cat "$tgz" "$wrapper"; } > "$csf"
+sha=`sha1sum "$csf" | awk '{print $1}'`
+
+cat "$wrapper" | \
+    sed -e "s@__PROGNAME__@$program@1" \
+	-e "s@__SHA1__@$sha@1" \
+    > "$out"
+cat "$tgz" >> "$out"
+cat "$out"
+rm -f "$tgz" "$out" "$csf"

File scripts/version-gen.sh

+#!/bin/bash
+
+git describe --always 2>/dev/null | grep -qE . || exit 1
+ver=`git describe --always`
+
+git update-index -q --refresh
+test -z "$(git diff-index --name-only HEAD --)" || ver="$ver-dirty"
+ver=$(echo "$ver" | sed -e 's/-/./g' | sed -e 's/^v//');
+echo $ver

File src/gzip-wrapper.sh

-#!/bin/bash
-die() { echo "$0: $@" >&2; exit 1; }
-program=__PROGNAME__
-dir=/tmp/.wrap.__SHA1__.`whoami`.`hostname`
-if ! test -d $dir; then
-    rm -rf $dir || die "Can't remove $dir"
-    mkdir $dir || die "Can't create $dir/"
-    cat $0 | { while :; do read -r l || die "Read failed"; [ "$l" = "EOF" ] && break; done; cat; } | tar zxf - -C $dir || die "Unpacking failed"
-fi
-exec $dir/$program "$@"
-EOF

File src/make-wrapper.sh

-#!/bin/bash -e
-
-program=$1
-shift
-#files=$@
-
-wrapper=`dirname $0`/gzip-wrapper.sh
-tmp="/tmp/`basename $0`-$$"
-tgz="$tmp.tgz"
-out="$tmp.out"
-csf="$tmp.csf"
-
-tar czvf "$tgz" "$program" "$@" >&2
-{ cat "$tgz" "$wrapper"; date; hostname; } > "$csf"
-sha=`sha1sum "$csf" | awk '{print $1}'`
-
-cat "$wrapper" | \
-    sed -e "s@__PROGNAME__@$program@1" \
-	-e "s@__SHA1__@$sha@1" \
-    > "$out"
-cat "$tgz" >> "$out"
-cat "$out"
-rm -f "$tgz" "$out" "$csf"

File src/version-gen.sh

-#!/bin/bash
-
-git describe --always 2>/dev/null | grep -qE . || exit 1
-ver=`git describe --always`
-
-git update-index -q --refresh
-test -z "$(git diff-index --name-only HEAD --)" || ver="$ver-dirty"
-ver=$(echo "$ver" | sed -e 's/-/./g' | sed -e 's/^v//');
-echo $ver