Package: mozilla-devscripts
Version: 0.36
Followup-For: Bug #734476

Hello, I have attached a patch, including a man page.

For consistency with the existing package I've converted Jakub's script to 
Python 2.

I also added handling for some corner cases (empty, and non-existent, 
description).

To save some round trips I pre-emptively used the ISC license for consistency 
with the existing package. Of course Jakub as the original author gets to pick 
the license, so please tell us if you agree with ISC or would prefer something 
different.

X

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.12-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mozilla-devscripts depends on:
ii  perl           5.18.2-2+b1
ii  python         2.7.5-5
ii  python-librdf  1.0.16.1-2.1
ii  unzip          6.0-11
ii  zip            3.0-8

mozilla-devscripts recommends no packages.

mozilla-devscripts suggests no packages.

-- no debconf information
>From a5706d51df7e5c5a2efcd84fb5eb147a825b6882 Mon Sep 17 00:00:00 2001
From: Ximin Luo <infini...@pwned.gg>
Date: Fri, 2 May 2014 01:34:04 +0100
Subject: [PATCH] add amo-changelog, a script for fetching version history from
 the amo website

---
 amo-changelog       | 50 +++++++++++++++++++++++++++++++++++++++++++++++
 debian/copyright    | 29 ++++++++++++++++-----------
 man/amo-changelog.1 | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 setup.py            |  1 +
 4 files changed, 125 insertions(+), 11 deletions(-)
 create mode 100755 amo-changelog
 create mode 100644 man/amo-changelog.1

diff --git a/amo-changelog b/amo-changelog
new file mode 100755
index 0000000..70fe0a8
--- /dev/null
+++ b/amo-changelog
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+# Copyright (c) 2014, Jakub Wilk <jw...@debian.org>
+# Copyright (c) 2014, Ximin Luo <infini...@pwned.gg>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+import argparse
+import urllib2
+import xml.etree.cElementTree as etree
+
+URL_TEMPLATE = "https://addons.mozilla.org/en-US/addon/{ext}/versions/format:rss";
+
+def main():
+    ap = argparse.ArgumentParser(
+        description="fetch Version History of an addon from the Mozilla Extensions website.")
+    ap.add_argument('extension',
+        help='Extension short-name, as used on addons.mozilla.org.')
+    options = ap.parse_args()
+
+    url = URL_TEMPLATE.format(ext=options.extension)
+    fp = urllib2.urlopen(url)
+    try:
+        for event, element in etree.iterparse(fp):
+            if element.tag != 'item':
+                continue
+            title = element.find('title').text
+            print(title)
+            print('=' * len(title))
+            descel = element.find('description')
+            if descel is not None and descel.text:
+                print(descel.text.rstrip("\n"))
+            else:
+                print("[no description]")
+            print('')
+    finally:
+        fp.close()
+
+if __name__ == '__main__':
+    main()
diff --git a/debian/copyright b/debian/copyright
index 1bf10df..84ce51f 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -5,17 +5,6 @@ Source: git://git.debian.org/pkg-mozext/mozilla-devscripts.git
 Files: *
 Copyright: 2009-2014, Benjamin Drung <bdr...@debian.org>
 License: ISC
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
- .
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 Files: README
 Copyright: 2007-2009, Sasa Bodiroza <jaz...@gmail.com>
@@ -24,6 +13,11 @@ Copyright: 2007-2009, Sasa Bodiroza <jaz...@gmail.com>
            2007-2009, Fabien Tassin <f...@sofaraway.org>
 License: GPL-2+
 
+Files: amo-changelog man/amo-changelog.1
+Copyright: 2014, Jakub Wilk <jw...@debian.org>
+           2014, Ximin Luo <infini...@pwned.gg>
+License: ISC
+
 Files: xpi-pack xpi-unpack
 Copyright: 2007-2009, Sasa Bodiroza <jaz...@gmail.com>
            2007-2009, Alexander Sack <a...@ubuntu.com>
@@ -41,6 +35,19 @@ Files: perl/Debian/Buildsystem/xul_ext.pm perl/Debian/Sequence/xul_ext.pm
 Copyright: 2010, Mike Hommey <gland...@debian.org>
 License: GPL-2+
 
+License: ISC
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
 License: GPL-2+
  This package is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
diff --git a/man/amo-changelog.1 b/man/amo-changelog.1
new file mode 100644
index 0000000..197ff17
--- /dev/null
+++ b/man/amo-changelog.1
@@ -0,0 +1,56 @@
+.\" Copyright (c) 2014 Ximin Luo <infini...@pwned.gg>
+.\"
+.\" Permission to use, copy, modify, and/or distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.TH XPI-REPACK "1" "April 2014" "amo-changelog" "mozilla-devscripts suite"
+.SH NAME
+amo-changelog \- fetch Version History of an addon
+.SH SYNOPSIS
+.B amo-changelog
+[\fIoptions\fP]
+\fIextension\fR
+.SH DESCRIPTION
+.B amo-changelog
+fetches the Version History of an addon from the Mozilla Extensions website.
+It is meant to offer an easy way to include upstream changelogs in Debian
+packages of mozilla extensions - in many cases, this is not contained in the
+upstream source code repository, but is available on said website.
+
+The \fIextension\fR argument is its short name, as used by the website. For
+example, the homepage for "Adblock Plus" is
+https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/, so the
+short name would be "adblock-plus".
+
+Here is an example for debian/rules:
+
+# if using debhelper
+.br
+override_dh_installchangelogs:
+.br
+	dh_installchangelogs debian/changelog.upstream
+
+\[char46]PHONY: get-orig-changelog
+.br
+get-orig-changelog:
+.br
+	amo-changelog adblock-plus > debian/changelog.upstream
+
+Using this approach, one would save the output file (debian/changelog.upstream)
+as part of the Debian packaging. When updating the package with a new upstream
+release, one would run `debian/rules get-orig-changelog`
+.SH OPTIONS
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display a brief help message.
+.SH AUTHOR
+Jakub Wilk <jw...@debian.org> and Ximin Luo <infini...@pwned.gg>
diff --git a/setup.py b/setup.py
index d5a2cf7..70082c7 100644
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,7 @@ SCRIPTS = [
     'xpi-repack',
     'xpi-unpack',
     'moz-version',
+    'amo-changelog',
 ]
 
 if __name__ == '__main__':
-- 
1.9.2

_______________________________________________
Pkg-mozext-maintainers mailing list
Pkg-mozext-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-mozext-maintainers

Reply via email to