1 | #!/bin/sh |
---|
2 | # |
---|
3 | # See COPYRIGHT |
---|
4 | # |
---|
5 | # Script to create a release or shapshot archive. |
---|
6 | # Also checks for very basic inconsistences. |
---|
7 | # Expects that it would be run from the current directory of ttf2pt1, |
---|
8 | # and that the parent directory is the place to create archives. |
---|
9 | # Expects that the CVS environment variables are set properly. |
---|
10 | |
---|
11 | VER=`grep TTF2PT1_VERSION version.h | cut -d\" -f2` |
---|
12 | |
---|
13 | case "$1" in |
---|
14 | snapshot) |
---|
15 | echo "$VER" | egrep '^[0-9][0-9]*\.[0-9].*-CURRENT$' || { |
---|
16 | echo "mkrel: version.h must contain *-CURRENT to create a snapshot" >&2 |
---|
17 | exit 1 |
---|
18 | } |
---|
19 | grep "^current$" CHANGES.html >/dev/null || { |
---|
20 | echo "mkrel: CHANGES.html must list 'current' to create a snapshot" >&2 |
---|
21 | exit 1 |
---|
22 | } |
---|
23 | snapdate=`date "+ %y %m %d " | sed 's/ \([0-9]\) / 0& /g;s/ //g'` |
---|
24 | NEWVER=`echo "$VER" | sed "s/-CURRENT/-SNAP-$snapdate/"` |
---|
25 | TAG="-D tomorrow" |
---|
26 | ;; |
---|
27 | release) |
---|
28 | echo "$VER" | egrep '^[0-9][0-9]*\.[0-9][.0-9]*$' || { |
---|
29 | echo "mkrel: version.h must not be -CURRENT to create a release" >&2 |
---|
30 | exit 1 |
---|
31 | } |
---|
32 | grep "^$VER -- " CHANGES.html >/dev/null || { |
---|
33 | echo "mkrel: CHANGES.html must list the same version as version.h" >&2 |
---|
34 | exit 1 |
---|
35 | } |
---|
36 | NEWVER="$VER" |
---|
37 | TAG=`echo "-r ttf2pt1-$VER" | sed \ |
---|
38 | 's/\(-[0-9][0-9]*\.[0-9]\)$/&.0/;s/\./-/g'` |
---|
39 | ;; |
---|
40 | *) |
---|
41 | echo "use: mkrel [snapshot|release]" >&2 |
---|
42 | exit 1 |
---|
43 | ;; |
---|
44 | esac |
---|
45 | |
---|
46 | cd .. || { |
---|
47 | echo "mkrel: can't cd to .." >&2 |
---|
48 | exit 1 |
---|
49 | } |
---|
50 | |
---|
51 | rm -f ttf2pt1-$NEWVER.tgz ttf2pt1-$NEWVER.zip |
---|
52 | rm -rf ttf2pt1-$NEWVER |
---|
53 | |
---|
54 | echo "cvs -z9 export $TAG -d ttf2pt1-$NEWVER ttf2pt1" |
---|
55 | cvs -z9 export $TAG -d ttf2pt1-$NEWVER ttf2pt1 || { |
---|
56 | echo "mkrel: unable to export from CVS" >&2 |
---|
57 | echo "mkrel: check that the CVS tree is properly tagged" >&2 |
---|
58 | exit 1 |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | # a little bit more for snapshot: correct the version |
---|
63 | ( |
---|
64 | case "$1" in |
---|
65 | snapshot) |
---|
66 | cd ttf2pt1-$NEWVER || { |
---|
67 | echo "mkrel: can't cd to ../ttf2pt1-$NEWVER" >&2 |
---|
68 | exit 1 |
---|
69 | } |
---|
70 | |
---|
71 | sed "s/^current\$/$NEWVER/" <CHANGES.html >CHANGES.html.new \ |
---|
72 | && mv CHANGES.html.new CHANGES.html || { |
---|
73 | echo "mkrel: can't update CHANGES.html" >&2 |
---|
74 | exit 1 |
---|
75 | } |
---|
76 | |
---|
77 | sed "s/\".*-CURRENT\"/\"$NEWVER\"/" <version.h >version.h.new \ |
---|
78 | && mv version.h.new version.h || { |
---|
79 | echo "mkrel: can't update version.h" >&2 |
---|
80 | exit 1 |
---|
81 | } |
---|
82 | ;; |
---|
83 | esac |
---|
84 | ) |
---|
85 | |
---|
86 | # generate the man pages - in case if the users would have no pod2man |
---|
87 | ( |
---|
88 | cd ttf2pt1-$NEWVER || { |
---|
89 | echo "mkrel: can't cd to ../ttf2pt1-$NEWVER" >&2 |
---|
90 | exit 1 |
---|
91 | } |
---|
92 | |
---|
93 | make mans |
---|
94 | ) |
---|
95 | |
---|
96 | tar czvf ttf2pt1-$NEWVER.tgz ttf2pt1-$NEWVER || { |
---|
97 | echo "mkrel: can't create .tgz archive" >&2 |
---|
98 | exit 1 |
---|
99 | } |
---|
100 | |
---|
101 | zip -u -r ttf2pt1-$NEWVER.zip ttf2pt1-$NEWVER || { |
---|
102 | echo "mkrel: can't create .zip archive" >&2 |
---|
103 | exit 1 |
---|
104 | } |
---|