From ed6eede32a507daa779a1a0580681c3c7b333477 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 30 Dec 2009 00:58:00 +0100 Subject: - Convert xpi-data-*.mk files into xul-app-data.csv* files for dh_xul-ext - remove src/xpi-config.mk.in - remove src/xpi-data-Debian.mk - remove src/xpi-data-Ubuntu.mk - remove src/xpi-data-all.mk - remove src/xpi-data-common.mk - add src/xul-app-data.csv.Debian - add src/xul-app-data.csv.Ubuntu - update src/Makefile --- src/Makefile | 7 +--- src/dh_xul-ext | 95 ++++++++++++++------------------------------- src/xpi-config.mk.in | 20 ---------- src/xpi-data-Debian.mk | 40 ------------------- src/xpi-data-Ubuntu.mk | 58 --------------------------- src/xpi-data-all.mk | 28 ------------- src/xpi-data-common.mk | 34 ---------------- src/xul-app-data.csv.Debian | 7 ++++ src/xul-app-data.csv.Ubuntu | 14 +++++++ 9 files changed, 51 insertions(+), 252 deletions(-) delete mode 100644 src/xpi-config.mk.in delete mode 100644 src/xpi-data-Debian.mk delete mode 100644 src/xpi-data-Ubuntu.mk delete mode 100644 src/xpi-data-all.mk delete mode 100644 src/xpi-data-common.mk create mode 100644 src/xul-app-data.csv.Debian create mode 100644 src/xul-app-data.csv.Ubuntu (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 2939e28..94449e4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -43,17 +43,12 @@ subst_files = \ mozclient.mk \ compare.mk \ minefield-packager.mk \ - xpi-config.mk \ xulapp.mk \ $(NULL) extra_files = \ lp-locale-export.mk \ xpi.mk \ - xpi-data-all.mk \ - xpi-data-common.mk \ - xpi-data-Debian.mk \ - xpi-data-Ubuntu.mk \ $(NULL) bindir_files = \ @@ -76,7 +71,6 @@ extra_dirs = \ -e "s|^\(MOZCLIENT_EXCLUDE_SCRIPT.*=[ ][ ]*\)\(.*/\)\(.*\)|\1$(DATADIR)/\3|" \ -e "s|^\(MOZCLIENT_PATCHES.*=[ ][ ]*\)\(.*/\)\(.*\)|\1$(DATADIR)/\3|" \ -e "s|^\(MOZDEVSCRIPT_DIR.*=[ ]*\)\(.*\)|\1$(DATADIR)/\2|" \ - -e "s|@DISTRO@|$(shell lsb_release -si)|" \ > $@ chmod 644 $@ @@ -97,6 +91,7 @@ install: $(subst_files) $(extra_files) $(foreach dir,$(extra_dirs),$(wildcard $( done find $(DESTDIR)$(DATADIR) -type f \( -name \*.pl -o -name \*.sh \) -exec chmod -v 755 {} \; chmod 755 $(DESTDIR)$(DATADIR)/minefield-packager.mk + install -m 644 xul-app-data.csv.$(shell lsb_release -si) $(DESTDIR)$(DATADIR)/xul-app-data.csv install-man: install -D -m 644 ../man/moz-version.1 $(DESTDIR)$(MANDIR)/man1/moz-version.1 diff --git a/src/dh_xul-ext b/src/dh_xul-ext index c2a9980..39c10d8 100755 --- a/src/dh_xul-ext +++ b/src/dh_xul-ext @@ -20,13 +20,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +import csv import getopt import glob import os import subprocess import sys -from moz_version import compare_versions, convert_debian_to_moz_version +from moz_version import compare_versions from rdflib import Namespace from rdflib.Graph import Graph @@ -36,53 +37,14 @@ COMMAND_LINE_SYNTAX_ERROR = 1 MULTIPLE_INSTALL_RDFs = 2 def get_xul_apps(): - # TODO: patch packages - return [("xulrunner-1.9", "", "toolkit@mozilla.org", "1.9.0.*"), - ("xulrunner-1.9.1", "1.9.1.5+nobinonly-0ubuntu0.9.10.1", "toolkit@mozilla.org", "1.9.1.*"), - ("firefox-3.6", "3.6~b1-0ubuntu1", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.6.*"), - ("abrowser-3.6", "3.6~b1-0ubuntu1", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.6.*"), - ("firefox-3.5", "3.5.3+build1+nobinonly-0ubuntu6", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.5.*"), - ("abrowser-3.5", "3.5.3+build1+nobinonly-0ubuntu6", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.5.*"), - ("firefox-3.0", "3.0.0.14", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.0.*"), - ("thunderbird-3.0", "3.0-0ubuntu1", "{3550f703-e582-4d05-9a08-453d09bdfdc6}", "3.0.*"), - ("thunderbird", "2.0.0.14", "{3550f703-e582-4d05-9a08-453d09bdfdc6}", "2.*")] - packages = list() - for filename in glob.glob("/var/lib/apt/lists/*_Packages"): - with open(filename) as f: - package_name = None - version = None - xul_appid = None - xul_eol = "*" - for line in f: - if line == "\n": - if xul_appid is not None: - # find duplicates and keep older version - found_duplicate = False - for i in xrange(len(packages) - 1, -1, -1): - if packages[i][0] == package_name: - command = ['dpkg', '--compare-versions', version, 'lt', packages[i][1]] - if subprocess.call(command) == 0: - del packages[i] - else: - found_duplicate = True - break - if not found_duplicate: - packages.append([package_name, version, xul_appid, xul_eol]) - package_name = None - version = None - xul_appid = None - xul_eol = "*" - elif line.startswith("Package:"): - package_name = line[line.find(":")+1:].strip() - elif line.startswith("Version:"): - version = line[line.find(":")+1:].strip() - elif line.startswith("Xul-AppId"): - xul_appid = line[line.find(":")+1:].strip() - elif line.startswith("Xul-Eol"): - xul_eol = line[line.find(":")+1:].strip() - return sorted(packages) - -def get_supported_apps(xul_apps, install_rdf, package, verbose=False): + csvfile = open("/usr/share/mozilla-devscripts/xul-app-data.csv") + csv_reader = csv.DictReader(csvfile) + rows = [] + for row in csv_reader: + rows.append(row) + return rows + +def get_supported_apps(script_name, xul_apps, install_rdf, package, verbose=False): # create array of id_max_min triples id_max_min = [] rdf_graph = Graph() @@ -105,30 +67,29 @@ def get_supported_apps(xul_apps, install_rdf, package, verbose=False): id_max_min.append (( str(target[0]), str(target[1]), str (target[2]) )) if verbose: - print "%s: %i supported XUL applications:" % (sys.argv[0], len(id_max_min)) + print "%s: %s supports %i XUL application(s):" % (script_name, package, len(id_max_min)) for (appid, max_version, min_version) in id_max_min: print "%s %s to %s" % (appid, min_version, max_version) # find supported apps/packages supported_apps = list() - for (package_name, version, xul_appid, xul_eol) in xul_apps: - supported_app = filter(lambda x: x[0] == xul_appid, id_max_min) + for xul_app in xul_apps: + supported_app = filter(lambda x: x[0] == xul_app["id"], id_max_min) if len(supported_app) == 1: # package is supported by extension (appid, max_version, min_version) = supported_app.pop() - xul_sol = convert_debian_to_moz_version(version) - if compare_versions(xul_sol, max_version) <= 0: - if compare_versions(xul_eol, min_version) >= 0: - supported_apps.append(package_name) + if compare_versions(xul_app["sol"], max_version) <= 0: + if compare_versions(xul_app["eol"], min_version) >= 0: + supported_apps.append(xul_app["package"]) if verbose: - print "%s: %s supports %s." % (sys.argv[0], package, package_name) + print "%s: %s supports %s." % (script_name, package, xul_app["package"]) elif verbose: - print "%s: %s does not support %s (any more)." % (sys.argv[0], package, package_name) + print "%s: %s does not support %s (any more)." % (script_name, package, xul_app["package"]) elif verbose: - print "%s: %s does not support %s (yet)." % (sys.argv[0], package, package_name) + print "%s: %s does not support %s (yet)." % (script_name, package, xul_app["package"]) elif len(supported_app) > 1: print "%s: Found error in %s. There are multiple entries for application ID %s." % \ - (sys.argv[0], install_rdf, xul_appid) + (script_name, install_rdf, xul_app["id"]) return supported_apps @@ -191,13 +152,13 @@ def find_install_rdfs(path): return install_rdfs -def generate_substvars(xul_apps, package, verbose=False): +def generate_substvars(script_name, xul_apps, package, verbose=False): install_rdfs = find_install_rdfs("debian/" + package) if len(install_rdfs) == 0: # this package does not contain a xul extension return elif len(install_rdfs) > 1: - print >> sys.stderr, "%s: %s contains multiple install.rdf files. That's not supported." % (sys.argv[0], package) + print >> sys.stderr, "%s: %s contains multiple install.rdf files. That's not supported." % (script_name, package) sys.exit(MULTIPLE_INSTALL_RDFs) install_rdf = install_rdfs.pop() @@ -212,7 +173,7 @@ def generate_substvars(xul_apps, package, verbose=False): # remove existing varibles lines = filter(lambda s: not s.startswith("xpi:"), lines) - packages = get_supported_apps(xul_apps, install_rdf, package, verbose) + packages = get_supported_apps(script_name, xul_apps, install_rdf, package, verbose) lines.append("xpi:Recommends=" + " | ".join(packages) + "\n") lines.append("xpi:Enhances=" + ", ".join(sorted(packages)) + "\n") packages = get_provided_package_names(package, packages) @@ -250,14 +211,16 @@ if __name__ == "__main__": if len(packages) == 0: packages = get_all_packages() + script_name = os.path.basename(sys.argv[0]) + if verbose: - print sys.argv[0] + ": packages:", ", ".join(packages) + print script_name + ": packages:", ", ".join(packages) xul_apps = get_xul_apps() if verbose and len(xul_apps) > 0: - print sys.argv[0] + ": found %i Xul applications:" % (len(xul_apps)) + print script_name + ": found %i Xul applications:" % (len(xul_apps)) for xul_app in xul_apps: - print xul_app[0] + " " + xul_app[1] + " (" + xul_app[2] + ")" + print xul_app["id"] + ": " + xul_app["package"] + " (" + xul_app["sol"] + " to " + xul_app["eol"] + ")" for package in packages: - generate_substvars(xul_apps, package, verbose) + generate_substvars(script_name, xul_apps, package, verbose) diff --git a/src/xpi-config.mk.in b/src/xpi-config.mk.in deleted file mode 100644 index 864f081..0000000 --- a/src/xpi-config.mk.in +++ /dev/null @@ -1,20 +0,0 @@ -# -*- mode: makefile; coding: utf-8 -*- - -# Copyright (c) 2009 Canonical Ltd. -# Author(s): 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 -# published by the Free Software Foundation; either version 2, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -MOZ_XPI_DISTRO ?= @DISTRO@ diff --git a/src/xpi-data-Debian.mk b/src/xpi-data-Debian.mk deleted file mode 100644 index 2370414..0000000 --- a/src/xpi-data-Debian.mk +++ /dev/null @@ -1,40 +0,0 @@ -# -*- mode: makefile; coding: utf-8 -*- - -# Copyright (c) 2009 Canonical Ltd. -# Author(s): 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 -# published by the Free Software Foundation; either version 2, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -_xpi_makefile_path ?= /usr/share/mozilla-devscripts - -ifndef _xpi_data_Debian -_xpi_data_Debian = 1 - -include $(_xpi_makefile_path)/xpi-data-common.mk - -iceweasel_sol := 2.0 -iceweasel_eol := * - -icedove_sol := 1.5.0.7 -icedove_eol := * - -iceape_sol := 1.0.6 -iceape_eol := * - -packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384} += iceweasel -packages_{3550f703-e582-4d05-9a08-453d09bdfdc6} += icedove -packages_{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} += iceape - -endif diff --git a/src/xpi-data-Ubuntu.mk b/src/xpi-data-Ubuntu.mk deleted file mode 100644 index 2998b3c..0000000 --- a/src/xpi-data-Ubuntu.mk +++ /dev/null @@ -1,58 +0,0 @@ -# -*- mode: makefile; coding: utf-8 -*- - -# Copyright (c) 2009 Canonical Ltd. -# Author(s): 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 -# published by the Free Software Foundation; either version 2, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -_xpi_makefile_path ?= /usr/share/mozilla-devscripts - -ifndef _xpi_data_Ubuntu -_xpi_data_Ubuntu = 1 - -include $(_xpi_makefile_path)/xpi-data-common.mk - -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.* - -thunderbird_sol := 2.0 -thunderbird_eol := 2.0.0.* -thunderbird-3.0_sol := 3.0a1pre -thunderbird-3.0_eol := 3.0.* - -seamonkey_sol := 1.1.6 -seamonkey_eol := * - -sunbird_sol := 0.5 -sunbird_eol := * - -prism_sol := 0.8 -prism_eol := * - -packages_{ec8030f7-c20a-464f-9b0e-13a3a9e97384} += firefox-3.6 abrowser-3.6 firefox-3.5 abrowser-3.5 firefox-3.0 -packages_{3550f703-e582-4d05-9a08-453d09bdfdc6} += thunderbird-3.0 thunderbird -packages_{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} += seamonkey -packages_{e2fda1a4-762b-4020-b5ad-a41df1933103} += sunbird -packages_prism@developer.mozilla.org += prism - -endif diff --git a/src/xpi-data-all.mk b/src/xpi-data-all.mk deleted file mode 100644 index 173f8fa..0000000 --- a/src/xpi-data-all.mk +++ /dev/null @@ -1,28 +0,0 @@ -# -*- mode: makefile; coding: utf-8 -*- - -# Copyright (c) 2009 Canonical Ltd. -# Author(s): 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 -# published by the Free Software Foundation; either version 2, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -_xpi_makefile_path ?= /usr/share/mozilla-devscripts - -ifndef _xpi_data_all -_xpi_data_all = 1 - -include $(_xpi_makefile_path)/xpi-data-Debian.mk -include $(_xpi_makefile_path)/xpi-data-Ubuntu.mk - -endif diff --git a/src/xpi-data-common.mk b/src/xpi-data-common.mk deleted file mode 100644 index 8d984e2..0000000 --- a/src/xpi-data-common.mk +++ /dev/null @@ -1,34 +0,0 @@ -# -*- mode: makefile; coding: utf-8 -*- - -# Copyright (c) 2009 Canonical Ltd. -# Author(s): 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 -# published by the Free Software Foundation; either version 2, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -ifndef _xpi_data_common -_xpi_data_common = 1 - -conkeror_sol := 0.9 -conkeror_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.* - -packages_{a79fe89b-6662-4ff4-8e88-09950ad4dfde} += conkeror -packages_toolkit@mozilla.org += xulrunner-1.9.1 xulrunner-1.9 - -endif diff --git a/src/xul-app-data.csv.Debian b/src/xul-app-data.csv.Debian new file mode 100644 index 0000000..4196fab --- /dev/null +++ b/src/xul-app-data.csv.Debian @@ -0,0 +1,7 @@ +id,package,sol,eol +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},iceweasel,2.0,* +{3550f703-e582-4d05-9a08-453d09bdfdc6},icedove,1.5.0.7,* +{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a},iceape,1.0.6,* +{a79fe89b-6662-4ff4-8e88-09950ad4dfde},conkeror,0.9,* +toolkit@mozilla.org,xulrunner-1.9.1,1.9.1a1pre,1.9.1.* +toolkit@mozilla.org,xulrunner-1.9,1.9a1pre,1.9.0.* diff --git a/src/xul-app-data.csv.Ubuntu b/src/xul-app-data.csv.Ubuntu new file mode 100644 index 0000000..5d54ad6 --- /dev/null +++ b/src/xul-app-data.csv.Ubuntu @@ -0,0 +1,14 @@ +id,package,sol,eol +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},firefox-3.6,3.6a1pre,3.6.* +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},abrowser-3.6,3.6a1pre,3.6.* +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},firefox-3.5,3.5b4,3.5.* +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},abrowser-3.5,3.5b4,3.5.* +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},firefox-3.0,3.0a8,3.0.* +{3550f703-e582-4d05-9a08-453d09bdfdc6},thunderbird-3.0,3.0a1pre,3.0.* +{3550f703-e582-4d05-9a08-453d09bdfdc6},thunderbird,2.0,2.0.0.* +{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a},seamonkey,1.1.6,* +{a79fe89b-6662-4ff4-8e88-09950ad4dfde},conkeror,0.9,* +{e2fda1a4-762b-4020-b5ad-a41df1933103},sunbird,0.5,* +prism@developer.mozilla.org,prism,0.8,* +toolkit@mozilla.org,xulrunner-1.9.1,1.9.1a1pre,1.9.1.* +toolkit@mozilla.org,xulrunner-1.9,1.9a1pre,1.9.0.* -- cgit v1.2.3