Codebase list lcalc / 4135d09
Rewrite tarball repacking Julien Puydt 5 years ago
7 changed file(s) with 25 addition(s) and 273 deletion(s). Raw diff Collapse all Expand all
0 lcalc (1.23+dfsg-8) UNRELEASED; urgency=medium
1
2 * Rewrite the tarball repacking (next release
3 will use it, if necessary).
4
5 -- Julien Puydt <jpuydt@debian.org> Sat, 11 Aug 2018 15:47:33 +0200
6
07 lcalc (1.23+dfsg-7) unstable; urgency=medium
18
29 * Refresh packaging:
00 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
11 Upstream-Name: lcalc
22 Source: http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/
3 Comment: contains spurious files, that repack.sh removes
3 Comment: garbage files
4 Files-Excluded: include/.* include/*crap include/*.bak src/.* src/Makefile.old src/libLfunction.a
45
56 Files: *
67 Copyright: Copyright (C) 2001,2002,2003,2004 Michael Rubinstein
2223 Copyright: (C) 2008, Tim Abbott <tabbott@mit.edu>
2324 (C) 2013, Tobias Hansen <thansen@debian.org>
2425 License: GPL-2+
25
26 Files: debian/repack.s*
27 Copyright: 2009, Ryan Niebur <ryan@debian.org>
28 2009-2011, gregor herrmann <gregoa@debian.org>
29 License: Artistic or GPL-1+
30 On Debian systems, the complete texts of the Artisitic and GPL are in
31 /usr/share/common-licenses/Artistic and
32 /usr/share/common-licenses/GPL
3326
3427 License: GPL-2+
3528 This program is free software; you can redistribute it and/or modify
+0
-1
debian/repack.local less more
0 rm src/libLfunction.a
+0
-169
debian/repack.sh less more
0 #!/bin/sh
1
2 # see the repack.stub for how to use
3
4 # Copyright 2009, Ryan Niebur <ryan@debian.org>
5 # Copyright 2009-2011, gregor herrmann <gregoa@debian.org>
6 # License: Artistic or GPL-1+
7
8 # TODO: provide example watch files and repack.locals
9 # TODO: test suite. problems fixed that need to be tested:
10 # * globbing
11 # * whitespace and then comments in the MANIFEST
12 # TODO: does / in weird places work? test suite too.
13 # TODO: I actually broke stuff with the MANIFEST change not thinking..
14 # TODO: allow for a sepearate (and multiple) MANIFEST files, then
15 # de-uglify libsyntax-highlight-engine-kate-perl.
16 # TODO: have each mv and rm check that something actually changed, and
17 # if not, die
18
19 set -e
20 set -u
21
22 usage() {
23 echo "Usage: repack.sh --upstream-version <ver> <downloaded file>"
24 exit 1
25 }
26
27 if [ "$#" != "3" ]; then
28 usage
29 fi
30 if [ "$1" != "--upstream-version" ]; then
31 usage
32 fi
33 if [ ! -f "$3" ]; then
34 if [ -n "$3" ]; then
35 echo "$3 doesn't exist"
36 fi
37 usage
38 fi
39 VER="$2"
40 FILE="$3"
41 PKG=`dpkg-parsechangelog|grep ^Source:|sed 's/^Source: //'`
42
43 SUFFIX="+dfsg"
44
45 echo
46 echo "Repackaging $FILE"
47 echo
48
49 DIR=`mktemp -d ./tmpRepackXXXXXX`
50 DIR=$(readlink -f "$DIR")
51 trap "/bin/rm -rf \"$DIR\"" QUIT INT EXIT
52
53 # Create an extra directory to cope with rootless tarballs
54 UP_BASE="$DIR/unpack"
55 mkdir "$UP_BASE"
56 tar xf "$FILE" -C "$UP_BASE" || unzip "$FILE" -d "$UP_BASE"
57
58 if [ `ls -1 "$UP_BASE" | wc -l` -eq 1 ]; then
59 # Tarball does contain a root directory
60 UP_BASE="$UP_BASE/`ls -1 "$UP_BASE"`"
61 fi
62
63 RM_OPTS="-vrf"
64
65 real_rm(){
66 /bin/rm "$@"
67 }
68
69 real_mv(){
70 /bin/mv "$@"
71 }
72
73 rm(){
74 set +f
75 MYOLDPWD=$(pwd)
76 cd "$UP_BASE"
77 if [ "$MANIFEST" = "1" ]; then
78 PERM=$(stat --format=%a "MANIFEST")
79 chmod u+w "MANIFEST"
80 fi
81 for i in $@; do
82 if [ "$MANIFEST" = "1" ]; then
83 PATTERN="^$i"
84 if [ -d "$i" ]; then
85 if ! { echo "$PATTERN" | grep -q "/$" ; }; then
86 PATTERN="${PATTERN}/"
87 fi
88 else
89 PATTERN="${PATTERN}\s?"
90 fi
91 grep -Ev "$PATTERN" "MANIFEST" > "$DIR/MANIFEST"
92 real_mv "$DIR/MANIFEST" "MANIFEST"
93 fi
94 real_rm "$RM_OPTS" "$i"
95 done
96 if [ "$MANIFEST" = "1" ]; then
97 chmod $PERM "MANIFEST"
98 fi
99 cd $MYOLDPWD
100 set -f
101 }
102
103 mv(){
104 set +f
105 OLD=$(pwd)
106 cd $UP_BASE
107 real_mv "$@"
108 cd $OLD
109 if [ "$MANIFEST" = "1" ]; then
110 echo "MANIFEST cannot be manipulated with mv yet, patches welcome"
111 exit 1
112 fi
113 set -f
114 }
115
116 # bump with incompatible changes
117 REPACK_VERSION=4
118
119 requires_version(){
120 if [ $REPACK_VERSION -lt $1 ]; then
121 echo "repack.sh is not up to date enough for this package. you need at least version $1, while this script is only version $REPACK_VERSION"
122 exit 1
123 fi
124 }
125
126 MANIFEST=0
127 ## Remove stuff
128 set -f
129 MYORIGPWD=$(pwd)
130 cd "$UP_BASE"
131 . "$MYORIGPWD/debian/repack.local"
132 cd $MYORIGPWD
133 set +f
134 ## End
135
136 REPACK_DIR="$PKG-${VER}${SUFFIX}.orig" # DevRef ยง 6.7.8.2
137 DFSG_TAR="$(dirname $FILE)/${PKG}_${VER}${SUFFIX}.orig.tar"
138
139 real_mv "$UP_BASE" "$DIR/$REPACK_DIR"
140
141 # .gz or .bz2?
142 FILETYPE=$(file --brief --mime-type --dereference "$FILE")
143 case "$FILETYPE" in
144 application/x-gzip|application/gzip|application/zip)
145 C_PROGRAM="gzip"
146 C_SUFFIX="gz"
147 ;;
148 application/x-bzip2|application/bzip2)
149 C_PROGRAM="bzip2"
150 C_SUFFIX="bz2"
151 ;;
152 application/x-xz|application/xz)
153 C_PROGRAM="xz"
154 C_SUFFIX="xz"
155 ;;
156 *)
157 echo "E: Unknown filetye $FILETYPE"
158 exit 1
159 ;;
160 esac
161
162 # Using a pipe hides tar errors!
163 tar cfC "$DIR/repacked.tar" "$DIR" "$REPACK_DIR"
164 $C_PROGRAM -9 < "$DIR/repacked.tar" > "$DIR/repacked.tar.$C_SUFFIX"
165
166 real_mv "$DIR/repacked.tar.$C_SUFFIX" "$DFSG_TAR.$C_SUFFIX"
167
168 echo "*** $DFSG_TAR.$C_SUFFIX ready"
+0
-91
debian/repack.stub less more
0 #!/bin/sh
1
2 : <<=cut
3 =pod
4
5 =head1 NAME
6
7 repack.stub - script to repack upstream tarballs from uscan
8
9 =head1 INSTRUCTIONS
10
11 put this in debian/repack.stub and add "debian sh debian/repack.stub" to
12 the end of the line in debian/watch. you will also need to add a version
13 mangle to debian/watch.
14
15 then create a debian/repack.local. this is a shell script that is
16 sourced under "set -e", so be careful to check returns codes.
17
18 =head1 FUNCTIONS
19
20 =over 4
21
22 =item rm
23
24 rm is replaced by a function that does some magic ("rm -rv" by default), but also changes MANIFEST if $MANIFEST is 1
25
26 =item mv
27
28 mv is replaced by a function that just does mv (by default), but also changes MANIFEST if $MANIFEST is 1
29
30 =item requires_version
31
32 requires_version is there for future usage for requiring certain versions of the script
33
34 =back
35
36 =head1 VARIABLES
37
38 =over 4
39
40 =item SUFFIX
41
42 defaults to +dfsg
43
44 what to append to the upstream version
45
46 =item RM_OPTS
47
48 defaults to -vrf
49
50 options to pass to rm
51
52 =item MANIFEST
53
54 defaults to 0, set to 1 to turn on.
55
56 this will manipulate MANIFEST files in CPAN tarballs.
57
58 =item UP_BASE
59
60 this is the directory where the upstream source is.
61
62 =back
63
64 =head1 COPYRIGHT AND LICENSE
65
66 Copyright 2009, Ryan Niebur <ryan@debian.org>
67
68 License: Artistic or GPL-1+
69
70 =cut
71
72 if [ -z "$REPACK_SH" ]; then
73 if [ -f debian/repack.sh ]; then
74 REPACK_SH=debian/repack.sh
75 fi
76 if [ -f ../../scripts/repack.sh ]; then
77 REPACK_SH=../../scripts/repack.sh
78 fi
79 if [ -z "$REPACK_SH" ] && which repack.sh > /dev/null; then
80 REPACK_SH=$(which repack.sh)
81 fi
82 fi
83
84 if [ ! -f "$REPACK_SH" ]; then
85 echo "Couldn't find a repack.sh. please put it in your PATH, put it at ../../scripts/repack.sh, or put it somewhere else and set the REPACK_SH variable"
86 echo "You can get it from http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=repack.sh;hb=HEAD"
87 exit 1
88 fi
89
90 exec "$REPACK_SH" "$@"
0 # it's cruft, not sources
1 lcalc source: source-includes-file-in-files-excluded include/.DS_Store
2 lcalc source: source-includes-file-in-files-excluded include/.Lexplicit_formula.h.swp
3 lcalc source: source-includes-file-in-files-excluded include/.Lvalue.h.swp
4 lcalc source: source-includes-file-in-files-excluded include/._.DS_Store
5 lcalc source: source-includes-file-in-files-excluded include/Lexplicit_formula.h.swap.crap
6 lcalc source: source-includes-file-in-files-excluded include/Lvalue.h.bak
7 lcalc source: source-includes-file-in-files-excluded src/.DS_Store
8 lcalc source: source-includes-file-in-files-excluded src/.Lcommandline.ggo.swp
9 lcalc source: source-includes-file-in-files-excluded src/.Makefile.old.swp
10 lcalc source: source-includes-file-in-files-excluded src/._.DS_Store
11 lcalc source: source-includes-file-in-files-excluded src/Makefile.old
00 version=4
1 opts=dversionmangle=s/\+dfsg$// \
2 http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/L-(.+).tar.gz \
3 debian sh debian/repack.stub
1 opts=\
2 repacksuffix=+dfsg,\
3 dversionmangle=s/\+dfsg$// \
4 http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/L-(.+).tar.gz