/
release
executable file
·178 lines (148 loc) · 4.72 KB
/
release
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/bin/zsh
project="pkgbuilder"
projectc="PKGBUILDer"
aurcat="system"
version=$1
if [[ $version = '' ]]; then
echo 'Version number?'
echo -n '> '
read version
fi
rm -rf $project.egg-info __pycache__ $project/__pycache__ dist build
date=$(date '+%Y-%m-%d')
datel=$(date '+%Y-%m-%d %H:%M%z')
datep=$(date '+%Y%m%d')
sed "s/version=.*/version='$version',/g" setup.py -i
sed "s/release = .*/release = '$version'/g" docs/conf.py -i
sed "s/:Version: .*/:Version: $version/g" docs/*.rst -i
sed "s/# $projectc v.*/# $projectc v$version/" $project/*.py -i
sed "s/__version__ = .*/__version__ = '$version'/g" $project/__init__.py -i
sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD -i
sed "s/pkgver=.*/pkgver=$datep/g" PKGBUILD-git -i
sed "s/:Date: .*/:Date: $date/g" docs/*.rst -i
cp docs/README.rst docs/CHANGELOG.rst docs/CONTRIBUTING.rst .
cp docs/README.rst README
rm docs/$project.8.gz | true
rst2man docs/$project.rst > docs/$project.8
gzip docs/$project.8
rm docs/pb.8.gz | true
rst2man docs/pb.rst > docs/pb.8
gzip docs/pb.8
xgettext -c ./$project/*.py INSTALL.py localeprovider.py -o ./messages.pot
sed '1,+17d' ./messages.pot > ./messages.pot.tmp
pot='# '$projectc' pot file.
# Copyright (C) 2011-2012, Kwpolska.
# This file is distributed under the same license as the '$projectc' package.
# Kwpolska <kwpolska@kwpolska.tk>, 2011-2012.
#
msgid ""
msgstr ""
"Project-Id-Version: #version\\n"
"Report-Msgid-Bugs-To: Kwpolska <kwpolska@kwpolska.tk>\\n"
"POT-Creation-Date: #datel\\n"
"PO-Revision-Date: #datel\\n"
"Last-Translator: Kwpolska <kwpolska@kwpolska.tk>\\n"
"Language-Team: Kwpolska <kwpolska@kwpolska.tk>\\n"
"Language: en\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"'
echo $pot > messages.pot
cat ./messages.pot.tmp >> messages.pot
rm ./messages.pot.tmp
sed "s/#version/$version/g" messages.pot -i
sed "s/#datel/$datel/g" messages.pot -i
for i in ./locale/*; do
language=$(basename $i)
podir="./locale/$language/LC_MESSAGES"
popath="./locale/$language/LC_MESSAGES/$project.po"
sed 's/\"Project-Id-Version: .*/\"Project-Id-Version: '$version'\\n\"/' $popath -i
msgmerge $popath messages.pot -o $popath
fuzzy=$(cat $popath | grep -c '#, fuzzy')
empty=$(cat $popath | pcregrep -cM 'msgstr ""\n$')
if [ $fuzzy != '0' ]; then
echo "WARNING: $fuzzy fuzzy strings in language $language."
fi
if [ $empty != '0' ]; then
echo "WARNING: $empty empty strings in language $language."
fi
echo "$language: [enter] to edit, [c] to continue"
read validatesure
if [[ $validatesure != 'c' ]]; then
$EDITOR $popath
fi
msgfmt -o $podir/$project.mo $popath
done
# pbwrapper help testing
pacman -Sh > /tmp/pbwrapperhelp
bin/$project -h >> /tmp/pbwrapperhelp
diff -u .pbwrapperhelp /tmp/pbwrapperhelp > /tmp/pbwrapperdiff
if [[ $? = 1 ]]; then
echo 'pbwrapperhelp has changed.'
cat /tmp/pbwrapperdiff
echo 'Hit Enter to quit or c to copy the file over and continue.'
read pbwrapperhelp
if [[ $pbwrapperhelp = 'c' ]]; then
cp /tmp/pbwrapperhelp .pbwrapperhelp
rm /tmp/pbwrapperhelp /tmp/pbwrapperdiff
echo 'Continuing with release scripts.'
else
rm /tmp/pbwrapperhelp /tmp/pbwrapperdiff
exit 1
fi
fi
python -c "import $project"
if [[ $? = 1 ]]; then
echo "Import failed. Fix your code or don't come back."
exit 1
fi
./tests.py
if [[ $? = 1 ]]; then
echo "Tests failed. Fix your code or don't come back."
exit 1
fi
echo 'This is the last chance to quit. Hit ^C now if you want to.'
read bailout
./setup.py sdist upload
md5out=$(md5sum 'dist/'$project'-'$version'.tar.gz'|awk '{print $1}')
sed "s/md5sums=.*/md5sums=('$md5out')/" PKGBUILD -i
rm -rf MKPKGBUILD
mkdir -p MKPKGBUILD/$project MKPKGBUILD/$project"-git"
cp PKGBUILD MKPKGBUILD/$project
cp PKGBUILD-git MKPKGBUILD/$project"-git/PKGBUILD"
cd MKPKGBUILD
tar -czvf $project.src.tar.gz $project
tar -czvf $project"-git".src.tar.gz $project"-git"
burp -u Kwpolska -c system $project.src.tar.gz $project"-git".src.tar.gz
cd ..
rm -rf MKPKGBUILD
if [[ $2 != '-c' ]]; then
echo 'Commit message (sans the version?)'
echo -n '> '
read commitmsg
if [[ commitmsg = '' ]]; then
cm='t'
fi
else
cm='t'
fi
rm -rf $project.egg-info __pycache__ $project/__pycache__ dist build
git add *
if [[ $? != '0' ]]; then
echo 'Open another terminal and fix the errors.'
read dn
git add *
if [[ $? != '0' ]]; then
echo 'But please test your changes using that other terminal.'
read dn2
git add *
fi
fi
if [[ $cm = 't' ]]; then
git commit -as
else
git commit -asm "v$version: $commitmsg"
fi
git tag -sa "v$version" -m "Version $version"
git push
git push --tags