Package: mozilla-devscripts
Version: 0.20
Severity: wishlist
Tags: patch

dh allows to create extra build systems, for use by dh_auto_configure,
dh_auto_build and friends. The attached patch just does this.

Provided a package is a single extension, and has no tmp.xpi file in the
source directory, the debian/rules can look like this:

#!/usr/bin/make -f
%:
        dh --with xul-ext --buildsystem=xul_ext $@


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages mozilla-devscripts depends on:
ii  dpkg-dev                      1.15.5.6   Debian package development tools
ii  fakeroot                      1.14.4-1   Gives a fake root environment
ii  perl                          5.10.1-11  Larry Wall's Practical Extraction 
ii  python                        2.5.4-9    An interactive high-level object-o
ii  python-rdflib                 2.4.2-1+b1 RDF library containing an RDF trip
ii  python-support                1.0.7      automated rebuilding support for P
ii  quilt                         0.48-6     Tool to work with series of patche
ii  unzip                         6.0-4      De-archiver for .zip files
ii  wget                          1.12-1.1   retrieves files from the web
ii  zip                           3.0-3      Archiver for .zip files

mozilla-devscripts recommends no packages.

Versions of packages mozilla-devscripts suggests:
ii  cvs                         1:1.12.13-12 Concurrent Versions System
ii  git-core                    1:1.7.0.3-1  fast, scalable, distributed revisi
ii  mercurial                   1.5-1        scalable distributed version contr

-- no debconf information

-- debsums errors found:
debsums: changed file /usr/bin/dh_xul-ext (from mozilla-devscripts package)
diff -Nru mozilla-devscripts-0.20/src/dh_xul-ext mozilla-devscripts-0.20.1/src/dh_xul-ext
--- mozilla-devscripts-0.20/src/dh_xul-ext	2010-02-04 20:42:24.000000000 +0100
+++ mozilla-devscripts-0.20.1/src/dh_xul-ext	2010-04-08 14:17:49.000000000 +0200
@@ -199,7 +199,7 @@
 if __name__ == "__main__":
 	try:
 		long_opts = ["help", "package", "verbose"]
-		opts, args = getopt.gnu_getopt(sys.argv[1:], "hp:v", long_opts)
+		opts, args = getopt.gnu_getopt(sys.argv[1:], "hp:vO:", long_opts)
 	except getopt.GetoptError, e:
 		# print help information and exit:
 		print >> sys.stderr, str(e) # will print something like "option -a not recognized"
@@ -217,8 +217,6 @@
 			packages.append(a)
 		elif o in ("-v", "--verbose"):
 			verbose = True
-		else:
-			assert False, "unhandled option"
 
 	if len(packages) == 0:
 		packages = get_all_packages()
diff -Nru mozilla-devscripts-0.20/src/Makefile mozilla-devscripts-0.20.1/src/Makefile
--- mozilla-devscripts-0.20/src/Makefile	2010-02-04 20:42:24.000000000 +0100
+++ mozilla-devscripts-0.20.1/src/Makefile	2010-04-08 14:20:34.000000000 +0200
@@ -100,6 +100,7 @@
 	install -m 644 xul-app-data.csv.$(VENDOR) $(DESTDIR)$(DATADIR)/xul-app-data.csv
 	mkdir -p $(DESTDIR)/usr/share/perl5/Debian/Debhelper/Sequence
 	install -m 644 xul-ext.pm $(DESTDIR)/usr/share/perl5/Debian/Debhelper/Sequence/xul_ext.pm
+	install -m 644 xul-ext_build.pm $(DESTDIR)/usr/share/perl5/Debian/Debhelper/Buildsystem/xul_ext.pm
 
 clean:
 	rm -f $(subst_files)
diff -Nru mozilla-devscripts-0.20/src/xul-ext_build.pm mozilla-devscripts-0.20.1/src/xul-ext_build.pm
--- mozilla-devscripts-0.20/src/xul-ext_build.pm	1970-01-01 01:00:00.000000000 +0100
+++ mozilla-devscripts-0.20.1/src/xul-ext_build.pm	2010-04-08 14:57:14.000000000 +0200
@@ -0,0 +1,42 @@
+# A debhelper build system class for handling XUL extensions.
+#
+# Copyright: © 2010 Mike Hommey
+# License: GPL-2+
+
+package Debian::Debhelper::Buildsystem::xul_ext;
+
+use strict;
+use base 'Debian::Debhelper::Buildsystem';
+
+sub DESCRIPTION {
+	"XUL Extensions"
+}
+
+sub check_auto_buildable {
+	my $this=shift;
+	return (-e $this->get_sourcepath("install.rdf")) ? 1 : 0;
+}
+
+sub new {
+	my $class=shift;
+	my $this=$class->SUPER::new(@_);
+	$this->enforce_in_source_building();
+	return $this;
+}
+
+sub build {
+	my $this=shift;
+	$this->doit_in_sourcedir("xpi-pack", ".", "tmp.xpi");
+}
+
+sub install {
+	my $this=shift;
+	$this->doit_in_sourcedir("install-xpi", "tmp.xpi");
+}
+
+sub clean {
+	my $this=shift;
+	$this->doit_in_sourcedir("rm", "-f", "tmp.xpi");
+}
+
+1

Reply via email to