File: repack

package info (click to toggle)
tth 4.03%2Bds-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,088 kB
  • sloc: xml: 291; makefile: 170; sh: 164; ansic: 131
file content (135 lines) | stat: -rwxr-xr-x 3,461 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/sh

PACKAGE_NAME=tth

set -e
set -u

usage() {
	echo "Usage: repack --upstream-version <ver> <downloaded file>"
	exit 1
	}

if [ "$#" != "3" ]; then
	usage
fi
if [ "$1" != "--upstream-version" ]; then
	usage
fi
if [ ! -f "$3" ]; then
	if [ -n "$3" ]; then
		echo "$3 doesn't exist"
	fi
	usage
fi
UPSTREAM_VERSION="$2"
UPSTREAM_TARBALLZZ="$3"

DEBIAN_SUFFIX="+ds"

DEBIAN_UVERSION=${UPSTREAM_VERSION}${DEBIAN_SUFFIX}
DEBIAN_ROOTFOLDERNAME="${PACKAGE_NAME}-${DEBIAN_UVERSION}.orig"
DEBIAN_TARBALLXZ="$(dirname $UPSTREAM_TARBALLZZ)/${PACKAGE_NAME}_${DEBIAN_UVERSION}.orig.tar.xz"

REPACK_TMPDIR=`mktemp -d ./repackXXXXXX`
REPACK_TMPDIR=$(readlink -f "$REPACK_TMPDIR")
trap "/bin/rm -rf \"$REPACK_TMPDIR\"" QUIT INT EXIT

message() {
	echo
	echo "-- -- $1"
	echo
	}

message "Repackaging $UPSTREAM_TARBALLZZ"

UPSTREAM_ROOTFOLDER="${REPACK_TMPDIR}/unpacked"
mkdir "${UPSTREAM_ROOTFOLDER}"
tar -C "${UPSTREAM_ROOTFOLDER}" -xf "${UPSTREAM_TARBALLZZ}" || unzip -d "${UPSTREAM_ROOTFOLDER}" "${UPSTREAM_TARBALLZZ}"
if [ `ls -1 "${UPSTREAM_ROOTFOLDER}" | wc -l` -eq 1 ]; then
	UPSTREAM_ROOTFOLDER="${UPSTREAM_ROOTFOLDER}/`ls -1 "${UPSTREAM_ROOTFOLDER}"`"
fi

DEBIAN_ROOTFOLDER="${REPACK_TMPDIR}/${DEBIAN_ROOTFOLDERNAME}"
## repack
set -f
REPACK_WORKING_FOLDER=$(pwd)
cd "${UPSTREAM_ROOTFOLDER}"

####. "${REPACK_WORKING_FOLDER}/debian/repack.local"

rm --verbose --force --recursive tthfunc tthgif TtMdir ttmC tth-gui

find . \( \
		-name '*.bat' -o \
		-name '*.lnk' -o \
		-name '*.tlg' -o \
		-name '*.log' -o \
		-name '*.ilg' -o \
		-name '*.idx' -o \
		-name '*.toc' -o \
		-name '*.aux' -o \
		-name '*.dvi' -o \
		-name '*.bak' -o \
		-name '*.res' -o \
		-name '*.exe' -o \
		-name '*~' \
		\) \
	-print -delete

find . \( \
		-wholename './manual/split/*.html' \
		\) \
	-print -delete

rm --verbose --force manual/ttm_manual.tex
rm --verbose --force manual/mozilla.tex

rm --verbose --force ttmL/ttm.gif ttmL/ttm_icon.gif ttmL/ttm_mini.gif
rm --verbose --force ttmL/ttm ttmL/ps2gif ttmL/ps2png ttmL/latex2gif
rm --verbose --force ttmL/ttm_manual.html
rm --verbose --force ttmL/ttm.kdelnk
rm --verbose --force ttmL/uninstall ttmL/ttminstall

rm --verbose --force --recursive tthgold/golddesc
rm --verbose --force tthgold/tthsplit.c
rm --verbose --force tthgold/tthsplit tthgold/tthrfcat
rm --verbose --force tthgold/latex2gif
rm --verbose --force tthgold/tth tthgold/tth.c tthgold/tth.1
rm --verbose --force tthgold/tth.gif tthgold/tth_icon.bmp
rm --verbose --force tthgold/tthntbib.sty
rm --verbose --force tthgold/tth_man.html tthgold/gold_man.html
rm --verbose --force tthgold/tth_man.tex

rm --verbose --force tools/ps2gif_transparent
rm --verbose --force tools/structure tools/numbering
rm --verbose --force tools/choice.c

rm --verbose --force latex2gif ps2gif transfer
rm --verbose --force tth16.png tth32.png tth_screen.gif

rmdir --verbose --ignore-fail-on-non-empty tars

cd ${REPACK_WORKING_FOLDER}
set +f
## end
mv "${UPSTREAM_ROOTFOLDER}" "${DEBIAN_ROOTFOLDER}"

REPACK_TARBALL="${REPACK_TMPDIR}/repacked.tar"
REPACK_TARBALLXZ="${REPACK_TARBALL}.xz"
tar -C "${REPACK_TMPDIR}" -cf "${REPACK_TARBALL}" "${DEBIAN_ROOTFOLDERNAME}"
xz -9e < "${REPACK_TARBALL}" > "${REPACK_TARBALLXZ}"
mv "${REPACK_TARBALLXZ}" "${DEBIAN_TARBALLXZ}"

message "Testing ${DEBIAN_TARBALLXZ}"

xz --verbose --test "${DEBIAN_TARBALLXZ}"

message "Printing information about ${DEBIAN_TARBALLXZ}"

xz --verbose --list "${DEBIAN_TARBALLXZ}"

message "Quitting"

##
## eos