Merge lp:~bdrung/mozilla-devscripts/moz-version into lp:~mozillateam/mozilla-devscripts/mozilla-devscripts

Proposed by Benjamin Drung
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bdrung/mozilla-devscripts/moz-version
Merge into: lp:~mozillateam/mozilla-devscripts/mozilla-devscripts
Diff against target: None lines
To merge this branch: bzr merge lp:~bdrung/mozilla-devscripts/moz-version
Reviewer Review Type Date Requested Status
Alexander Sack (community) Approve
Review via email: mp+9672@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Benjamin Drung (bdrung) wrote :

xpi.mk: start/end of life implementation.

223. By Benjamin Drung

  - make MOZ_EXTENSION_PKG optional; if this variable is unset, the first
    binary package listed in debian/control will be used
    - update src/xpi.mk

Revision history for this message
Alexander Sack (asac) wrote :

approved and merged. in future, try to keep changelog changes in the same commit where you commit stuff ;) (use debcommit preferably to automatically use changelog changes as bzr commit text) ... if you do general changelog improvements at best keep them out of an unrelated topic branch.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2009-07-29 08:47:47 +0000
3+++ debian/changelog 2009-08-04 23:12:53 +0000
4@@ -9,33 +9,16 @@
5 - update src/xpi.mk
6 - improve rule dependencies; avoid duplicate/circular depends
7 - update src/xpi.mk
8- - add automatic xpi depends .substvars feature based on smart parsing
9- of install.rdf and checking min/maxVersion for each target application;
10- extensions can now use ${xpi:Depends} to get the right dependencies added;
11- the version/package/targetAppId mapping information is currently maintained
12- in src/xpi.mk itself - thx to Benjamin Drung <bdrung@ubuntu.com> for this
13- - update src/xpi.mk
14- - first pitch on automagic max/min version detection implemented; add a generic
15- |TARGET_VERSION| call taking parameters a) appid, b) maxVersion|minVersion and
16- c) extension-dir; this call is then used to parse the right max/minVersion
17- for a given targetApplication on demand in |CHECK_VERSION|. In this way we
18- now filter out unsuitable packages from xpi:Depends based on the install.rdf
19- version bounds; Note: currently uses dpkg --compare-versions, which is wrong
20- for mozilla versions; but works good enough until with have a
21- mozpkg --compare-versions script
22- - update src/xpi.mk
23- - add moz-version-compare helper script and ship it in extra_files; this script
24- implements compare operations for mozilla versions as in
25- https://developer.mozilla.org/en/Toolkit_version_format; thanks to Benjamin
26- Drung <bdrung@ubuntu.com> for this contribution
27- - add src/moz-version-compare
28- - update src/Makefile
29+ - first pitch on automagic max/min version detection implemented; add a
30+ generic |TARGET_VERSION| call taking parameters a) appid,
31+ b) maxVersion|minVersion and c) extension-dir; this call is then used to
32+ parse the right max/minVersion for a given targetApplication on demand in
33+ |CHECK_VERSION|. In this way we now filter out unsuitable packages from
34+ xpi:Depends based on the install.rdf version bounds
35+ - update src/xpi.mk
36 - add prism@developer.mozilla.org 1.0 to list of auto detected target
37 application packages
38 - update src/xpi.mk
39- - use moz-version-compare in ${xpi:Depends} |CHECK_VERSION| call
40- instead of the rather flawed dpkg --compare-versions approach.
41- - update src/xpi.mk
42 - add thunderbird-3.0 to list of auto detected target application packages
43 - update src/xpi.mk
44 * build-system:
45@@ -45,7 +28,24 @@
46 - update src/Makefile
47 - update debian/mozilla-devscripts.install
48
49- -- Alexander Sack <asac@ubuntu.com> Wed, 29 Jul 2009 01:08:07 +0200
50+ [ Benjamin Drung ]
51+ * xpi.mk:
52+ - add automatic xpi depends .substvars feature based on smart parsing
53+ of install.rdf and checking min/maxVersion for each target application;
54+ extensions can now use ${xpi:Depends} to get the right dependencies added;
55+ the version/package/targetAppId mapping information is currently
56+ maintained in src/xpi.mk itself
57+ - update src/xpi.mk
58+ - add moz-version helper script and ship it in extra_files; this script
59+ implements compare operations for mozilla versions as in
60+ https://developer.mozilla.org/en/Toolkit_version_format
61+ - add src/moz-version
62+ - update src/Makefile
63+ - implement start/end of life for comparing possible alternate binary
64+ dependency
65+ - update src/xpi.mk
66+
67+ -- Benjamin Drung <bdrung@ubuntu.com> Wed, 05 Aug 2009 01:01:31 +0200
68
69 mozilla-devscripts (0.13) unstable; urgency=low
70
71
72=== modified file 'src/Makefile'
73--- src/Makefile 2009-07-28 23:31:43 +0000
74+++ src/Makefile 2009-08-03 23:37:38 +0000
75@@ -53,7 +53,7 @@
76 bindir_files = \
77 med-xpi-pack \
78 med-xpi-unpack \
79- moz-version-compare
80+ moz-version
81
82 extra_dirs = \
83 mozclient \
84
85=== renamed file 'src/moz-version-compare' => 'src/moz-version'
86--- src/moz-version-compare 2009-07-28 23:08:24 +0000
87+++ src/moz-version 2009-08-03 23:37:38 +0000
88@@ -22,8 +22,14 @@
89
90 # Reference: https://developer.mozilla.org/en/Toolkit_version_format
91
92+import getopt
93 import sys
94
95+# error codes
96+COMMAND_LINE_SYNTAX_ERROR = 2
97+INVALID_COMPARATOR = 3
98+EMPTY_VERSION_STRING = 4
99+
100 def decode_part(part):
101 """Decodes a version part (like 5pre4) to <number-a><string-b><number-c><string-d>"""
102 subpart = [0,"",0,""]
103@@ -74,13 +80,15 @@
104
105 return subpart
106
107-def decode_version(version):
108+def decode_version(version, verbose=False):
109 """Decodes a version string like 1.1pre1a"""
110 parts = version.split(".")
111 decoded_parts = map(decode_part, parts)
112+ if verbose:
113+ print "I: Split %s up into %s." % (version, decoded_parts)
114 return decoded_parts
115
116-def compare((a, b)):
117+def compare_subpart((a, b)):
118 # A string-part that exists is always less-then a nonexisting string-part
119 if a == "":
120 if b == "":
121@@ -96,7 +104,7 @@
122 return cmp(a, b)
123
124 def compare_part((x, y)):
125- compared_subparts = filter(lambda x: x != 0, map(compare, zip(x, y)))
126+ compared_subparts = filter(lambda x: x != 0, map(compare_subpart, zip(x, y)))
127 if compared_subparts:
128 return compared_subparts[0]
129 else:
130@@ -114,32 +122,94 @@
131 else:
132 return 0
133
134-def moz_compare_versions(version1, operator, version2):
135- """Return true if the expression version1 operator version2 is valid, otherwise false"""
136- operators = ("lt", "le", "eq", "ne", "ge", "gt")
137- if operator not in operators:
138- print "E: The operator " + operator + " is not valid. It should one of " + ", ".join(operators) + "."
139- sys.exit(2)
140-
141- a = decode_version(version1)
142- b = decode_version(version2)
143-
144- if operator == "lt":
145+comparators = ("lt", "le", "eq", "ne", "ge", "gt")
146+
147+def moz_version_compare(version1, comparator, version2, silent=False, verbose=False):
148+ """Return true if the expression version1 comparator version2 is valid, otherwise false"""
149+ if comparator not in comparators:
150+ if not silent:
151+ print >> sys.stderr, "E: The comparator " + comparator + \
152+ " is not valid. It should one of " + ", ".join(comparators) + "."
153+ sys.exit(INVALID_COMPARATOR)
154+
155+ if version1.strip() == "" or version2.strip() == "":
156+ if not silent:
157+ print >> sys.stderr, "E: At least one version string is empty."
158+ sys.exit(EMPTY_VERSION_STRING)
159+
160+ if verbose:
161+ symbol = {"lt": "<", "le": "<=", "eq": "=", "ne": "!=", "ge": ">=", "gt": ">"}
162+ print "I: Comparing %s %s %s." % (version1, symbol[comparator], version2)
163+
164+ a = decode_version(version1, verbose)
165+ b = decode_version(version2, verbose)
166+
167+ if comparator == "lt":
168 return compare_versions(a, b) < 0
169- elif operator == "le":
170+ elif comparator == "le":
171 return compare_versions(a, b) <= 0
172- elif operator == "eq":
173+ elif comparator == "eq":
174 return compare_versions(a, b) == 0
175- elif operator == "ne":
176+ elif comparator == "ne":
177 return compare_versions(a, b) != 0
178- elif operator == "ge":
179+ elif comparator == "ge":
180 return compare_versions(a, b) >= 0
181- elif operator == "gt":
182+ elif comparator == "gt":
183 return compare_versions(a, b) > 0
184
185+
186+def usage(output):
187+ print >> output, """Usage: %s --compare version1 comparator version2
188+
189+ -h, --help display this help and exit
190+ -s, --silent do not print anything and die silent on errors
191+ -v, --verbose print more information
192+
193+comparator must be one of %s.""" % (sys.argv[0], ", ".join(comparators))
194+
195+
196 if __name__ == "__main__":
197- if moz_compare_versions(sys.argv[1], sys.argv[2], sys.argv[3]):
198- sys.exit(0)
199+ try:
200+ long_opts = ["compare", "help", "silent", "verbose"]
201+ opts, args = getopt.gnu_getopt(sys.argv[1:], "chsv", long_opts)
202+ except getopt.GetoptError, e:
203+ # print help information and exit:
204+ print >> sys.stderr, str(e) # will print something like "option -a not recognized"
205+ usage(sys.stderr)
206+ sys.exit(COMMAND_LINE_SYNTAX_ERROR)
207+
208+ compare = False
209+ silent = False
210+ verbose = False
211+
212+ for o, a in opts:
213+ if o in ("-c", "--compare"):
214+ compare = True
215+ elif o in ("-h", "--help"):
216+ usage(sys.stdout)
217+ sys.exit()
218+ elif o in ("-s", "--silent"):
219+ silent = True
220+ elif o in ("-v", "--verbose"):
221+ verbose = True
222+ else:
223+ assert False, "unhandled option"
224+
225+ if compare:
226+ if len(args) != 3:
227+ if not silent:
228+ usage(sys.stderr)
229+ sys.exit(COMMAND_LINE_SYNTAX_ERROR)
230+ if moz_version_compare(args[0], args[1], args[2], silent, verbose):
231+ if verbose:
232+ print "I: Compare expression true."
233+ sys.exit(0)
234+ else:
235+ if verbose:
236+ print "I: Compare expression false."
237+ sys.exit(1)
238 else:
239- sys.exit(1)
240-
241+ if not silent:
242+ print >> sys.stderr, "E: You should specify the command --compare."
243+ usage(sys.stderr)
244+ sys.exit(COMMAND_LINE_SYNTAX_ERROR)
245
246=== modified file 'src/xpi.mk'
247--- src/xpi.mk 2009-07-29 08:47:47 +0000
248+++ src/xpi.mk 2009-08-04 22:59:15 +0000
249@@ -3,6 +3,7 @@
250 # Copyright (c) 2008-2009 Canonical Ltd.
251 # Author(s): Alexander Sack <asac@ubuntu.com>
252 # Fabien Tassin <fta@sofaraway.org>
253+# Benjamin Drung <bdrung@ubuntu.com>
254 #
255 # This program is free software; you can redistribute it and/or
256 # modify it under the terms of the GNU General Public License as
257@@ -62,34 +63,77 @@
258 # your code to MOZ_XPI_MOZILLA_EXTRA_DIRS
259 #
260
261-# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication to package mapping
262-target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.0 := abrowser-3.0 firefox-3.0 iceweasel
263-target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.5 := abrowser-3.5 firefox-3.5 iceweasel
264-target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.6 := abrowser-3.6 firefox-3.6
265-target_packages_{3550f703-e582-4d05-9a08-453d09bdfdc6}_2.0 := icedove thunderbird
266-target_packages_{3550f703-e582-4d05-9a08-453d09bdfdc6}_3.0 := icedove thunderbird-3.0
267-target_packages_prism@developer.mozilla.org_1.0 := prism
268-
269-# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication versions
270-target_versions_{ec8030f7-c20a-464f-9b0e-13a3a9e97384} := 3.0 3.5 3.6
271-target_versions_{3550f703-e582-4d05-9a08-453d09bdfdc6} := 2.0 3.0
272-target_versions_prism@developer.mozilla.org := 1.0
273+# data for XPI_DEPENDS/CHECK_VERSION magic - start/end of life of binary packages
274+abrowser-3.0_sol := 3.0a8
275+abrowser-3.0_eol := 3.0.*
276+abrowser-3.5_sol := 3.5b4
277+abrowser-3.5_eol := 3.5.*
278+abrowser-3.6_sol := 3.6a1pre
279+abrowser-3.6_eol := 3.6.*
280+firefox-3.0_sol := 3.0a8
281+firefox-3.0_eol := 3.0.*
282+firefox-3.5_sol := 3.5b4
283+firefox-3.5_eol := 3.5.*
284+firefox-3.6_sol := 3.6a1pre
285+firefox-3.6_eol := 3.6.*
286+iceweasel_sol := 2.0
287+iceweasel_eol := *
288+
289+icedove_sol := 1.5.0.7
290+icedove_eol := *
291+thunderbird_sol := 2.0
292+thunderbird_eol := 2.0.0.*
293+thunderbird-3.0_sol := 3.0a1pre
294+thunderbird-3.0_eol := 3.0.*
295+
296+iceape_sol := 1.0.6
297+iceape_eol := *
298+seamonkey_sol := 1.1.6
299+seamonkey_eol := *
300+
301+conkeror_sol := 0.9
302+conkeror_eol := *
303+
304+prism_sol := 0.8
305+prism_eol := *
306+
307+sunbird_sol := 0.5
308+sunbird_eol := *
309+
310+xulrunner-1.9_sol := 1.9a1pre
311+xulrunner-1.9_eol := 1.9.0.*
312+xulrunner-1.9.1_sol := 1.9.1a1pre
313+xulrunner-1.9.1_eol := 1.9.1.*
314+xulrunner-1.9.2_sol := 1.9.2a1pre
315+xulrunner-1.9.2_eol := 1.9.2.*
316+
317+# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication packages
318+packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384} := abrowser-3.0 abrowser-3.5 abrowser-3.6 firefox-3.0 firefox-3.5 firefox-3.6 iceweasel
319+packages_{3550f703-e582-4d05-9a08-453d09bdfdc6} := icedove thunderbird thunderbird-3.0
320+packages_{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} := iceape seamonkey
321+packages_{a79fe89b-6662-4ff4-8e88-09950ad4dfde} := conkeror
322+packages_prism@developer.mozilla.org := prism
323+packages_toolkit@mozilla.org := xulrunner-1.9 xulrunner-1.9.1 xulrunner-1.9.2
324
325 # data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication min-/maxVersions
326-# FIXME: find a way to get this information
327 # call parameters_
328 # 1- target app id
329 # 2- maxVersion | minVersion
330 # 3- extension dir
331 TARGET_VERSION = $(shell xpath -q -e '//em:targetApplication/Description[em:id="$(1)" or @em:id="$(1)"]/em:$(2)/text() | //em:targetApplication/Description[em:id="$(1)" or @em:id="$(1)"]/@em:$(2)' $(3)/install.rdf)
332
333-# TODO: Use correct comparison
334-CHECK_VERSION = $(shell moz-version-compare $(call TARGET_VERSION,$(1),minVersion,$(TEMPDIR)) le $(2) && moz-version-compare $(2) le $(call TARGET_VERSION,$(1),maxVersion,$(TEMPDIR)) && echo $(target_packages_$(1)_$(2)))
335+# call parameters_
336+# 1- target app id
337+# 2- package name
338+CHECK_VERSION = $(shell \
339+ moz-version -cs "$($(2)_eol)" ge $(call TARGET_VERSION,$(1),minVersion,$(TEMPDIR)) && \
340+ moz-version -cs "$($(2)_sol)" le $(call TARGET_VERSION,$(1),maxVersion,$(TEMPDIR)) && \
341+ echo $(2))
342
343 MOZ_XPI_BUILD_COMMAND ?= med-xpi-pack $(CURDIR) $(MOZ_EXTENSION_PKG).xpi;
344
345 XPI_DEPENDS = $(sort $(foreach id,$(call XPI_TARGET_EMIDs,$(TEMPDIR)), \
346- $(foreach version,$(target_versions_$(id)),$(call CHECK_VERSION,$(id),$(version)))))
347+ $(foreach package,$(packages_$(id)),$(call CHECK_VERSION,$(id),$(package)))))
348
349 TEMPDIR := temp-xpi-unpacked
350

Subscribers

People subscribed via source and target branches

to all changes: