Merge lp:~raphink/ubuntu-maintenance-check/mybranch into lp:ubuntu-maintenance-check

Proposed by Raphaël Pinson
Status: Merged
Approved by: Nick Barcet
Approved revision: 26
Merged at revision: not available
Proposed branch: lp:~raphink/ubuntu-maintenance-check/mybranch
Merge into: lp:ubuntu-maintenance-check
Diff against target: None lines
To merge this branch: bzr merge lp:~raphink/ubuntu-maintenance-check/mybranch
Reviewer Review Type Date Requested Status
Nick Barcet Approve
Review via email: mp+11955@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Raphaël Pinson (raphink) wrote :

Hi Nick,

I've merged the version you sent me on pastebin. Just had to fix a bug in getopt, where a semi-colon was missing for option f. You probably used it for S and forgot to add it back to f.

Additionally, I've added another option -D|--date, which displays the maximum supported date for each package instead of the support time.

Finally, I've refactored quite a bit of the code to make it more easily extensible to new releases. This tries to guess as many parameters as possible from the release version. In the end, it should be easy to just store an array with release names and versions in the beginning of the file.

Cheers,

Raphaël

26. By Raphaël Pinson <raphink@rpinson>

Fix dapper in get_date

Revision history for this message
Nick Barcet (nijaba) wrote :

Thanks a lot Raphaël very useful additions and simplifications.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maintenance-check'
2--- maintenance-check 2009-04-15 09:20:46 +0000
3+++ maintenance-check 2009-09-17 09:03:02 +0000
4@@ -43,6 +43,8 @@
5 s - ubuntu server
6 -v, --verbose Turn on verbose mode.
7 -d, --download Download seeds even if cache exists.
8+-S, --source Specify an alternate location for seeds.
9+-D, --date Show maximum supported dates instead of support time.
10
11 maintenance-check is Copyright (C) 2007-2009 Canonical Ltd. and
12 written by Nick Barcet <nick.barcet@canonical.com> and
13@@ -54,8 +56,10 @@
14 download=""
15 filter=""
16 allmaint=""
17+showdate=""
18+usource="http://people.ubuntu.com/~ubuntu-archive/germinate-output"
19
20-TEMP=`getopt -o hvdaf: --long help,verbose,download,all,filter:, -- "$@"`
21+TEMP=`getopt -o hvdaf:S:D --long help,verbose,download,all,filter:,source:,date, -- "$@"`
22 eval set -- "$TEMP"
23
24 while true
25@@ -89,6 +93,14 @@
26 allmaint=1
27 shift
28 ;;
29+ -S|--source)
30+ usource=$2
31+ shift 2
32+ ;;
33+ -D|--date)
34+ showdate=1
35+ shift
36+ ;;
37 --)
38 shift || true
39 break
40@@ -215,28 +227,52 @@
41 if echo "$line" | egrep -q "^linux-(headers|image|restricted|ubuntu)-"; then
42 if echo "$line" | egrep -q -- "-(imx51|ixp4xx|versatile|lpia|generic)$"; then
43 seeds="${seeds}${seeds:+, }Kernels"
44- maint=${umaint}
45+ if [ ! -n "$showdate" ]; then
46+ maint=${umaint}
47+ else
48+ maint=${udmaint}
49+ fi
50 elif echo "$line" | egrep -q -- "-(virtual|server)$"; then
51 seeds="${seeds}${seeds:+, }Kernels"
52- maint=${smaint}
53+ if [ ! -n "$showdate" ]; then
54+ maint=${smaint}
55+ else
56+ maint=${sdmaint}
57+ fi
58 fi
59 fi
60
61 if grep -q "^$line$" "$CACHEDIR/$1.supported.pkgs"; then
62 seeds="${seeds}${seeds:+, }Supported"
63- maint=${amaint}
64+ if [ ! -n "$showdate" ]; then
65+ maint=${amaint}
66+ else
67+ maint=${admain}
68+ fi
69 fi
70 if grep -q "^$line$" "$CACHEDIR/$1.kubuntu.pkgs"; then
71 seeds="${seeds}${seeds:+, }Kubuntu"
72- maint=${kmaint}
73+ if [ ! -n "$showdate" ]; then
74+ maint=${kmaint}
75+ else
76+ maint=${kdmaint}
77+ fi
78 fi
79 if grep -q "^$line$" "$CACHEDIR/$1.desktop.pkgs"; then
80 seeds="${seeds}${seeds:+, }Ubuntu"
81- maint=${umaint}
82+ if [ ! -n "$showdate" ]; then
83+ maint=${umaint}
84+ else
85+ maint=${udmaint}
86+ fi
87 fi
88 if grep -q "^$line$" "$CACHEDIR/$1.server.pkgs"; then
89 seeds="${seeds}${seeds:+, }Server"
90- maint=${smaint}
91+ if [ ! -n "$showdate" ]; then
92+ maint=${smaint}
93+ else
94+ maint=${sdmaint}
95+ fi
96 fi
97 case "$filter" in
98 n|N)
99@@ -271,6 +307,67 @@
100 done
101 }
102
103+
104+get_date() {
105+ # release version
106+ rvers="$1"
107+ # support time
108+ stime="$2"
109+
110+ # standard release date
111+ rdate="$(date_from_vers ${rvers})-01";
112+
113+ # standard support time
114+ stime=${stime/y/year}
115+ stime=${stime/mo/month}
116+
117+ # support date
118+ sdate=$(date -d"${rdate} + ${stime}" +"%Y-%m")
119+
120+ echo ${sdate}
121+}
122+
123+
124+date_from_vers() {
125+ rvers="$1";
126+
127+ vers_maj=${rvers%%\.*};
128+ vers_min=${rvers##*\.};
129+
130+ if [ $vers_maj -lt 10 ]; then
131+ rdate="200${vers_maj}-${vers_min}";
132+ else
133+ rdate="20${vers_maj}-${vers_min}";
134+ fi
135+
136+ echo ${rdate};
137+}
138+
139+
140+release_lts() {
141+ rvers="$1";
142+ rname="$2";
143+
144+ umaint="3y";kmaint="18mo";smaint="5y";
145+ udmaint=$(get_date ${rvers} ${umaint});
146+ kdmaint=$(get_date ${rvers} ${kmaint});
147+ sdmaint=$(get_date ${rvers} ${smaint});
148+ echo "${rvers}(${rname})-Maint.til:Ubuntu->${udmaint},Server->${sdmaint},Kubuntu->${kdmaint}"
149+}
150+
151+
152+release_normal() {
153+ rvers="$1";
154+ rname="$2";
155+
156+ umaint="18mo";kmaint="18mo";smaint="18mo";
157+ udmaint=$(get_date ${rvers} ${umaint});
158+ kdmaint=$(get_date ${rvers} ${kmaint});
159+ sdmaint=$(get_date ${rvers} ${smaint});
160+ echo "${rvers}(${rname})-Maint.til: All->${udmaint}"
161+}
162+
163+
164 set_release_variables() {
165 release="$1"
166 amaint="18mo" #minimum maintenance for any package in supported
167@@ -278,39 +375,39 @@
168
169 case "$release" in
170 dapper) #no structure file
171+ rdate="2006-06";
172 umaint="3y";kmaint="3y";smaint="5y";
173- echo "6.06(dapper drake)-Maint.til:Ubuntu->2009-06,Server->2011-06,Kubuntu->2009-06"
174+ udmaint=$(get_date ${rdate} ${umaint});
175+ kdmaint=$(get_date ${rdate} ${kmaint});
176+ sdmaint=$(get_date ${rdate} ${smaint});
177+ echo "6.06(dapper drake)-Maint.til:Ubuntu->${udmaint},Server->${sdmaint},Kubuntu->${kdmaint}"
178 ;;
179 edgy) #no structure file
180- umaint="18mo";kmaint="18mo";smaint="18mo";
181- echo "6.10(Edgy Eft)-Maint.til: All->2008-04"
182+ release_normal "6.10" "Edgy Eft";
183 ;;
184 feisty) #general case, we have a structure file
185- umaint="18mo";kmaint="18mo";smaint="18mo";
186- echo "7.04(feisty fawn)-Maint.til: All->2008-10"
187+ release_normal "7.04" "Feisty Fawn";
188 ;;
189 gutsy) #structure file is invalid
190- umaint="18mo";kmaint="18mo";smaint="18mo";
191- echo "7.10(gusty gibbon)-Maint.til: All->2009-04"
192+ release_normal "7.10" "Gutsy Gibbon";
193 ;;
194 *) #general case, we have a structure file
195- umaint="18mo";kmaint="18mo";smaint="18mo";
196 case "$release" in
197 hardy)
198- echo "8.04(hardy heron)-Maint.til:Ubuntu->2011-04,Server->2013-04,Kubuntu->2009-10"
199- umaint="3y";kmaint="18mo";smaint="5y";
200+ release_lts "8.04" "Hardy Heron";
201 ;;
202 intrepid)
203- echo "8.10(intrepid ibex)-Maint.til: All->2010-04"
204+ release_normal "8.10" "Intrepid Ibex";
205 ;;
206 jaunty)
207- echo "9.04(jaunty jackalope)-Maint.til: All->2010-10"
208+ release_normal "9.04" "Jaunty Jackalope";
209 ;;
210 karmic)
211- echo "9.10(karmic koala)-Maint.til: All->2011-04"
212+ release_normal "9.10" "Karmic Koala";
213 ;;
214 *)
215 umaint="X";kmaint="X";smaint="X";
216+ udmaint="X";kdmaint="X";sdmaint="X";
217 echo "unknown release"
218 ;;
219 esac
220@@ -331,56 +428,56 @@
221
222 case "$release" in
223 dapper) #no structure file
224- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu"
225+ source="${usource}/ubuntu"
226 getlistsold "$release" "$source" "server-ship" "server"\
227 "boot server standard installer minimal ship supported-sysadmin-common supported-libraries-common supported-installer-common supported-base supported-development supported-kernel supported-misc-server supported-network-common supported-hardware-common supported-server"
228 getlistsold "$release" "$source" "ship" "desktop" \
229 "boot desktop live installer standard ship-live minimal ship supported-sysadmin-common supported-libraries-common supported-installer-common supported-base supported-development supported-kernel supported-misc-server supported-network-common supported-hardware-common supported-sysadmin-desktop supported-installer-desktop supported-network-desktop supported-hardware-desktop supported-desktop-common"
230 getlists "$release" "$source" "supported" "supported"
231- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu"
232+ source="${usource}/kubuntu"
233 getlistsold "$release" "$source" "ship" "kubuntu" \
234 "boot desktop live installer standard ship-live minimal ship supported-sysadmin-common supported-libraries-common supported-installer-common supported-base supported-development supported-kernel supported-misc-server supported-network-common supported-hardware-common supported-sysadmin-desktop supported-installer-desktop supported-network-desktop supported-hardware-desktop supported-desktop-common"
235 parseinstalled $release "$@" > $release.installed
236 ;;
237 edgy) #no structure file
238- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu"
239+ source="${usource}/ubuntu"
240 getlistsold "$release" "$source" "server-ship" "server" \
241 "boot server standard installer minimal ship supported"
242 getlistsold "$release" "$source" "ship" "desktop" \
243 "boot desktop live installer standard ship-live minimal ship supported"
244 getlists "$release" "$source" "supported" "supported"
245- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu"
246+ source="${usource}/kubuntu"
247 getlistsold "$release" "$source" "ship" "kubuntu" \
248 "boot desktop live installer standard ship-live minimal ship supported"
249 ;;
250 feisty) #general case, we have a structure file
251- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu"
252+ source="${usource}/ubuntu"
253 getlists "$release" "$source" "server-ship" "server" \
254 "boot desktop live installer standard ship-live minimal ship supported"
255 getlists "$release" "$source" "ship" "desktop"\
256 "boot desktop live installer standard ship-live minimal ship supported"
257 getlists "$release" "$source" "supported" "supported"
258- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu"
259+ source="${usource}/kubuntu"
260 getlists "$release" "$source" "ship" "kubuntu"\
261 "boot desktop live installer standard ship-live minimal ship supported"
262 ;;
263 gutsy) #structure file is invalid
264- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu"
265+ source="${usource}/ubuntu"
266 getlistsold "$release" "$source" "server-ship" "server" \
267 "boot required minimal standard dns-server lamp-server openssh-server print-server samba-server postgresql-server mail-server ship supported"
268 getlistsold "$release" "$source" "ship" "desktop" \
269 "boot required minimal standard desktop ship supported"
270 getlists "$release" "$source" "supported" "supported"
271- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu"
272+ source="${usource}/kubuntu"
273 getlistsold "$release" "$source" "ship" "kubuntu" \
274 "boot required minimal standard desktop ship supported"
275 ;;
276 *) #general case, we have a structure file
277- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu"
278+ source="${usource}/ubuntu"
279 getlists "$release" "$source" "server-ship supported-server" "server"
280 getlists "$release" "$source" "ship supported-desktop" "desktop"
281 getlists "$release" "$source" "supported" "supported"
282- source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu"
283+ source="${usource}/kubuntu"
284 getlists "$release" "$source" "ship supported-desktop" "kubuntu"
285 ;;
286 esac

Subscribers

People subscribed via source and target branches

to all changes: