From 8cc86c290dcc62d179af9d5ab2c3b356db189eae Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Tue, 4 Aug 2009 01:37:38 +0200 Subject: rename moz-version-compare to moz-version. To compare two versions you have to run moz-version with the --compare parameter. Add --help parameter to show the usage help. - rename src/moz-version-compare to src/moz-version - update src/Makefile --- src/Makefile | 2 +- src/moz-version | 215 ++++++++++++++++++++++++++++++++++++++++++++++++ src/moz-version-compare | 145 -------------------------------- 3 files changed, 216 insertions(+), 146 deletions(-) create mode 100755 src/moz-version delete mode 100755 src/moz-version-compare diff --git a/src/Makefile b/src/Makefile index 09421f3..51e8ede 100644 --- a/src/Makefile +++ b/src/Makefile @@ -53,7 +53,7 @@ extra_files = \ bindir_files = \ med-xpi-pack \ med-xpi-unpack \ - moz-version-compare + moz-version extra_dirs = \ mozclient \ diff --git a/src/moz-version b/src/moz-version new file mode 100755 index 0000000..512ab8d --- /dev/null +++ b/src/moz-version @@ -0,0 +1,215 @@ +#!/usr/bin/python + +# Copyright (c) 2009 Benjamin Drung +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Reference: https://developer.mozilla.org/en/Toolkit_version_format + +import getopt +import sys + +# error codes +COMMAND_LINE_SYNTAX_ERROR = 2 +INVALID_COMPARATOR = 3 +EMPTY_VERSION_STRING = 4 + +def decode_part(part): + """Decodes a version part (like 5pre4) to """ + subpart = [0,"",0,""] + + # Split + length = 0 + for i in xrange(len(part)): + if part[i].isdigit() or part[i] in ("-"): + length += 1 + else: + break + if length > 0: + subpart[0] = int(part[0:length]) + part = part[length:] + + # Split + length = 0 + for i in xrange(len(part)): + if not (part[i].isdigit() or part[i] in ("-")): + length += 1 + else: + break + subpart[1] = part[0:length] + part = part[length:] + + # Split + length = 0 + for i in xrange(len(part)): + if part[i].isdigit() or part[i] in ("-"): + length += 1 + else: + break + if length > 0: + subpart[2] = int(part[0:length]) + subpart[3] = part[length:] + + # if string-b is a plus sign, number-a is incremented to be compatible with + # the Firefox 1.0.x version format: 1.0+ is the same as 1.1pre + if subpart[1] == "+": + subpart[0] += 1 + subpart[1] = "pre" + + # if the version part is a single asterisk, it is interpreted as an + # infinitely-large number: 1.5.0.* is the same as 1.5.0.(infinity) + if subpart[1] == "*": + subpart[0] = sys.maxint + subpart[1] = "" + + return subpart + +def decode_version(version, verbose=False): + """Decodes a version string like 1.1pre1a""" + parts = version.split(".") + decoded_parts = map(decode_part, parts) + if verbose: + print "I: Split %s up into %s." % (version, decoded_parts) + return decoded_parts + +def compare_subpart((a, b)): + # A string-part that exists is always less-then a nonexisting string-part + if a == "": + if b == "": + return 0 + else: + return 1 + elif b == "": + if a == "": + return 0 + else: + return -1 + else: + return cmp(a, b) + +def compare_part((x, y)): + compared_subparts = filter(lambda x: x != 0, map(compare_subpart, zip(x, y))) + if compared_subparts: + return compared_subparts[0] + else: + return 0 + +def compare_versions(a, b): + if len(a) < len(b): + a.extend((len(b) - len(a)) * [[0,"",0,""]]) + if len(b) < len(a): + b.extend((len(a) - len(b)) * [[0,"",0,""]]) + + result = filter(lambda x: x != 0, map(compare_part, zip(a, b))) + if result: + return result[0] + else: + return 0 + +comparators = ("lt", "le", "eq", "ne", "ge", "gt") + +def moz_version_compare(version1, comparator, version2, silent=False, verbose=False): + """Return true if the expression version1 comparator version2 is valid, otherwise false""" + if comparator not in comparators: + if not silent: + print >> sys.stderr, "E: The comparator " + comparator + \ + " is not valid. It should one of " + ", ".join(comparators) + "." + sys.exit(INVALID_COMPARATOR) + + if version1.strip() == "" or version2.strip() == "": + if not silent: + print >> sys.stderr, "E: At least one version string is empty." + sys.exit(EMPTY_VERSION_STRING) + + if verbose: + symbol = {"lt": "<", "le": "<=", "eq": "=", "ne": "!=", "ge": ">=", "gt": ">"} + print "I: Comparing %s %s %s." % (version1, symbol[comparator], version2) + + a = decode_version(version1, verbose) + b = decode_version(version2, verbose) + + if comparator == "lt": + return compare_versions(a, b) < 0 + elif comparator == "le": + return compare_versions(a, b) <= 0 + elif comparator == "eq": + return compare_versions(a, b) == 0 + elif comparator == "ne": + return compare_versions(a, b) != 0 + elif comparator == "ge": + return compare_versions(a, b) >= 0 + elif comparator == "gt": + return compare_versions(a, b) > 0 + + +def usage(output): + print >> output, """Usage: %s --compare version1 comparator version2 + + -h, --help display this help and exit + -s, --silent do not print anything and die silent on errors + -v, --verbose print more information + +comparator must be one of %s.""" % (sys.argv[0], ", ".join(comparators)) + + +if __name__ == "__main__": + try: + long_opts = ["compare", "help", "silent", "verbose"] + opts, args = getopt.gnu_getopt(sys.argv[1:], "chsv", long_opts) + except getopt.GetoptError, e: + # print help information and exit: + print >> sys.stderr, str(e) # will print something like "option -a not recognized" + usage(sys.stderr) + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + + compare = False + silent = False + verbose = False + + for o, a in opts: + if o in ("-c", "--compare"): + compare = True + elif o in ("-h", "--help"): + usage(sys.stdout) + sys.exit() + elif o in ("-s", "--silent"): + silent = True + elif o in ("-v", "--verbose"): + verbose = True + else: + assert False, "unhandled option" + + if compare: + if len(args) != 3: + if not silent: + usage(sys.stderr) + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + if moz_version_compare(args[0], args[1], args[2], silent, verbose): + if verbose: + print "I: Compare expression true." + sys.exit(0) + else: + if verbose: + print "I: Compare expression false." + sys.exit(1) + else: + if not silent: + print >> sys.stderr, "E: You should specify the command --compare." + usage(sys.stderr) + sys.exit(COMMAND_LINE_SYNTAX_ERROR) diff --git a/src/moz-version-compare b/src/moz-version-compare deleted file mode 100755 index 6301053..0000000 --- a/src/moz-version-compare +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2009 Benjamin Drung -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -# Reference: https://developer.mozilla.org/en/Toolkit_version_format - -import sys - -def decode_part(part): - """Decodes a version part (like 5pre4) to """ - subpart = [0,"",0,""] - - # Split - length = 0 - for i in xrange(len(part)): - if part[i].isdigit() or part[i] in ("-"): - length += 1 - else: - break - if length > 0: - subpart[0] = int(part[0:length]) - part = part[length:] - - # Split - length = 0 - for i in xrange(len(part)): - if not (part[i].isdigit() or part[i] in ("-")): - length += 1 - else: - break - subpart[1] = part[0:length] - part = part[length:] - - # Split - length = 0 - for i in xrange(len(part)): - if part[i].isdigit() or part[i] in ("-"): - length += 1 - else: - break - if length > 0: - subpart[2] = int(part[0:length]) - subpart[3] = part[length:] - - # if string-b is a plus sign, number-a is incremented to be compatible with - # the Firefox 1.0.x version format: 1.0+ is the same as 1.1pre - if subpart[1] == "+": - subpart[0] += 1 - subpart[1] = "pre" - - # if the version part is a single asterisk, it is interpreted as an - # infinitely-large number: 1.5.0.* is the same as 1.5.0.(infinity) - if subpart[1] == "*": - subpart[0] = sys.maxint - subpart[1] = "" - - return subpart - -def decode_version(version): - """Decodes a version string like 1.1pre1a""" - parts = version.split(".") - decoded_parts = map(decode_part, parts) - return decoded_parts - -def compare((a, b)): - # A string-part that exists is always less-then a nonexisting string-part - if a == "": - if b == "": - return 0 - else: - return 1 - elif b == "": - if a == "": - return 0 - else: - return -1 - else: - return cmp(a, b) - -def compare_part((x, y)): - compared_subparts = filter(lambda x: x != 0, map(compare, zip(x, y))) - if compared_subparts: - return compared_subparts[0] - else: - return 0 - -def compare_versions(a, b): - if len(a) < len(b): - a.extend((len(b) - len(a)) * [[0,"",0,""]]) - if len(b) < len(a): - b.extend((len(a) - len(b)) * [[0,"",0,""]]) - - result = filter(lambda x: x != 0, map(compare_part, zip(a, b))) - if result: - return result[0] - else: - return 0 - -def moz_compare_versions(version1, operator, version2): - """Return true if the expression version1 operator version2 is valid, otherwise false""" - operators = ("lt", "le", "eq", "ne", "ge", "gt") - if operator not in operators: - print "E: The operator " + operator + " is not valid. It should one of " + ", ".join(operators) + "." - sys.exit(2) - - a = decode_version(version1) - b = decode_version(version2) - - if operator == "lt": - return compare_versions(a, b) < 0 - elif operator == "le": - return compare_versions(a, b) <= 0 - elif operator == "eq": - return compare_versions(a, b) == 0 - elif operator == "ne": - return compare_versions(a, b) != 0 - elif operator == "ge": - return compare_versions(a, b) >= 0 - elif operator == "gt": - return compare_versions(a, b) > 0 - -if __name__ == "__main__": - if moz_compare_versions(sys.argv[1], sys.argv[2], sys.argv[3]): - sys.exit(0) - else: - sys.exit(1) - -- cgit v1.2.3 From caa16968cd4fa20dd3772a7eb8576e98068b06a0 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 5 Aug 2009 00:59:15 +0200 Subject: implement start/end of life for comparing possible alternate binary dependency. - update src/xpi.mk --- src/xpi.mk | 76 +++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/src/xpi.mk b/src/xpi.mk index 9ff3db2..820605e 100644 --- a/src/xpi.mk +++ b/src/xpi.mk @@ -3,6 +3,7 @@ # Copyright (c) 2008-2009 Canonical Ltd. # Author(s): Alexander Sack # Fabien Tassin +# Benjamin Drung # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -62,34 +63,77 @@ # your code to MOZ_XPI_MOZILLA_EXTRA_DIRS # -# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication to package mapping -target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.0 := abrowser-3.0 firefox-3.0 iceweasel -target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.5 := abrowser-3.5 firefox-3.5 iceweasel -target_packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384}_3.6 := abrowser-3.6 firefox-3.6 -target_packages_{3550f703-e582-4d05-9a08-453d09bdfdc6}_2.0 := icedove thunderbird -target_packages_{3550f703-e582-4d05-9a08-453d09bdfdc6}_3.0 := icedove thunderbird-3.0 -target_packages_prism@developer.mozilla.org_1.0 := prism - -# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication versions -target_versions_{ec8030f7-c20a-464f-9b0e-13a3a9e97384} := 3.0 3.5 3.6 -target_versions_{3550f703-e582-4d05-9a08-453d09bdfdc6} := 2.0 3.0 -target_versions_prism@developer.mozilla.org := 1.0 +# data for XPI_DEPENDS/CHECK_VERSION magic - start/end of life of binary packages +abrowser-3.0_sol := 3.0a8 +abrowser-3.0_eol := 3.0.* +abrowser-3.5_sol := 3.5b4 +abrowser-3.5_eol := 3.5.* +abrowser-3.6_sol := 3.6a1pre +abrowser-3.6_eol := 3.6.* +firefox-3.0_sol := 3.0a8 +firefox-3.0_eol := 3.0.* +firefox-3.5_sol := 3.5b4 +firefox-3.5_eol := 3.5.* +firefox-3.6_sol := 3.6a1pre +firefox-3.6_eol := 3.6.* +iceweasel_sol := 2.0 +iceweasel_eol := * + +icedove_sol := 1.5.0.7 +icedove_eol := * +thunderbird_sol := 2.0 +thunderbird_eol := 2.0.0.* +thunderbird-3.0_sol := 3.0a1pre +thunderbird-3.0_eol := 3.0.* + +iceape_sol := 1.0.6 +iceape_eol := * +seamonkey_sol := 1.1.6 +seamonkey_eol := * + +conkeror_sol := 0.9 +conkeror_eol := * + +prism_sol := 0.8 +prism_eol := * + +sunbird_sol := 0.5 +sunbird_eol := * + +xulrunner-1.9_sol := 1.9a1pre +xulrunner-1.9_eol := 1.9.0.* +xulrunner-1.9.1_sol := 1.9.1a1pre +xulrunner-1.9.1_eol := 1.9.1.* +xulrunner-1.9.2_sol := 1.9.2a1pre +xulrunner-1.9.2_eol := 1.9.2.* + +# data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication packages +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 +packages_{3550f703-e582-4d05-9a08-453d09bdfdc6} := icedove thunderbird thunderbird-3.0 +packages_{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} := iceape seamonkey +packages_{a79fe89b-6662-4ff4-8e88-09950ad4dfde} := conkeror +packages_prism@developer.mozilla.org := prism +packages_toolkit@mozilla.org := xulrunner-1.9 xulrunner-1.9.1 xulrunner-1.9.2 # data for XPI_DEPENDS/CHECK_VERSION magic - targetApplication min-/maxVersions -# FIXME: find a way to get this information # call parameters_ # 1- target app id # 2- maxVersion | minVersion # 3- extension dir 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) -# TODO: Use correct comparison -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))) +# call parameters_ +# 1- target app id +# 2- package name +CHECK_VERSION = $(shell \ + moz-version -cs "$($(2)_eol)" ge $(call TARGET_VERSION,$(1),minVersion,$(TEMPDIR)) && \ + moz-version -cs "$($(2)_sol)" le $(call TARGET_VERSION,$(1),maxVersion,$(TEMPDIR)) && \ + echo $(2)) MOZ_XPI_BUILD_COMMAND ?= med-xpi-pack $(CURDIR) $(MOZ_EXTENSION_PKG).xpi; XPI_DEPENDS = $(sort $(foreach id,$(call XPI_TARGET_EMIDs,$(TEMPDIR)), \ - $(foreach version,$(target_versions_$(id)),$(call CHECK_VERSION,$(id),$(version))))) + $(foreach package,$(packages_$(id)),$(call CHECK_VERSION,$(id),$(package))))) TEMPDIR := temp-xpi-unpacked -- cgit v1.2.3 From 4e11323a40102ab725316a67fd5d324fbd31153f Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 5 Aug 2009 01:09:26 +0200 Subject: update debian/changelog --- debian/changelog | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/debian/changelog b/debian/changelog index ae09488..b631ac0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,33 +9,16 @@ mozilla-devscripts (0.14) UNRELEASED; urgency=low - update src/xpi.mk - improve rule dependencies; avoid duplicate/circular depends - update src/xpi.mk - - add automatic xpi depends .substvars feature based on smart parsing - of install.rdf and checking min/maxVersion for each target application; - extensions can now use ${xpi:Depends} to get the right dependencies added; - the version/package/targetAppId mapping information is currently maintained - in src/xpi.mk itself - thx to Benjamin Drung for this - - update src/xpi.mk - first pitch on automagic max/min version detection implemented; add a generic |TARGET_VERSION| call taking parameters a) appid, b) maxVersion|minVersion and c) extension-dir; this call is then used to parse the right max/minVersion for a given targetApplication on demand in |CHECK_VERSION|. In this way we now filter out unsuitable packages from xpi:Depends based on the install.rdf - version bounds; Note: currently uses dpkg --compare-versions, which is wrong - for mozilla versions; but works good enough until with have a - mozpkg --compare-versions script + version bounds - update src/xpi.mk - - add moz-version-compare helper script and ship it in extra_files; this script - implements compare operations for mozilla versions as in - https://developer.mozilla.org/en/Toolkit_version_format; thanks to Benjamin - Drung for this contribution - - add src/moz-version-compare - - update src/Makefile - add prism@developer.mozilla.org 1.0 to list of auto detected target application packages - update src/xpi.mk - - use moz-version-compare in ${xpi:Depends} |CHECK_VERSION| call - instead of the rather flawed dpkg --compare-versions approach. - - update src/xpi.mk - add thunderbird-3.0 to list of auto detected target application packages - update src/xpi.mk * build-system: @@ -45,7 +28,24 @@ mozilla-devscripts (0.14) UNRELEASED; urgency=low - update src/Makefile - update debian/mozilla-devscripts.install - -- Alexander Sack Wed, 29 Jul 2009 01:08:07 +0200 + [ Benjamin Drung ] + * xpi.mk: + - add automatic xpi depends .substvars feature based on smart parsing + of install.rdf and checking min/maxVersion for each target application; + extensions can now use ${xpi:Depends} to get the right dependencies added; + the version/package/targetAppId mapping information is currently + maintained in src/xpi.mk itself + - update src/xpi.mk + - add moz-version helper script and ship it in extra_files; this script + implements compare operations for mozilla versions as in + https://developer.mozilla.org/en/Toolkit_version_format + - add src/moz-version + - update src/Makefile + - implement start/end of life for comparing possible alternate binary + dependency + - update src/xpi.mk + + -- Benjamin Drung Wed, 05 Aug 2009 01:01:31 +0200 mozilla-devscripts (0.13) unstable; urgency=low -- cgit v1.2.3 From 2c5a247ce70647cf38908e9b459c9d68838b3fa8 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 5 Aug 2009 01:12:53 +0200 Subject: shorten too long debian/changelog entry --- debian/changelog | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index b631ac0..6a776f2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,12 +9,12 @@ mozilla-devscripts (0.14) UNRELEASED; urgency=low - update src/xpi.mk - improve rule dependencies; avoid duplicate/circular depends - update src/xpi.mk - - first pitch on automagic max/min version detection implemented; add a generic - |TARGET_VERSION| call taking parameters a) appid, b) maxVersion|minVersion and - c) extension-dir; this call is then used to parse the right max/minVersion - for a given targetApplication on demand in |CHECK_VERSION|. In this way we - now filter out unsuitable packages from xpi:Depends based on the install.rdf - version bounds + - first pitch on automagic max/min version detection implemented; add a + generic |TARGET_VERSION| call taking parameters a) appid, + b) maxVersion|minVersion and c) extension-dir; this call is then used to + parse the right max/minVersion for a given targetApplication on demand in + |CHECK_VERSION|. In this way we now filter out unsuitable packages from + xpi:Depends based on the install.rdf version bounds - update src/xpi.mk - add prism@developer.mozilla.org 1.0 to list of auto detected target application packages -- cgit v1.2.3 From db2b2dcc551d426d4ab0b9c4ce74f1d209b06f44 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Thu, 6 Aug 2009 03:31:11 +0200 Subject: - 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 --- debian/changelog | 5 ++++- src/xpi.mk | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6a776f2..cf122ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -44,8 +44,11 @@ mozilla-devscripts (0.14) UNRELEASED; urgency=low - implement start/end of life for comparing possible alternate binary dependency - update src/xpi.mk + - 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 - -- Benjamin Drung Wed, 05 Aug 2009 01:01:31 +0200 + -- Benjamin Drung Thu, 06 Aug 2009 03:26:18 +0200 mozilla-devscripts (0.13) unstable; urgency=low diff --git a/src/xpi.mk b/src/xpi.mk index 820605e..cfe2aaf 100644 --- a/src/xpi.mk +++ b/src/xpi.mk @@ -24,8 +24,10 @@ # Usage: include this file in your cdbs debian/rules file and define the # following variables: # -# MOZ_EXTENSION_PKG (MANDATORY): -# define the binary package name used to ship this xpi +# MOZ_EXTENSION_PKG (OPTIONAL): +# if defined the given binary package name is used to ship this +# xpi; otherwise the first binary package listed in debian/control +# is used # # MOZ_XPI_FILE (OPTIONAL): # if defined the given .xpi file is used; otherwise we try to @@ -135,6 +137,8 @@ MOZ_XPI_BUILD_COMMAND ?= med-xpi-pack $(CURDIR) $(MOZ_EXTENSION_PKG).xpi; XPI_DEPENDS = $(sort $(foreach id,$(call XPI_TARGET_EMIDs,$(TEMPDIR)), \ $(foreach package,$(packages_$(id)),$(call CHECK_VERSION,$(id),$(package))))) +MOZ_EXTENSION_PKG ?= $(strip $(shell grep ^Package: debian/control | head -n 1 | sed "s/^Package://")) + TEMPDIR := temp-xpi-unpacked ifneq (,$(MOZ_XPI_FILE)) -- cgit v1.2.3