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
=== modified file 'debian/changelog'
--- debian/changelog 2009-07-29 08:47:47 +0000
+++ debian/changelog 2009-08-04 23:12:53 +0000
@@ -9,33 +9,16 @@
9 - update src/xpi.mk9 - update src/xpi.mk
10 - improve rule dependencies; avoid duplicate/circular depends10 - improve rule dependencies; avoid duplicate/circular depends
11 - update src/xpi.mk11 - update src/xpi.mk
12 - add automatic xpi depends .substvars feature based on smart parsing12 - first pitch on automagic max/min version detection implemented; add a
13 of install.rdf and checking min/maxVersion for each target application;13 generic |TARGET_VERSION| call taking parameters a) appid,
14 extensions can now use ${xpi:Depends} to get the right dependencies added;14 b) maxVersion|minVersion and c) extension-dir; this call is then used to
15 the version/package/targetAppId mapping information is currently maintained15 parse the right max/minVersion for a given targetApplication on demand in
16 in src/xpi.mk itself - thx to Benjamin Drung <bdrung@ubuntu.com> for this 16 |CHECK_VERSION|. In this way we now filter out unsuitable packages from
17 - update src/xpi.mk17 xpi:Depends based on the install.rdf version bounds
18 - first pitch on automagic max/min version detection implemented; add a generic18 - update src/xpi.mk
19 |TARGET_VERSION| call taking parameters a) appid, b) maxVersion|minVersion and
20 c) extension-dir; this call is then used to parse the right max/minVersion
21 for a given targetApplication on demand in |CHECK_VERSION|. In this way we
22 now filter out unsuitable packages from xpi:Depends based on the install.rdf
23 version bounds; Note: currently uses dpkg --compare-versions, which is wrong
24 for mozilla versions; but works good enough until with have a
25 mozpkg --compare-versions script
26 - update src/xpi.mk
27 - add moz-version-compare helper script and ship it in extra_files; this script
28 implements compare operations for mozilla versions as in
29 https://developer.mozilla.org/en/Toolkit_version_format; thanks to Benjamin
30 Drung <bdrung@ubuntu.com> for this contribution
31 - add src/moz-version-compare
32 - update src/Makefile
33 - add prism@developer.mozilla.org 1.0 to list of auto detected target19 - add prism@developer.mozilla.org 1.0 to list of auto detected target
34 application packages20 application packages
35 - update src/xpi.mk21 - update src/xpi.mk
36 - use moz-version-compare in ${xpi:Depends} |CHECK_VERSION| call
37 instead of the rather flawed dpkg --compare-versions approach.
38 - update src/xpi.mk
39 - add thunderbird-3.0 to list of auto detected target application packages22 - add thunderbird-3.0 to list of auto detected target application packages
40 - update src/xpi.mk23 - update src/xpi.mk
41 * build-system:24 * build-system:
@@ -45,7 +28,24 @@
45 - update src/Makefile28 - update src/Makefile
46 - update debian/mozilla-devscripts.install29 - update debian/mozilla-devscripts.install
4730
48 -- Alexander Sack <asac@ubuntu.com> Wed, 29 Jul 2009 01:08:07 +020031 [ Benjamin Drung ]
32 * xpi.mk:
33 - add automatic xpi depends .substvars feature based on smart parsing
34 of install.rdf and checking min/maxVersion for each target application;
35 extensions can now use ${xpi:Depends} to get the right dependencies added;
36 the version/package/targetAppId mapping information is currently
37 maintained in src/xpi.mk itself
38 - update src/xpi.mk
39 - add moz-version helper script and ship it in extra_files; this script
40 implements compare operations for mozilla versions as in
41 https://developer.mozilla.org/en/Toolkit_version_format
42 - add src/moz-version
43 - update src/Makefile
44 - implement start/end of life for comparing possible alternate binary
45 dependency
46 - update src/xpi.mk
47
48 -- Benjamin Drung <bdrung@ubuntu.com> Wed, 05 Aug 2009 01:01:31 +0200
4949
50mozilla-devscripts (0.13) unstable; urgency=low50mozilla-devscripts (0.13) unstable; urgency=low
5151
5252
=== modified file 'src/Makefile'
--- src/Makefile 2009-07-28 23:31:43 +0000
+++ src/Makefile 2009-08-03 23:37:38 +0000
@@ -53,7 +53,7 @@
53bindir_files = \53bindir_files = \
54 med-xpi-pack \54 med-xpi-pack \
55 med-xpi-unpack \55 med-xpi-unpack \
56 moz-version-compare56 moz-version
5757
58extra_dirs = \58extra_dirs = \
59 mozclient \59 mozclient \
6060
=== renamed file 'src/moz-version-compare' => 'src/moz-version'
--- src/moz-version-compare 2009-07-28 23:08:24 +0000
+++ src/moz-version 2009-08-03 23:37:38 +0000
@@ -22,8 +22,14 @@
2222
23# Reference: https://developer.mozilla.org/en/Toolkit_version_format23# Reference: https://developer.mozilla.org/en/Toolkit_version_format
2424
25import getopt
25import sys26import sys
2627
28# error codes
29COMMAND_LINE_SYNTAX_ERROR = 2
30INVALID_COMPARATOR = 3
31EMPTY_VERSION_STRING = 4
32
27def decode_part(part):33def decode_part(part):
28 """Decodes a version part (like 5pre4) to <number-a><string-b><number-c><string-d>"""34 """Decodes a version part (like 5pre4) to <number-a><string-b><number-c><string-d>"""
29 subpart = [0,"",0,""]35 subpart = [0,"",0,""]
@@ -74,13 +80,15 @@
7480
75 return subpart81 return subpart
7682
77def decode_version(version):83def decode_version(version, verbose=False):
78 """Decodes a version string like 1.1pre1a"""84 """Decodes a version string like 1.1pre1a"""
79 parts = version.split(".")85 parts = version.split(".")
80 decoded_parts = map(decode_part, parts)86 decoded_parts = map(decode_part, parts)
87 if verbose:
88 print "I: Split %s up into %s." % (version, decoded_parts)
81 return decoded_parts89 return decoded_parts
8290
83def compare((a, b)):91def compare_subpart((a, b)):
84 # A string-part that exists is always less-then a nonexisting string-part92 # A string-part that exists is always less-then a nonexisting string-part
85 if a == "":93 if a == "":
86 if b == "":94 if b == "":
@@ -96,7 +104,7 @@
96 return cmp(a, b)104 return cmp(a, b)
97105
98def compare_part((x, y)):106def compare_part((x, y)):
99 compared_subparts = filter(lambda x: x != 0, map(compare, zip(x, y)))107 compared_subparts = filter(lambda x: x != 0, map(compare_subpart, zip(x, y)))
100 if compared_subparts:108 if compared_subparts:
101 return compared_subparts[0]109 return compared_subparts[0]
102 else:110 else:
@@ -114,32 +122,94 @@
114 else:122 else:
115 return 0123 return 0
116124
117def moz_compare_versions(version1, operator, version2):125comparators = ("lt", "le", "eq", "ne", "ge", "gt")
118 """Return true if the expression version1 operator version2 is valid, otherwise false"""126
119 operators = ("lt", "le", "eq", "ne", "ge", "gt")127def moz_version_compare(version1, comparator, version2, silent=False, verbose=False):
120 if operator not in operators:128 """Return true if the expression version1 comparator version2 is valid, otherwise false"""
121 print "E: The operator " + operator + " is not valid. It should one of " + ", ".join(operators) + "."129 if comparator not in comparators:
122 sys.exit(2)130 if not silent:
123131 print >> sys.stderr, "E: The comparator " + comparator + \
124 a = decode_version(version1)132 " is not valid. It should one of " + ", ".join(comparators) + "."
125 b = decode_version(version2)133 sys.exit(INVALID_COMPARATOR)
126134
127 if operator == "lt":135 if version1.strip() == "" or version2.strip() == "":
136 if not silent:
137 print >> sys.stderr, "E: At least one version string is empty."
138 sys.exit(EMPTY_VERSION_STRING)
139
140 if verbose:
141 symbol = {"lt": "<", "le": "<=", "eq": "=", "ne": "!=", "ge": ">=", "gt": ">"}
142 print "I: Comparing %s %s %s." % (version1, symbol[comparator], version2)
143
144 a = decode_version(version1, verbose)
145 b = decode_version(version2, verbose)
146
147 if comparator == "lt":
128 return compare_versions(a, b) < 0148 return compare_versions(a, b) < 0
129 elif operator == "le":149 elif comparator == "le":
130 return compare_versions(a, b) <= 0150 return compare_versions(a, b) <= 0
131 elif operator == "eq":151 elif comparator == "eq":
132 return compare_versions(a, b) == 0152 return compare_versions(a, b) == 0
133 elif operator == "ne":153 elif comparator == "ne":
134 return compare_versions(a, b) != 0154 return compare_versions(a, b) != 0
135 elif operator == "ge":155 elif comparator == "ge":
136 return compare_versions(a, b) >= 0156 return compare_versions(a, b) >= 0
137 elif operator == "gt":157 elif comparator == "gt":
138 return compare_versions(a, b) > 0158 return compare_versions(a, b) > 0
139159
160
161def usage(output):
162 print >> output, """Usage: %s --compare version1 comparator version2
163
164 -h, --help display this help and exit
165 -s, --silent do not print anything and die silent on errors
166 -v, --verbose print more information
167
168comparator must be one of %s.""" % (sys.argv[0], ", ".join(comparators))
169
170
140if __name__ == "__main__":171if __name__ == "__main__":
141 if moz_compare_versions(sys.argv[1], sys.argv[2], sys.argv[3]):172 try:
142 sys.exit(0)173 long_opts = ["compare", "help", "silent", "verbose"]
174 opts, args = getopt.gnu_getopt(sys.argv[1:], "chsv", long_opts)
175 except getopt.GetoptError, e:
176 # print help information and exit:
177 print >> sys.stderr, str(e) # will print something like "option -a not recognized"
178 usage(sys.stderr)
179 sys.exit(COMMAND_LINE_SYNTAX_ERROR)
180
181 compare = False
182 silent = False
183 verbose = False
184
185 for o, a in opts:
186 if o in ("-c", "--compare"):
187 compare = True
188 elif o in ("-h", "--help"):
189 usage(sys.stdout)
190 sys.exit()
191 elif o in ("-s", "--silent"):
192 silent = True
193 elif o in ("-v", "--verbose"):
194 verbose = True
195 else:
196 assert False, "unhandled option"
197
198 if compare:
199 if len(args) != 3:
200 if not silent:
201 usage(sys.stderr)
202 sys.exit(COMMAND_LINE_SYNTAX_ERROR)
203 if moz_version_compare(args[0], args[1], args[2], silent, verbose):
204 if verbose:
205 print "I: Compare expression true."
206 sys.exit(0)
207 else:
208 if verbose:
209 print "I: Compare expression false."
210 sys.exit(1)
143 else:211 else:
144 sys.exit(1)212 if not silent:
145213 print >> sys.stderr, "E: You should specify the command --compare."
214 usage(sys.stderr)
215 sys.exit(COMMAND_LINE_SYNTAX_ERROR)
146216
=== modified file 'src/xpi.mk'
--- src/xpi.mk 2009-07-29 08:47:47 +0000
+++ src/xpi.mk 2009-08-04 22:59:15 +0000
@@ -3,6 +3,7 @@
3# Copyright (c) 2008-2009 Canonical Ltd.3# Copyright (c) 2008-2009 Canonical Ltd.
4# Author(s): Alexander Sack <asac@ubuntu.com>4# Author(s): Alexander Sack <asac@ubuntu.com>
5# Fabien Tassin <fta@sofaraway.org>5# Fabien Tassin <fta@sofaraway.org>
6# Benjamin Drung <bdrung@ubuntu.com>
6#7#
7# This program is free software; you can redistribute it and/or8# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License as9# modify it under the terms of the GNU General Public License as
@@ -62,34 +63,77 @@
62# your code to MOZ_XPI_MOZILLA_EXTRA_DIRS63# your code to MOZ_XPI_MOZILLA_EXTRA_DIRS
63#64#
6465
65# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication to package mapping66# data for XPI_DEPENDS/CHECK_VERSION magic - start/end of life of binary packages
66target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.0 := abrowser-3.0 firefox-3.0 iceweasel67abrowser-3.0_sol := 3.0a8
67target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.5 := abrowser-3.5 firefox-3.5 iceweasel68abrowser-3.0_eol := 3.0.*
68target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.6 := abrowser-3.6 firefox-3.669abrowser-3.5_sol := 3.5b4
69target_packages_{3550f703-e582-4d05-9a08-453d09bdfdc6}_2.0 := icedove thunderbird70abrowser-3.5_eol := 3.5.*
70target_packages_{3550f703-e582-4d05-9a08-453d09bdfdc6}_3.0 := icedove thunderbird-3.071abrowser-3.6_sol := 3.6a1pre
71target_packages_prism@developer.mozilla.org_1.0 := prism72abrowser-3.6_eol := 3.6.*
7273firefox-3.0_sol := 3.0a8
73# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication versions74firefox-3.0_eol := 3.0.*
74target_versions_{ec8030f7-c20a-464f-9b0e-13a3a9e97384} := 3.0 3.5 3.675firefox-3.5_sol := 3.5b4
75target_versions_{3550f703-e582-4d05-9a08-453d09bdfdc6} := 2.0 3.076firefox-3.5_eol := 3.5.*
76target_versions_prism@developer.mozilla.org := 1.077firefox-3.6_sol := 3.6a1pre
78firefox-3.6_eol := 3.6.*
79iceweasel_sol := 2.0
80iceweasel_eol := *
81
82icedove_sol := 1.5.0.7
83icedove_eol := *
84thunderbird_sol := 2.0
85thunderbird_eol := 2.0.0.*
86thunderbird-3.0_sol := 3.0a1pre
87thunderbird-3.0_eol := 3.0.*
88
89iceape_sol := 1.0.6
90iceape_eol := *
91seamonkey_sol := 1.1.6
92seamonkey_eol := *
93
94conkeror_sol := 0.9
95conkeror_eol := *
96
97prism_sol := 0.8
98prism_eol := *
99
100sunbird_sol := 0.5
101sunbird_eol := *
102
103xulrunner-1.9_sol := 1.9a1pre
104xulrunner-1.9_eol := 1.9.0.*
105xulrunner-1.9.1_sol := 1.9.1a1pre
106xulrunner-1.9.1_eol := 1.9.1.*
107xulrunner-1.9.2_sol := 1.9.2a1pre
108xulrunner-1.9.2_eol := 1.9.2.*
109
110# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication packages
111packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384} := abrowser-3.0 abrowser-3.5 abrowser-3.6 firefox-3.0 firefox-3.5 firefox-3.6 iceweasel
112packages_{3550f703-e582-4d05-9a08-453d09bdfdc6} := icedove thunderbird thunderbird-3.0
113packages_{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} := iceape seamonkey
114packages_{a79fe89b-6662-4ff4-8e88-09950ad4dfde} := conkeror
115packages_prism@developer.mozilla.org := prism
116packages_toolkit@mozilla.org := xulrunner-1.9 xulrunner-1.9.1 xulrunner-1.9.2
77117
78# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication min-/maxVersions118# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication min-/maxVersions
79# FIXME: find a way to get this information
80# call parameters_119# call parameters_
81# 1- target app id120# 1- target app id
82# 2- maxVersion | minVersion121# 2- maxVersion | minVersion
83# 3- extension dir122# 3- extension dir
84TARGET_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)123TARGET_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)
85124
86# TODO: Use correct comparison125# call parameters_
87CHECK_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)))126# 1- target app id
127# 2- package name
128CHECK_VERSION = $(shell \
129 moz-version -cs "$($(2)_eol)" ge $(call TARGET_VERSION,$(1),minVersion,$(TEMPDIR)) && \
130 moz-version -cs "$($(2)_sol)" le $(call TARGET_VERSION,$(1),maxVersion,$(TEMPDIR)) && \
131 echo $(2))
88132
89MOZ_XPI_BUILD_COMMAND ?= med-xpi-pack $(CURDIR) $(MOZ_EXTENSION_PKG).xpi;133MOZ_XPI_BUILD_COMMAND ?= med-xpi-pack $(CURDIR) $(MOZ_EXTENSION_PKG).xpi;
90134
91XPI_DEPENDS = $(sort $(foreach id,$(call XPI_TARGET_EMIDs,$(TEMPDIR)), \135XPI_DEPENDS = $(sort $(foreach id,$(call XPI_TARGET_EMIDs,$(TEMPDIR)), \
92 $(foreach version,$(target_versions_$(id)),$(call CHECK_VERSION,$(id),$(version)))))136 $(foreach package,$(packages_$(id)),$(call CHECK_VERSION,$(id),$(package)))))
93137
94TEMPDIR := temp-xpi-unpacked138TEMPDIR := temp-xpi-unpacked
95139

Subscribers

People subscribed via source and target branches

to all changes: