3 # convert a Google code CSV file into a countdown announcement
6 # make-countdown-announcement.sh NEXT_DEADLINE_DATE [PATCH-MEISTER]
8 # make-countdown-announcement.sh NEXT_DEADLINE_DATE [PATCH-MEISTER] > OUTPUT-FILE
11 # make-countdown-announcement.sh "Jan 1, 2001" "John Doe"
12 # make-countdown-announcement.sh "Jan 1, 2001" John
13 # make-countdown-announcement.sh "Jan 1, 2001" > countdown.txt
16 CSV_FILE=lilypond-issues.csv # comma-separated values
17 TSV_FILE=lilypond-issues.tsv # tab-separated values
18 URL_BASE="https://code.google.com/p/lilypond/issues"
19 QUERY_STR="q=Patch%3Apush%2Ccountdown%2Creview%2Cnew%2Cwaiting&colspec=Patch%20Owner%20ID%20Summary&sort=patch"
21 PATCH_MEISTER=${2:-"The Patch Meister"}
23 "adam.spiers","Adam Spiers"
24 "aleksandr.andreev","Aleksandr Andreev"
25 "benko.pal","Benkő Pál"
26 "bordage.bertrand","Bertrand Bordage"
27 "brownian.box","Dmytro O. Redchuk"
28 "Carl.D.Sorensen","Carl Sorensen"
29 "carlopeterson","Carl Peterson"
30 "colinghall","Colin Hall"
31 "ColinPKCampbell","Colin Campbell"
32 "d8valily","Mark Mathias"
33 "dak@gnu.org","David Kastrup"
34 "david.nalesnik","David Nalesnik"
35 "dschudy","Devon Schudy"
37 "erlenda","Erlend Aasland"
38 "fedelogy","Federico Bruni"
39 "frederic.bron.1995@polytechnique.org","Frédéric Bron"
40 "graham@percival-music.ca","Graham Percival"
41 "hanwenn","Han-Wen Nienhuys"
42 "hjunes","Heikki Junes"
43 "ht.lilypond.development","Heikki Tauriainen"
44 "ianhulin44","Ian Hulin"
45 "idragosani","Brett McCoy"
46 "jameselihubailey","James E. Bailey"
47 "janek.lilypond","Janek Warchoł"
48 "jan.nieuwenhuizen","Jan Nieuwenhuizen"
49 "joeneeman","Joe Neeman"
50 "john.mandereau","John Mandereau"
51 "joseph.wakeling","Joseph Wakeling"
52 "julien.rioux","Julien Rioux"
53 "kieren@alumni.rice.edu","Kieren MacMillan"
54 "k-ohara5a5a@oco.net","Keith OHara"
55 "lemzwerg","Werner Lemberg"
56 "lilyliska","Urs Liska"
57 "lilypond.patchy.graham","Graham Percival"
58 "mandolaerik","Erik Sandberg"
59 "marc@hohlart.de","Marc Hohl"
60 "marek@gregoriana.sk","Marek Klein"
61 "markpolesky","Mark Polesky"
62 "milimetr88","Łukasz Czerwiński"
63 "mtsolo","Mike Solomon"
64 "neziap","Janek Warchoł"
65 "nicolas.sceaux","Nicolas Sceaux"
66 "n.puttock","Neil Puttock"
67 "paconet.org","Francisco Vila"
68 "PhilEHolmes","Phil Holmes"
69 "pkx166h","James Lowe"
70 "plroskin","Pavel Roskin"
71 "pnorcks","Patrick McCarty"
72 "RalphBugList","Ralph Palmer"
73 "reinhold.kainhofer","Reinhold Kainhofer"
74 "rzedeler","Rune Zedeler"
75 "schilke.60","Derek Klinge"
76 "shingarov","Boris Shingarov"
77 "tdanielsmusic","Trevor Daniels"
78 "thomasmorley65","Thomas Morley"
79 "v.villenave","Valentin Villenave"
86 `basename $0` NEXT_DEADLINE_DATE [PATCH-MEISTER]
88 `basename $0` NEXT_DEADLINE_DATE [PATCH-MEISTER] > OUTPUT-FILE
91 `basename $0` "Jan 1, 2001" "John Doe"
92 `basename $0` "Jan 1, 2001" John
93 `basename $0` "Jan 1, 2001" > countdown.txt
109 # clean up in case of a previous interrupt
111 if [ -e $1 ]; then rm $1; fi
113 remove-if-exists push.tmp
114 remove-if-exists countdown.tmp
115 remove-if-exists review.tmp
116 remove-if-exists new.tmp
117 remove-if-exists waiting.tmp
118 remove-if-exists $TSV_FILE
121 # show initial instructions
122 read -p "First, in your web browser, make sure you're logged in to:
126 Then save the following link as a file called \"$CSV_FILE\"
127 (save it to this directory -- $PWD/):
129 $URL_BASE/csv?$QUERY_STR
134 if [ ! -e $CSV_FILE ]; then
135 echo -e "\nError: can't find \`$CSV_FILE': No such file or directory" >&2
140 # If the user wasn't logged in when downloading $CSV_FILE, the emails will
141 # appear truncated, e.g. "abc...@gmail.com", and won't be properly replaced by
142 # the author names later on. This code block complains if the string "...@" is
143 # found anywhere in the email field.
144 if [ "`cut -d, -f2 $CSV_FILE | grep -o '\.\.\.@'`" ]; then
146 It looks like you were not logged in to Google code when you downloaded
147 $CSV_FILE. Continue anyway (y/n)? "
153 *) read -p "Enter \`y' to continue; \`n' to quit and try again: "
159 # change the quoted, comma-separated file
160 # into an unquoted, tab-separated file
161 # and keep only the first 4 fields: Patch,Owner,ID,Summary
170 }' $CSV_FILE | cut -sf1-4 > $TSV_FILE
173 ISSUES_WITH_MISSING_FIELDS=`sed -n '/\t\t\|\t$/p' $TSV_FILE |
174 awk -F"\t" '{ print $3 }'`
176 if [ "$ISSUES_WITH_MISSING_FIELDS" ]; then
177 COUNT=`wc --lines <(echo "$ISSUES_WITH_MISSING_FIELDS") | sed 's/ .*//'`
178 LINKS_WITH_MISSING_FIELDS=`echo "$ISSUES_WITH_MISSING_FIELDS" |
179 sed "s!^! $URL_BASE/detail?id=!"`
180 if [ $COUNT -eq 1 ]; then
181 echo -e "\nError: The following issue is missing an OWNER or SUMMARY:" >&2
183 echo -e "\nError: Each of the following issues is missing an OWNER or SUMMARY:" >&2
185 echo "$LINKS_WITH_MISSING_FIELDS" >&2
186 echo "Please add the missing information in the tracker and start over." >&2
187 remove-if-exists $TSV_FILE
192 EMAILS_USED=`awk -F"\t" '{ print $2 }' $TSV_FILE | sort --unique`
195 for i in $MAILMAP; do
196 echo "$i" | sed 's/^"\(.*\)",".*/\1/'
197 done | sort --unique`
198 UNKNOWN_EMAILS=`comm -23 <(echo "$EMAILS_USED") <(echo "$KNOWN_EMAILS")`
201 # Unknown emails/usernames usually mean new contributors.
202 # If any are found, the user is prompted to add the new
203 # authors' names to the MAILMAP list above.
204 if [ "$UNKNOWN_EMAILS" ]; then
205 COUNT=`wc --lines <(echo "$UNKNOWN_EMAILS") | sed 's/ .*//'`
206 if [ $COUNT -eq 1 ]; then
207 echo -e "\nError: The following email/username needs to be associated with a name:" >&2
208 echo "$UNKNOWN_EMAILS" | sed 's/^/ /' >&2
209 echo -e "Please add it to the MAILMAP list in\n $0" >&2
211 echo -e "\nError: The following emails/usernames need to be associated with names:" >&2
212 echo "$UNKNOWN_EMAILS" | sed 's/^/ /' >&2
213 echo -e "Please add them to the MAILMAP list in\n $0" >&2
215 echo "using the following form:" >&2
216 echo "$UNKNOWN_EMAILS" | sed 's/.*/ "&","author name"/' >&2
217 echo "and commit your changes to the main git repository." >&2
218 remove-if-exists $TSV_FILE
225 for i in $MAILMAP; do
226 echo "$i" | sed 's/^"\(.*\)","\(.*\)"$/s\/\1\/\2\/g/'
230 # replace emails/usernames with author names
231 # and separate the issues by patch type
235 /^countdown/w countdown.tmp
236 /^review/w review.tmp
238 /^waiting/w waiting.tmp
242 # clean up; $TSV_FILE is no longer needed
243 remove-if-exists $TSV_FILE
249 if [ -s $FILE ]; then
250 echo -e "$TYPE:\n" | tr 'a-z' 'A-Z'
251 awk -v UB=$URL_BASE -F"\t" \
252 '{ printf("%s: %s\n%s/detail?id=%d\n\n"), $2, $4, UB, $3 }' $FILE
253 echo -e "____________________\n\n"
255 remove-if-exists $FILE
261 # display the countdown announcement
264 Here is the current patch countdown list.
265 The next countdown will be on $DEADLINE.
267 You can always view the most current countdown list here:
268 $URL_BASE/list?$QUERY_STR
275 format-entry countdown
280 echo -e "Thank you,\n$PATCH_MEISTER"