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="http://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 Mister"}
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 "ianhulin44","Ian Hulin"
44 "idragosani","Brett McCoy"
45 "jameselihubailey","James E. Bailey"
46 "janek.lilypond","Janek Warchoł"
47 "jan.nieuwenhuizen","Jan Nieuwenhuizen"
48 "joeneeman","Joe Neeman"
49 "john.mandereau","John Mandereau"
50 "joseph.wakeling","Joseph Wakeling"
51 "julien.rioux","Julien Rioux"
52 "kieren@alumni.rice.edu","Kieren MacMillan"
53 "k-ohara5a5a@oco.net","Keith OHara"
54 "lemzwerg","Werner Lemberg"
55 "lilyliska","Urs Liska"
56 "lilypond.patchy.graham","Graham Percival"
57 "mandolaerik","Erik Sandberg"
58 "marc@hohlart.de","Marc Hohl"
59 "marek@gregoriana.sk","Marek Klein"
60 "markpolesky","Mark Polesky"
61 "milimetr88","Łukasz Czerwiński"
62 "mtsolo","Mike Solomon"
63 "neziap","Janek Warchoł"
64 "nicolas.sceaux","Nicolas Sceaux"
65 "n.puttock","Neil Puttock"
66 "paconet.org","Francisco Vila"
67 "PhilEHolmes","Phil Holmes"
68 "pkx166h","James Lowe"
69 "plroskin","Pavel Roskin"
70 "pnorcks","Patrick McCarty"
71 "RalphBugList","Ralph Palmer"
72 "reinhold.kainhofer","Reinhold Kainhofer"
73 "rzedeler","Rune Zedeler"
74 "schilke.60","Derek Klinge"
75 "shingarov","Boris Shingarov"
76 "tdanielsmusic","Trevor Daniels"
77 "thomasmorley65","Thomas Morley"
78 "v.villenave","Valentin Villenave"
85 `basename $0` NEXT_DEADLINE_DATE [PATCH-MEISTER]
87 `basename $0` NEXT_DEADLINE_DATE [PATCH-MEISTER] > OUTPUT-FILE
90 `basename $0` "Jan 1, 2001" "John Doe"
91 `basename $0` "Jan 1, 2001" John
92 `basename $0` "Jan 1, 2001" > countdown.txt
108 # clean up in case of a previous interrupt
110 if [ -e $1 ]; then rm $1; fi
112 remove-if-exists push.tmp
113 remove-if-exists countdown.tmp
114 remove-if-exists review.tmp
115 remove-if-exists new.tmp
116 remove-if-exists waiting.tmp
117 remove-if-exists $TSV_FILE
120 # show initial instructions
121 read -p "First, in your web browser, make sure you're logged in to:
125 Then save the following link as a file called \"$CSV_FILE\"
126 (save it to this directory -- $PWD/):
128 $URL_BASE/csv?$QUERY_STR
133 if [ ! -e $CSV_FILE ]; then
134 echo -e "\nError: can't find \`$CSV_FILE': No such file or directory" >&2
139 # If the user wasn't logged in when downloading $CSV_FILE, the emails will
140 # appear truncated, e.g. "abc...@gmail.com", and won't be properly replaced by
141 # the author names later on. This code block complains if the string "...@" is
142 # found anywhere in the email field.
143 if [ "`cut -d, -f2 $CSV_FILE | grep -o '\.\.\.@'`" ]; then
145 It looks like you were not logged in to Google code when you downloaded
146 $CSV_FILE. Continue anyway (y/n)? "
152 *) read -p "Enter \`y' to continue; \`n' to quit and try again: "
158 # change the quoted, comma-separated file
159 # into an unquoted, tab-separated file
160 # and keep only the first 4 fields: Patch,Owner,ID,Summary
168 }' $CSV_FILE | cut -sf1-4 > $TSV_FILE
171 EMAILS_USED=`awk -F"\t" '{ print $2 }' $TSV_FILE | sort --unique`
174 for i in $MAILMAP; do
175 echo "$i" | sed 's/^"\(.*\)",".*/\1/'
176 done | sort --unique`
177 UNKNOWN_EMAILS=`comm -23 <(echo "$EMAILS_USED") <(echo "$KNOWN_EMAILS")`
180 # Unknown emails/usernames usually mean new contributors.
181 # If any are found, the user is prompted to add the new
182 # authors' names to the MAILMAP list above.
183 if [ "$UNKNOWN_EMAILS" ]; then
184 COUNT=`wc --lines <(echo "$UNKNOWN_EMAILS") | sed 's/ .*//'`
185 if [ $COUNT -eq 1 ]; then
186 echo -e "\nError: The following email/username needs to be associated with a name:" >&2
187 echo "$UNKNOWN_EMAILS" | sed 's/^/ /' >&2
188 echo -e "Please add it to the MAILMAP list in\n $0" >&2
190 echo -e "\nError: The following emails/usernames need to be associated with names:" >&2
191 echo "$UNKNOWN_EMAILS" | sed 's/^/ /' >&2
192 echo -e "Please add them to the MAILMAP list in\n $0" >&2
194 echo "using the following form:" >&2
195 echo "$UNKNOWN_EMAILS" | sed 's/.*/ "&","author name"/' >&2
196 echo "and commit your changes to the main git repository." >&2
197 remove-if-exists $TSV_FILE
204 for i in $MAILMAP; do
205 echo "$i" | sed 's/^"\(.*\)","\(.*\)"$/s\/\1\/\2\/g/'
209 # replace emails/usernames with author names
210 # and separate the issues by patch type
214 /^countdown/w countdown.tmp
215 /^review/w review.tmp
217 /^waiting/w waiting.tmp
221 # clean up; $TSV_FILE is no longer needed
222 remove-if-exists $TSV_FILE
228 if [ -s $FILE ]; then
229 echo -e "$TYPE:\n" | tr 'a-z' 'A-Z'
230 awk -v UB=$URL_BASE -F"\t" \
231 '{ printf("%s: %s\n%s/detail?id=%d\n\n"), $2, $4, UB, $3 }' $FILE
232 echo -e "____________________\n\n"
234 remove-if-exists $FILE
240 # display the countdown announcement
243 Here is the current patch countdown list.
244 The next countdown will be on $DEADLINE.
246 You can always view the most current countdown list here:
247 $URL_BASE/list?$QUERY_STR
254 format-entry countdown
259 echo -e "Thank you,\n$PATCH_MEISTER"