From 366ae1dfd7460efc0f49a4ee9402192eb61759c9 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 23 Mar 2016 01:08:19 +0900 Subject: mozilla-devscripts (0.45.1) unstable; urgency=high * Restore generation of iceweasel entries for Depends:, Enhances: etc. to ease the Iceweasel -> Firefox transition. (Closes: #818756) Update test suite accordingly. * Also restore generation of iceweasel-* binary packages. * Preemptively add generation of thunderbird entries for Depends:, Enhances: etc. for the upcoming Icedove -> Thunderbird transition. Update test suite accordingly. # imported from the archive --- COPYING | 339 +++++++ Makefile | 13 + README | 88 ++ amo-changelog | 171 ++++ data/xpi.mk | 142 +++ data/xul-app-data.csv.Debian | 8 + data/xul-app-data.csv.Ubuntu | 4 + debian/NEWS | 12 + debian/changelog | 1015 ++++++++++++++++++++ debian/compat | 1 + debian/control | 25 + debian/copyright | 66 ++ debian/rules | 4 + debian/source/format | 1 + dh_xul-ext | 426 ++++++++ install-xpi | 315 ++++++ man/amo-changelog.1 | 64 ++ man/dh_xul-ext.1 | 55 ++ man/install-xpi.1 | 77 ++ man/moz-version.1 | 53 + man/xpi-pack.1 | 34 + man/xpi-repack.1 | 54 ++ man/xpi-unpack.1 | 34 + moz-version | 155 +++ moz_version.py | 222 +++++ perl/Debian/Buildsystem/xul_ext.pm | 43 + perl/Debian/Sequence/xul_ext.pm | 8 + setup.py | 44 + tests/dh_xul-ext/all/debian/changelog | 5 + tests/dh_xul-ext/all/debian/compat | 1 + tests/dh_xul-ext/all/debian/control | 18 + tests/dh_xul-ext/all/debian/rules | 8 + tests/dh_xul-ext/all/install.rdf | 40 + tests/dh_xul-ext/all_environment/debian/changelog | 5 + tests/dh_xul-ext/all_environment/debian/compat | 1 + tests/dh_xul-ext/all_environment/debian/control | 18 + tests/dh_xul-ext/all_environment/debian/rules | 8 + tests/dh_xul-ext/all_environment/install.rdf | 40 + tests/dh_xul-ext/debian/debian/changelog | 5 + tests/dh_xul-ext/debian/debian/compat | 1 + tests/dh_xul-ext/debian/debian/control | 18 + tests/dh_xul-ext/debian/debian/rules | 8 + tests/dh_xul-ext/debian/install.rdf | 48 + .../default-to-compatible/debian/changelog | 5 + .../dh_xul-ext/default-to-compatible/debian/compat | 1 + .../default-to-compatible/debian/control | 18 + .../dh_xul-ext/default-to-compatible/debian/rules | 8 + tests/dh_xul-ext/default-to-compatible/install.rdf | 24 + tests/dh_xul-ext/expected_result/all.substvars | 5 + .../expected_result/all_environment.substvars | 5 + tests/dh_xul-ext/expected_result/debian.substvars | 5 + .../default-to-compatible.substvars | 5 + tests/dh_xul-ext/expected_result/ubuntu.substvars | 5 + tests/dh_xul-ext/test | 78 ++ tests/dh_xul-ext/ubuntu/debian/changelog | 5 + tests/dh_xul-ext/ubuntu/debian/compat | 1 + tests/dh_xul-ext/ubuntu/debian/control | 18 + tests/dh_xul-ext/ubuntu/debian/rules | 8 + tests/dh_xul-ext/ubuntu/install.rdf | 40 + tests/test-moz-version | 105 ++ xpi-pack | 89 ++ xpi-repack | 105 ++ xpi-unpack | 76 ++ 63 files changed, 4303 insertions(+) create mode 100644 COPYING create mode 100644 Makefile create mode 100644 README create mode 100755 amo-changelog create mode 100644 data/xpi.mk create mode 100644 data/xul-app-data.csv.Debian create mode 100644 data/xul-app-data.csv.Ubuntu create mode 100644 debian/NEWS create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100755 dh_xul-ext create mode 100755 install-xpi create mode 100644 man/amo-changelog.1 create mode 100644 man/dh_xul-ext.1 create mode 100644 man/install-xpi.1 create mode 100644 man/moz-version.1 create mode 100644 man/xpi-pack.1 create mode 100644 man/xpi-repack.1 create mode 100644 man/xpi-unpack.1 create mode 100755 moz-version create mode 100644 moz_version.py create mode 100644 perl/Debian/Buildsystem/xul_ext.pm create mode 100644 perl/Debian/Sequence/xul_ext.pm create mode 100644 setup.py create mode 100644 tests/dh_xul-ext/all/debian/changelog create mode 100644 tests/dh_xul-ext/all/debian/compat create mode 100644 tests/dh_xul-ext/all/debian/control create mode 100755 tests/dh_xul-ext/all/debian/rules create mode 100644 tests/dh_xul-ext/all/install.rdf create mode 100644 tests/dh_xul-ext/all_environment/debian/changelog create mode 100644 tests/dh_xul-ext/all_environment/debian/compat create mode 100644 tests/dh_xul-ext/all_environment/debian/control create mode 100755 tests/dh_xul-ext/all_environment/debian/rules create mode 100644 tests/dh_xul-ext/all_environment/install.rdf create mode 100644 tests/dh_xul-ext/debian/debian/changelog create mode 100644 tests/dh_xul-ext/debian/debian/compat create mode 100644 tests/dh_xul-ext/debian/debian/control create mode 100755 tests/dh_xul-ext/debian/debian/rules create mode 100644 tests/dh_xul-ext/debian/install.rdf create mode 100644 tests/dh_xul-ext/default-to-compatible/debian/changelog create mode 100644 tests/dh_xul-ext/default-to-compatible/debian/compat create mode 100644 tests/dh_xul-ext/default-to-compatible/debian/control create mode 100755 tests/dh_xul-ext/default-to-compatible/debian/rules create mode 100644 tests/dh_xul-ext/default-to-compatible/install.rdf create mode 100644 tests/dh_xul-ext/expected_result/all.substvars create mode 100644 tests/dh_xul-ext/expected_result/all_environment.substvars create mode 100644 tests/dh_xul-ext/expected_result/debian.substvars create mode 100644 tests/dh_xul-ext/expected_result/default-to-compatible.substvars create mode 100644 tests/dh_xul-ext/expected_result/ubuntu.substvars create mode 100755 tests/dh_xul-ext/test create mode 100644 tests/dh_xul-ext/ubuntu/debian/changelog create mode 100644 tests/dh_xul-ext/ubuntu/debian/compat create mode 100644 tests/dh_xul-ext/ubuntu/debian/control create mode 100755 tests/dh_xul-ext/ubuntu/debian/rules create mode 100644 tests/dh_xul-ext/ubuntu/install.rdf create mode 100755 tests/test-moz-version create mode 100755 xpi-pack create mode 100755 xpi-repack create mode 100755 xpi-unpack diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 of the License, 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. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3d78412 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +build: ; + +test: + tests/dh_xul-ext/test + tests/test-moz-version + +install: + python setup.py install --root="$(DESTDIR)" --no-compile --install-layout=deb + +clean: + rm -rf build *.pyc + +.PHONY: build clean install test diff --git a/README b/README new file mode 100644 index 0000000..b9250f8 --- /dev/null +++ b/README @@ -0,0 +1,88 @@ +mozilla-devscripts is a collection of scripts based on Makefile inheritance +usable by Mozilla packages in Ubuntu. + +- xpi provides hooks to help package extensions in an elegant way + +============================================================================ + +In addition there is a xpi.mk which provides standard rules/targets to package +XPI extensions for mozilla/toolkit based applications. + +=== xpi.mk === + +targets: +--------- + install-xpi - unpack and install the contents of the .xpi file to the + package named by the MOZ_EXTENSION_PKG parameter + clean-xpi - clean build cruft from install-xpi + +parameters: +------------ + MOZ_EXTENSION_PKG - the binary package that will ship the extension + MOZ_XPI_FILE - the XPI file to unpack and install to the binary package + named by MOZ_EXTENSION_PKG. If not set, xpi.mk will use + the first |*.xpi| file found in the packages top level + directory + MOZ_XPI_EMID - use the given EMID to name the links in the applications + |extensions| directory. If not set, xpi.mk will try to + guess the right EMID by introspecting the |install.rdf| + shipped by the XPI + MOZ_XPI_BUILD_COMMAND + - use the given command _before_ running the normal + |install-xpi| procedure. This parameter is useful for all + those extension sources that have a command/make target + to produce a XPI. If a developer doesn't provide the + command, the default one will be used. + MOZ_XPI_MOZILLA_DIRS + - link the extension to the global |extensions| directory + of the given MOZILLAs. The default value is |firefox| and + |firefox-addons|, which will link the extension to the + /usr/lib/firefox/extensions and /usr/lib/firefox-addons/extensions + directories, respectively. + +cdbs: +------ + If you are using cdbs (debhelper.mk) xpi.mk hooks in appropriately. + cdbs targets to build the packages without any rule. The only thing required + is to include the debhelper.mk from cdbs _before_ including xpi.mk. + +examples: +---------- + A template is available in the branch available under the following URL: + https://code.launchpad.net/~mozillateam/firefox-extensions/XPI.TEMPLATE + +=== xpi-unpack === + +This script unpacks XPI file to the provided output directory. After unpacking +the XPI file, it will look for JAR files in the output directory. All JAR files +will be unpacked to $JAR_FILE with "!" appended. For example, "test.jar" is +unpacked to "test.jar!" directory. After unpacking, the script removes all JAR +files. +To run it, pass the name of the XPI file, and the name of the output directory: + +$ xpi-unpack ubufox.xpi output + +In case some of the parameters are missing, input XPI file doesn't exist, or +output directory already exists, it will report an error and exit. + + +=== xpi-pack === + +This script prepares a XPI file from the provided input directory. First, it +will look for all unpacked JAR files in the input directory. Directories with +the unpacked JAR files have the format explained in xpi-unpack section. The +script will pack the contents of the directory to the JAR file, named like the +JAR directory, with stripped "!" sign. For example, contents of "test.jar!" are +packed to "test.jar" file. After that, it will remove all JAR directories. +Finally, it will pack the contents of the input directory to the XPI file, +which is placed inside the provided input directory. This behaviour is because +xpi.mk will look for XPI file inside top-level extension directory, which is +the input directory in that case. The script doesn't pack debian/ and temp-*/ +directories to the XPI file. After XPI file is produced, it will unpack all JAR +files, in order to leave intact source. +To run it, pass the name of the input directory, and the name of the XPI file: + +$ xpi-pack . ubufox.xpi + +In case some of the parameters are missing, or input directory doesn't exist, +it will report an error and exit. diff --git a/amo-changelog b/amo-changelog new file mode 100755 index 0000000..f95359b --- /dev/null +++ b/amo-changelog @@ -0,0 +1,171 @@ +#!/usr/bin/python + +# Copyright (c) 2014, Jakub Wilk +# Copyright (c) 2014, Ximin Luo +# +# 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. + +from __future__ import print_function + +import argparse +import os +import re +import subprocess +import sys +import urllib2 +import xml.etree.cElementTree as etree + +URL_TEMPLATE = "https://addons.mozilla.org/en-US/addon/{ext}/versions/format:rss" +OUTGOING_HREF = re.compile(r'href="https?://outgoing\.mozilla\.org/v\d+/\w+/(.+?)"') +HTML_HEAD = "\n{title}\n\n" +HTML_FOOT = "\n" + +def fix_outgoing_href(match): + return 'href="%s"' % urllib2.unquote(match.group(1)) + +def convert_rss_to_html(first, source, target): + elements = etree.iterparse(source) + next_url = None + # header if first page + if first: + element = next(elements)[1] + while element.tag != "title": + element = next(elements)[1] + print(HTML_HEAD.format(title=element.text), file=target) + # items, rel + for _, element in elements: + if element.tag == "{http://www.w3.org/2005/Atom}link": + if element.attrib["rel"] == "next": + next_url = element.attrib["href"] + continue + if element.tag != "item": + continue + title = element.find("title").text.encode("utf-8") + print("

%s

" % title, file=target) + descel = element.find("description") + if descel is not None and descel.text: + desc = descel.text.rstrip("\n").encode("utf-8") + # process manual line breaks, e.g. adblock-plus + desc = desc.replace("\n", "\n
").replace("
\n", "
 \n") + # strip outgoing redirect + desc = OUTGOING_HREF.sub(fix_outgoing_href, desc) + print(desc, file=target) + else: + print("[no description]", file=target) + print("", file=target) + # footer if last page + if not next_url: + print(HTML_FOOT, file=target) + return next_url + +def which(cmd): + path = os.environ.get("PATH", os.defpath).split(os.pathsep) + for dir in path: + name = os.path.join(dir, cmd) + if (os.path.exists(name) and os.access(name, os.F_OK | os.X_OK) + and not os.path.isdir(name)): + return name + return None + +def try_external_write(out, args, **kwargs): + prog = args[0] + if not which(prog): + print("failed to write %s: program not found: %s" % (out, prog), file=sys.stderr) + return False + try: + subprocess.check_call(args, **kwargs) + print("wrote %s" % out, file=sys.stderr) + return True + except Exception as e: + print("failed to write %s: %s" % (out, e), file=sys.stderr) + return False + +def main(): + parser = argparse.ArgumentParser( + description="Fetch Version History of an addon from the Mozilla " + "Extensions website and convert it into a human-readable format.") + parser.add_argument("extension", + help="Extension short-name, as used on addons.mozilla.org.") + parser.add_argument("-f", "--html-file", + metavar="FILE", default="debian/upstream/changelog.html", + help="File to write to. Default: %(default)s.") + parser.add_argument("-p", "--plain-format", metavar="FORMAT", + choices=["text", "markdown", "rst"], default="none", + help="Generate a human-readable form of the changelog in the file " + "without the .html extension, using an external program. Possible " + "options are text (uses lynx(1)), markdown (pandoc(1)), or rst " + "(pandoc(1)). Default: %(default)s.") + options = parser.parse_args() + + progname = os.path.basename(sys.argv[0]) + + html_file = options.html_file + if not html_file.endswith(".html"): + print("%s: Output filename must end with .html: %s" % + (progname, html_file), file=sys.stderr) + return 1 + plain_file = html_file[:-5] + + try: + with open(html_file, "w") as target: + url = URL_TEMPLATE.format(ext=options.extension) + first = True + while url: + try: + source = urllib2.urlopen(url) + except urllib2.HTTPError as error: + print("%s: For extension '%s', error fetching '%s': %s" % + (progname, options.extension, url, error), file=sys.stderr) + raise + try: + url = convert_rss_to_html(first, source, target) + first = False + finally: + source.close() + print("wrote %s" % html_file, file=sys.stderr) + except Exception as e: + print("failed to write %s: %s" % (html_file, e), file=sys.stderr) + #os.remove(html_file) + return 1 + + if options.plain_format == "text": + with open(plain_file, "w") as target: + if not try_external_write(plain_file, + ["lynx", "-dump", "-list_inline", "-width=84", html_file], stdout=target): + #os.remove(plain_file) + return 1 + else: + # 2 space indent is a bit more reasonable than lynx's 3 default + # width=84 above (3*2-2) effectively cancels the right margin + subprocess.call(["sed", "-i", "-e", "s/^ / /g", plain_file]) + + elif options.plain_format == "markdown": + if not try_external_write(plain_file, + ["pandoc", "-i", html_file, "--columns=79", "-wmarkdown", "-o", plain_file]): + return 1 + + elif options.plain_format == "rst": + if not try_external_write(plain_file, + ["pandoc", "-i", html_file, "--columns=79", "-wrst", "-o", plain_file]): + return 1 + else: + # work around https://github.com/jgm/pandoc/issues/1656 + # by adding two spaces to all line-block continuation lines + subprocess.call(["sed", "-i", "-r", + "-e", r"/^\|/,/^ |^$/{s/^([^ |])/ \1/g}", plain_file]) + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/data/xpi.mk b/data/xpi.mk new file mode 100644 index 0000000..77b8720 --- /dev/null +++ b/data/xpi.mk @@ -0,0 +1,142 @@ +# -*- mode: makefile; coding: utf-8 -*- + +# 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 +# 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. + + +# +# Usage: include this file in your CDBS debian/rules file and define the +# following variables: +# +# 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 +# guess one using wildcard (*.xpi) +# +# MOZ_XPI_BUILD_COMMAND (OPTIONAL): +# if defined the given command will be run _before_ the extension +# gets packaged up the standard .xpi way. Thus, the build command +# should produce an .xpi in top level directory. Note: If this +# command is specified, MOZ_XPI_CLEAN_COMMAND (see below) will be +# run during |clean|. If the .xpi file will not be build from +# source, you have to set this variable to nothing. +# +# MOZ_XPI_CLEAN_COMMAND (OPTIONAL): +# only has an effect if MOZ_XPI_BUILD_COMMAND (see above) is set. +# It defaults to `rm -f *.xpi`. +# +# MOZ_XPI_MOZILLA_EXTRA_DIRS (OPTIONAL): +# defines extra directories to link the extension in. Usually +# xpi.mk creates the right links based on targetApplication +# parsed in install.rdf; if you need more directories, use this. +# +# MOZ_XPI_DOCUMENTED_LICENSE_FILES (OPTIONAL): +# defines extra license files which need to be excluded during +# the installation of the XPI file to the packaging tree. When +# using parameter, be sure that you documented _all_ excluded +# license files in debian/copyright appropriately. If not defined +# the common license file names are guessed. +# +# MOZ_XPI_EXT_NAME (OPTIONAL): +# defines the name of the extension (without any prefixes like +# mozilla- or xul-ext-). If not defined MOZ_EXTENSION_PKG with +# stripped prefixes is used. This value is used to determine +# xpi:Provides. +# +# MOZ_XPI_PRESERVE_PERMISSIONS (OPTIONAL): +# if defined (set to 1), the permission of the installed files +# will not be changed. If not defined or set to $(null), the +# permission of the files will be set to 644 and the permissions +# of scripts (files containing a shebang) will be set to 755. +# +# MOZ_XPI_INSTALL_DIRECTORY (OPTIONAL): +# The xpi file will be installed in the specified directory. +# This directory must be an absolute path. Use this parameter +# with care. +# +# MOZ_XPI_DISABLE_SYSTEM_PREFS (OPTIONAL): +# if defined (set to 1), no system preference file will be +# created in /etc. +# +# Unused variables (can be removed): +# +# MOZ_XPI_EMID (OPTIONAL): +# if defined the given id is used to determine the link name +# in the Firefox extensions directory. if not defined we try +# our best to extract the em:id from the install.rdf file shipped +# by any xpi +# '''Note''': this variable is not used any more + +MOZ_EXTENSION_PKG ?= $(strip $(shell grep ^Package: debian/control | head -n 1 | sed "s/^Package://")) + +MOZ_XPI_BUILD_COMMAND ?= xpi-pack $(CURDIR) $(MOZ_EXTENSION_PKG).xpi +MOZ_XPI_CLEAN_COMMAND ?= rm -f *.xpi + +ifneq (,$(MOZ_XPI_FILE)) +xpi_file = $(wildcard $(MOZ_XPI_FILE)) +else +xpi_file = $(wildcard *.xpi) +endif + +ifneq (,$(MOZ_XPI_PRESERVE_PERMISSIONS)) +install_xpi_extra_parameter += --preserve-permissions +endif + +ifneq (,$(MOZ_XPI_DISABLE_SYSTEM_PREFS)) +install_xpi_extra_parameter += --disable-system-prefs +endif + +ifneq (,$(MOZ_XPI_INSTALL_DIRECTORY)) +install_xpi_extra_parameter += -i $(MOZ_XPI_INSTALL_DIRECTORY) +endif + +ifeq ($(origin MOZ_XPI_DOCUMENTED_LICENSE_FILES),undefined) +install_xpi_extra_parameter += --remove-license-files +else +install_xpi_extra_parameter += $(foreach exclude,$(MOZ_XPI_DOCUMENTED_LICENSE_FILES),-x $(exclude)) +endif + +install_xpi_extra_parameter += $(foreach dir,$(MOZ_XPI_MOZILLA_EXTRA_DIRS),-l $(dir)) + +# ### cdbs hooks +# build xpi using MOZ_XPI_BUILD_COMMAND if defined +build/$(MOZ_EXTENSION_PKG):: +ifneq (,$(MOZ_XPI_BUILD_COMMAND)) + $(MOZ_XPI_BUILD_COMMAND) +endif + +install/$(MOZ_EXTENSION_PKG):: xpi-install + +xpi-install: + install-xpi -p$(MOZ_EXTENSION_PKG) $(xpi_file) $(install_xpi_extra_parameter) + dh_xul-ext -p$(MOZ_EXTENSION_PKG) + +# clean build and remove all .xpi in top-level if a MOZ_XPI_BUILD_COMMAND is defined +ifneq (,$(MOZ_XPI_BUILD_COMMAND)) +clean:: + dh_testdir + dh_clean + $(MOZ_XPI_CLEAN_COMMAND) +endif + +.PHONY: clean xpi-install diff --git a/data/xul-app-data.csv.Debian b/data/xul-app-data.csv.Debian new file mode 100644 index 0000000..3c9ecba --- /dev/null +++ b/data/xul-app-data.csv.Debian @@ -0,0 +1,8 @@ +id,package,sol,eol +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},iceweasel,2.0,* +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},firefox,2.0,* +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},firefox-esr,2.0,* +{3550f703-e582-4d05-9a08-453d09bdfdc6},thunderbird,1.5.0.7,* +{3550f703-e582-4d05-9a08-453d09bdfdc6},icedove,1.5.0.7,* +{a79fe89b-6662-4ff4-8e88-09950ad4dfde},conkeror,0.9,* +{718e30fb-e89b-41dd-9da7-e25a45638b28},iceowl,1.5,* diff --git a/data/xul-app-data.csv.Ubuntu b/data/xul-app-data.csv.Ubuntu new file mode 100644 index 0000000..031c5e0 --- /dev/null +++ b/data/xul-app-data.csv.Ubuntu @@ -0,0 +1,4 @@ +id,package,sol,eol +{ec8030f7-c20a-464f-9b0e-13a3a9e97384},firefox,3.6a1pre,* +{3550f703-e582-4d05-9a08-453d09bdfdc6},thunderbird,2.0,* +{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a},seamonkey,1.1.6,* diff --git a/debian/NEWS b/debian/NEWS new file mode 100644 index 0000000..a9ab4e4 --- /dev/null +++ b/debian/NEWS @@ -0,0 +1,12 @@ +mozilla-devscripts (0.29) unstable; urgency=low + + dh_xul-ext sets now the substitution variable xpi:Breaks for breaking with + too old or too new XUL applications that are incompatible with the given + XUL extension. + + You should add ${xpi:Breaks} to Breaks: in debian/control. This change is + forward and backwards compatible. Therefore there is no need to require a + newer version of mozilla-devscripts to build your XUL extension. + + -- Benjamin Drung Wed, 12 Oct 2011 00:10:04 +0200 + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..22964b4 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,1015 @@ +mozilla-devscripts (0.45.1) unstable; urgency=high + + * Restore generation of iceweasel entries for Depends:, Enhances: + etc. to ease the Iceweasel -> Firefox transition. (Closes: #818756) + Update test suite accordingly. + * Also restore generation of iceweasel-* binary packages. + * Preemptively add generation of thunderbird entries for Depends:, + Enhances: etc. for the upcoming Icedove -> Thunderbird transition. + Update test suite accordingly. + + -- Sean Whitton Tue, 22 Mar 2016 09:08:19 -0700 + +mozilla-devscripts (0.45) unstable; urgency=high + + * Update dh_xul-ext, debian/control and the test suite for the Iceweasel + -> Firefox transition. (Closes: #818013) + * Bump standards version to 3.9.7 (no changes required). + * Update VCS-Git: and VCS-Browser: to canonical https URLs. + + -- Sean Whitton Sat, 12 Mar 2016 11:35:24 -0700 + +mozilla-devscripts (0.44) unstable; urgency=medium + + * Drop support for Iceape which is no longer available in Debian. + Prevents generating Depends: that can never be satisfied in packages + built with dh_xul-ext (Closes: #811332). + + -- Sean Whitton Thu, 21 Jan 2016 17:16:05 -0700 + +mozilla-devscripts (0.43) unstable; urgency=medium + + * install-xpi: sort file list in preferences files to make package builds + reproducible. Thanks to Reiner Herrmann (Closes: #808713) + + -- Benjamin Drung Tue, 12 Jan 2016 23:07:40 +0100 + +mozilla-devscripts (0.42) unstable; urgency=low + + * Team upload. + * Fix typo in timezone setting. Thanks Reiner Herrmann. (Closes: #788376) + + -- Jérémy Bobbio Thu, 11 Jun 2015 07:52:23 +0200 + +mozilla-devscripts (0.41) unstable; urgency=low + + * Team upload. + * Use UTC as timezone when calling zip or unzip in xpi-pack, xpi-unpack, + and install-xpi to make the build reproducible accross different + timezones. + + -- Jérémy Bobbio Mon, 01 Jun 2015 18:11:50 +0200 + +mozilla-devscripts (0.40) unstable; urgency=low + + [ Jérémy Bobbio ] + * Team upload. + * xpi-pack: do not save extra attributes when making jar to allow + reproducible builds. + * Bump Standards-Version, no changes required. + + [ Ximin Luo ] + * amo-changelog: parse into human-readable form and save to + debian/upstream/changelog{,.html}. + * amo-changelog: fetch all pages of Version History. + * install-xpi: dh_link needs to be run from package home directory, e.g. when + giving -D to dh. + + -- Jérémy Bobbio Wed, 20 May 2015 08:50:14 +0200 + +mozilla-devscripts (0.39) unstable; urgency=medium + + [ Ximin Luo ] + * amo-changelog: output UTF-8 by default instead of ASCII, which errors when + the input contains non-ASCII chars + + -- Benjamin Drung Sat, 17 May 2014 19:28:49 +0200 + +mozilla-devscripts (0.38) unstable; urgency=medium + + * install-xpi: Catch RDF.RedlandError exception and print error message. + (Closes: #746699) + + -- Benjamin Drung Sat, 10 May 2014 00:32:50 +0200 + +mozilla-devscripts (0.37) unstable; urgency=medium + + [ Ximin Luo ] + * Add amo-changelog, a script for fetches the version history of an addon + from the Mozilla Extensions website. (Closes: #734476) + + [ Benjamin Drung ] + * PEP8 fixes and pylint improvements. + + -- Benjamin Drung Fri, 09 May 2014 23:41:21 +0200 + +mozilla-devscripts (0.36) unstable; urgency=medium + + * xpi-repack: + - Use argparse instead of getopts. + - Use the tempfile module to create a secure temporary directory. + Thanks to Jakub Wilk (Closes: #740759) + - Print meaningful error message when --upstream-version is missing. + (Closes: #740762) + - Add --format option and document default compression format. + (Closes: #639917) + * xpi-unpack: Fix unpacke -> unpacked typo (Closes: #740752) + + -- Benjamin Drung Tue, 11 Mar 2014 00:28:21 +0100 + +mozilla-devscripts (0.35) unstable; urgency=low + + * dh_xul-ext: Use "dpkg-vendor --derives-from Ubuntu" instead of + "dpkg-vendor --query vendor" so Ubuntu derivatives get treated like + Ubuntu and non-Ubuntu based Debian derivatives get treated like Debian. + Thanks to Peter Michael Green for the patch (Closes: #732254) + * Bump Standards-Version to 3.9.5 (no changes required). + * Use debhelper 9. + + -- Benjamin Drung Sat, 21 Dec 2013 22:36:07 +0100 + +mozilla-devscripts (0.34) unstable; urgency=low + + * Add Iceowl to xpi:Depends auto-detection. Thanks to Matthias Schmitz for + the patch. (Closes: #705396) + + -- Benjamin Drung Mon, 15 Apr 2013 12:51:43 +0200 + +mozilla-devscripts (0.33) unstable; urgency=low + + * dh_xul-ext: + - Do not generate a Breaks entry for Thunderbird/Icedove 10 or later, + because these versions default add-ons to compatible. + - Fail if minVersion is greater than maxVersion. (Closes: #650348) + * install-xpi: Search in the parent directories for a debian/ directory to + work with debhelper's --sourcedirectory parameter. (Closes: #698033) + * Bump Standards-Version to 3.9.4 (no changes needed). + + -- Benjamin Drung Sat, 19 Jan 2013 02:23:10 +0100 + +mozilla-devscripts (0.32) unstable; urgency=low + + * dh_xul-ext: Do not generate a Breaks entry for Firefox/Iceweasel 10 or + later, because these versions default add-ons to compatible. + * Drop unused dpkg-dev, fakeroot, quilt, and wget from Depends. + * Drop unneeded cvs, git, and mercurial from Suggests. + + -- Benjamin Drung Wed, 23 May 2012 23:50:23 +0200 + +mozilla-devscripts (0.31) unstable; urgency=low + + * dh_xul-ext: correct Breaks max-version (>> not >=). Thanks to Tanguy Ortolo + for the patch. (Closes: #668892) + * Adjust test cases. + * Bump Standards-Version to 3.9.3 (no changes required). + * Update machine-readable copyright Format to 1.0. + * install-xpi: + - Fix crash when invoking --help outside a package directory. (LP: #900689) + - Fail nicely if debian/control is missing. + * xpi-repack: Fail nicely if debian/control is missing. (LP: #900687) + + -- Benjamin Drung Sun, 22 Apr 2012 00:56:46 +0200 + +mozilla-devscripts (0.30) unstable; urgency=low + + * dh_xul-ext: Remove "-a" as the short form of the --all parameter, + because "-a" is a common parameter for debhelper. (Closes: #655609) + * Use unnamed variables in SPARQL queries if they are unused. + + -- Benjamin Drung Thu, 12 Jan 2012 22:29:56 +0100 + +mozilla-devscripts (0.29) unstable; urgency=low + + [ Benjamin Drung ] + * Move mozilla-devscripts under the hood of the Debian Mozilla + Extension Maintainers. + * Remove Fabien Tassin and Alexander Sack from Uploaders. Thanks + for your work. + * Removed all stuff that is unrelated to packaging XUL extensions. + * Switch from dpkg-source 1.0 to 3.0 (native). + * Updated VCS location. + * Relicense my stuff under the ISC license. + * Add ${xpi:Breaks} for versioned package dependency for maximum + XUL application version (LP: #839130). + + [ Andrea Veri ] + * debian/control: + - long and short desc refreshed a bit with new content. + - added myself into uploaders, I'll help Benjamin maintaining this package. + * debian/copyright: + - refreshed and made it compliant to DEP-5. + + -- Benjamin Drung Wed, 12 Oct 2011 00:10:04 +0200 + +mozilla-devscripts (0.28) unstable; urgency=low + + * dh_xul-ext: Sort list of CSV files to fix test case failures + (LP: #829493). + + -- Benjamin Drung Sat, 20 Aug 2011 01:13:50 +0200 + +mozilla-devscripts (0.27) unstable; urgency=low + + * Update package lists for Debian unstable and Ubuntu oneiric. + * Add a MOZ_XPI_CLEAN_COMMAND to xpi.mk; thanks to Ximin Luo for the patch + (Closes: #632895). + * Add an --all parameter and a DH_XUL_EXT_VENDOR environment variable to + dh_xul-ext to make packages that work with every browser they can actually + work with (Closes: #610499). + * Update and fix my email addresses. + + -- Benjamin Drung Sat, 16 Jul 2011 18:53:09 +0200 + +mozilla-devscripts (0.26) unstable; urgency=low + + [ Chris Coulson ] + * Remove additional binary files from Mozilla tarballs + - update src/mozclient/remove.binonly.sh + * Add services to the list of directories to clean when using + build-system.tar.gz + - update src/xulapp.mk.in + + [ Benjamin Drung ] + * Update my email address. + * Switch from python-support to dh_python2. + * Bump Standards-Version to 3.9.2 (no changes required). + * Drop DM-Upload-Allowed field. + * Add setup.py to install moz_version.py. + * Update package description. + + -- Benjamin Drung Wed, 15 Jun 2011 23:48:39 +0200 + +mozilla-devscripts (0.25) unstable; urgency=low + + * Fix additional quotation marks in extension ID (LP: #674171). + - update src/dh_xul-ext + - update src/install-xpi + * Update package list for Debian experimental and Ubuntu natty. + - update src/xul-app-data.csv.Debian + - update src/xul-app-data.csv.Ubuntu + * Drop backwards compatibility for Icedove/Thunderbird << 3.0. + - update src/install-xpi + * Switch from CDBS to dh 7 and simplifying packaging by improving Makefiles. + - add Makefile + - update debian/compat + - update debian/control + - remove debian/manpages + - update debian/rules + - update src/Makefile + * Use versioned target applications in Depends instead of unversioned target + applications in Recommends. All extensions have to add ${xpi:Depends} to + Depends. (Closes: #602051) + - update src/dh_xul-ext + - update src/xpi.mk + + -- Benjamin Drung Fri, 26 Nov 2010 01:02:35 +0100 + +mozilla-devscripts (0.24) unstable; urgency=low + + * Drop packages that are transitional or removed in Ubuntu maverick. + - update src/xul-app-data.csv.Ubuntu + * Bump Standards-Version to 3.9.1 (no changes required). + + -- Benjamin Drung Wed, 22 Sep 2010 17:40:21 +0200 + +mozilla-devscripts (0.23) unstable; urgency=low + + * Switch from python-rdflib to python-librdf; thanks to Willi Mann for the + patch. + - update src/dh_xul-ext + - update src/install-xpi + + -- Benjamin Drung Thu, 10 Jun 2010 13:55:17 +0200 + +mozilla-devscripts (0.22) unstable; urgency=low + + * Add a dh buildsystem; thanks to Mike Hommey for the patch (Closes: #576946). + - add src/xul-ext_build.pm + - update src/Makefile + * Use debian/package.js as configuration file if it exists. + - update man/install-xpi.1 + - update src/install-xpi + + -- Benjamin Drung Sun, 11 Apr 2010 21:51:25 +0200 + +mozilla-devscripts (0.21) unstable; urgency=low + + [ Micah Gersten ] + * xulapp.mk: + - add testing and tools directory to clean target for xulrunner-1.9.2 + build system + - update src/xulapp.mk.in + + [ Benjamin Drung ] + * add new xpi-repack script + - add man/xpi-repack.1 + - add src/xpi-repack + - update src/Makefile + * Install extensions into xul-ext subdirectory; thanks to Daniel Kahn Gillmor + for the patch. + - update src/install-xpi + * Use optparse instead of getopts and ignore unknown options (LP: #543862). + - update man/dh_xul-ext.1 + - update src/dh_xul-ext + * Use optparse instead of getopts. + - update src/install-xpi + * install-xpi will create a system preference file in /etc; add + --disable-system-prefs to disable the new behavior (Closes: #558490, + LP: #535544) + - update man/install-xpi.1 + - update src/install-xpi + - update src/xpi.mk + + -- Benjamin Drung Tue, 06 Apr 2010 16:25:19 +0200 + +mozilla-devscripts (0.20) unstable; urgency=low + + [ Micah Gersten ] + * xpi-data: + - make thunderbird unversioned + - make firefox-3.6 and abrowser-3.6 be unversioned from now on + - update src/xul-app-data.csv.Ubuntu + + [ Benjamin Drung ] + * dh_xul-ext: + - insert dh_xul-ext after dh_install into dh sequence (Closes: #566618) + - update src/xul-ext.pm + * packaging: + - Bump Standards-Version to 3.8.4; no changes required. + - update debian/control + * xpi-data: + - Drop xulrunner-1.9 from Debian unstable. + - update src/xul-app-data.csv.Debian + - Add xulrunner-1.9.2 to Ubuntu lucid. + - update src/xul-app-data.csv.Ubuntu + + -- Benjamin Drung Thu, 04 Feb 2010 20:41:17 +0100 + +mozilla-devscripts (0.19) unstable; urgency=low + + * xpi.mk: + - get rid of temp directory; extract xpi file directly into installation + directory + - update src/xpi.mk + - correct permissions of installed files and add + MOZ_XPI_PRESERVE_PERMISSIONS to disable this behaviour (Closes: #556741) + - update src/xpi.mk + - drop support for deprecated MOZ_EXT_NAME and MOZ_XPI_MOZILLA_DIRS variable + - update src/xpi.mk + - add new MOZ_XPI_INSTALL_DIRECTORY variable + - update src/xpi.mk + * med-xpi-{pack,unpack}: + - Drop med- prefix. + - rename man/med-xpi-{pack,unpack}.1 to man/xpi-{pack,unpack}.1 + - rename src/med-xpi-{pack,unpack} to src/xpi-{pack,unpack} + - update README + - update src/Makefile + - update src/xpi.mk + * xpi-data: + - Add Firefox 3.6 and Thunderbird 3.0 for lucid. + - update src/xpi-data-Ubuntu.mk + - 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 + * dh_xul-ext: + - Split substvars calculation from xpi.mk into new dh_xul-ext. + - add src/dh_xul-ext + - update src/Makefile + - update src/xpi.mk + - Move compare_versions from moz-version into separate module moz_version.py + - add src/moz_version.py + - update src/moz-version + - update src/dh_xul-ext + - Install moz_version.py using python-support + - update debian/control + - update debian/rules + - update src/Makefile + - Add "xul-ext" dh sequence + - add src/xul-ext.pm + - update src/Makefile + - update debian/control + - wrote man page for dh_xul-ext + - add man/dh_xul-ext.1 + - update src/Makefile + * install-xpi: + - Split xpi installation from xpi.mk into new install-xpi script. + - add src/install-xpi + - update src/Makefile + - update src/xpi.mk + - update debian/control + - wrote man page for install-xpi + - add man/install-xpi.1 + - update src/Makefile + - add --install-dir parameter to install-xpi + - update man/install-xpi.1 + - update src/install-xpi + - create links for architecture independent extensions in /usr/share instead + of /usr/lib (Closes: #564671) + - update src/install-xpi + - create additional symlinks for icedove and thunderbird, because they do + not scan /usr/{lib,share}/mozilla/extensions/$target_application + - update src/install-xpi + * moz-version: + - Add parameter for converting Mozilla versions into Debian upstream + versions and the other way round. + - update man/moz-version.1 + - update src/moz_version.py + - update src/moz-version + - Add a test suite for testing moz-version --compare + - add tests/test-moz-version + - update debian/rules + - update src/Makefile + * packaging: + - add homepage field + - update debian/control + + [ Alexander Sack ] + * dh_xul-ext: + - convert xpath expression to python/rdflib; extract (id, max, min) + triples for all targetApplications in get_supported_apps; in turn + add python-rdflib to Depends (Closes: #551182, LP: #453040, #444540) + - update src/dh_xul-ext + - update debian/control + + -- Benjamin Drung Tue, 12 Jan 2010 16:07:57 +0100 + +mozilla-devscripts (0.18) unstable; urgency=low + + [ Sasa Bodiroza ] + * med-xpi-pack: + - Keep track of produced jar files and remove them only after the build + of xpi file (LP: #452422, Closes: #551065) + * med-xpi-{pack,unpack}: + - Enclose -name parameter with single quotes in find command + + -- Benjamin Drung Tue, 17 Nov 2009 18:45:21 +0100 + +mozilla-devscripts (0.17) unstable; urgency=low + + * xpi.mk: + - Fail to build, if no xpi file is found. + - update src/xpi.mk + - only add stripped binary package name to xpi:Provides, if it equals the + source package name + - update src/xpi.mk + - Fail to build, if the extension manager ID could not be detected. + - update src/xpi.mk + - support different types of install.rdf files (LP: #442897) + - update src/xpi.mk + - move data for the automagic detection of target application packages + into separate xpi-data-*.mk files + - update src/xpi.mk + - add src/xpi-data-all.mk + - add src/xpi-data-common.mk + - add src/xpi-data-Debian.mk + - add src/xpi-data-Ubuntu.mk + - update debian/control + - update src/Makefile + - rename MOZ_EXT_NAME to MOZ_XPI_EXT_NAME + - update src/xpi.mk + - set default MOZ_XPI_DISTRO in xpi-config.mk on installation + - add src/xpi-config.mk.in + - update src/xpi.mk + - update src/Makefile + + -- Benjamin Drung Wed, 07 Oct 2009 18:29:33 +0200 + +mozilla-devscripts (0.16) unstable; urgency=low + + [ Benjamin Drung ] + * xpi.mk: + - List all phony target and run dh_clean for all packages. These changes + makes it possible to use xpi.mk without cdbs in a simple way. + - update src/xpi.mk + - MOZ_EXTENSION_PKG is defined in either case, removing missing case handler + - update src/xpi.mk + - rename stamp-* targets to *-stamp, merge stamp-extension-install into + xpi-install, merge xpi-clean into clean + - update src/xpi.mk + - Guess common license file names if MOZ_XPI_DOCUMENTED_LICENSE_FILES is + not set. + - update src/xpi.mk + - simplify xpi-depends-stamp rule + - update src/xpi.mk + - override files on xpi extraction (otherwise running build target would + require user interaction) + - update src/xpi.mk + - only list packages in ${xpi:Depends} if they are available in the archive + and add lsb-release as dependency + - update src/xpi.mk + - update debian/control + - rename ${xpi:Depends} to ${xpi:Recommends} and keep ${xpi:Depends} for + backwards compatibility + - update src/xpi.mk + - add ${xpi:Provides} and ${xpi:Enhances} to support the Debian policy for + packaging extensions: http://wiki.debian.org/Teams/DebianMozExtTeam + - update src/xpi.mk + - "mkdir -p" can be run in all cases + - update src/xpi.mk + - add sanity check for xpi file and fail with useful error messages + - update src/xpi.mk + - support different types of install.rdf files (LP: #422898) + - update src/xpi.mk + - add MOZ_EXT_NAME option (used for calculating xpi:Provides) + - update src/xpi.mk + * packaging: + - allow uploads done by Debian Maintainers + - update debian/control + * med-xpi-{pack,unpack}: + - add parenthesis to $1 to avoid problems if $1 is empty + - update src/med-xpi-pack + - update src/med-xpi-unpack + - replace \n in echo commands with an extra empty echo command to avoid + bashism (Closes: #547755) + - update src/med-xpi-pack + - update src/med-xpi-unpack + + [ Alexander Sack ] + + mozclient: use stable awesome-browser branding branch for firefox-3.0 + - update src/mozclient/firefox-3.0.conf + + xpi.mk: + - install extension tree to /usr/share or /usr/lib based on Architecture: + field in debian/control for the target package + - update src/xpi.mk + + -- Alexander Sack Thu, 24 Sep 2009 14:08:10 +0200 + +mozilla-devscripts (0.15) unstable; urgency=low + + [ Benjamin Drung ] + * packaging: + - break and sort Depends and Suggests + - update debian/control + - add ${misc:Depends} to Depends + - update debian/control + - wrap too long lines + - update debian/changelog + - fix Vcs-Bzr-Browser field to Vcs-Browser + - update debian/control + - all files are directly installed into debian/mozilla-devscripts + - update debian/rules + - remove debian/mozilla-devscripts.install + - Bump Standards-Version to 3.8.3 + - update debian/control + * build-system: + - make minefield-packager.mk executable + - update src/Makefile + * lp-locale-export.mk: + - remove shebang + - update src/lp-locale-export.mk + * moz-version: + - wrote man page for moz-version + - add man/moz-version.1 + - update src/Makefile + * xpi.mk: + - add abrowser-3.7, firefox-3.7, xulrunner-1.9.3 + - update src/xpi.mk + + [ Sasa Bodiroza ] + * med-xpi-{pack,unpack}: + - wrote man page for med-xpi-{pack,unpack} + - add man/med-xpi-{pack,unpack}.1 + - update src/Makefile + * xpi.mk: + - add MOZ_XPI_DOCUMENTED_LICENSE_FILES parameter to enable exclusion of + extra license files during installation of the XPI to the packaging tree + + -- Benjamin Drung Sat, 22 Aug 2009 01:10:23 +0200 + +mozilla-devscripts (0.14) unstable; urgency=low + + [ Alexander Sack ] + * xpi.mk: + - add target application id magic (|XPI_TARGET_EMIDs|); parse install.rdf + and create extension links for all targetapplications like: + |/usr/lib/mozilla/extensions/$targetappid/$extid|; in same turn we + deprecate |MOZ_XPI_MOZILLA_DIRS| and unset its default accordingly + - 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 + - update src/xpi.mk + - 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: + - add bindir_files feature and use that to install med-xpi-*pack as well as + moz-version-compare to BINDIR; in turn adjust dh_install helper + accordingly. + - update src/Makefile + - update debian/mozilla-devscripts.install + * lp-locale-export.mk: + - fix LP: #411191 - webfav lp-locale-export.mk yields en-US.xpi with + .manifest files only - fix parsing bug for jar: protocol lines + * packaging: + - fix Vcs-Bzr: to point to a proper R/W location and use Vcs-Bzr-Browser for + the browsable read-only location + - update debian/control + - add Benjamin Drung to Uploaders and also add my + @ubuntu.com address work-time uploads won't count as NMU + - update debian/control + + [ 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 + - 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 + + -- Alexander Sack Tue, 11 Aug 2009 14:01:26 +0200 + +mozilla-devscripts (0.13) unstable; urgency=low + + First debian upload (Closes: 528225) + + [ Fabien Tassin ] + * Drop python-2.4 from Depends, any python will do + - update debian/control + + [ Alexander Sack ] + * adding asac to Uploaders: for first debian upload + * improve debian/copyright + + -- Fabien Tassin Tue, 07 Jul 2009 14:49:34 +0200 + +mozilla-devscripts (0.12) jaunty; urgency=low + + [ Fabien Tassin ] + * mozclient: + - fix hg incorrectly requesting branches + - update src/mozclient/lib/MozClient/Mercurial.pm + - search the main nobin script in the system wide mozclient + path if we are building with a conf-dir and no script was found + - update src/mozclient/lib/MozClient/VCS.pm + - add support for local branches instead of the configured remote ones. + It is faster if you have to publish tarballs quite often from a branch, + such as when doing daily snapshots. + - update src/mozclient.mk.in + - update src/mozclient/lib/MozClient/{CVS,Git,Mercurial,Subversion,VCS}.pm + - update src/mozclient/mozclient.pl + - update README + + [ Sasa Bodiroza ] + * Remove "firefox" from MOZ_XPI_MOZILLA_DIRS in src/xpi.mk, adjust parameter + description + + -- Fabien Tassin Mon, 19 Jan 2009 23:19:05 +0100 + +mozilla-devscripts (0.11) jaunty; urgency=low + + * Bump Standards-Version to 3.8.0 + - update debian/control + * [ minefield-packager ] + upstream builds are now identified with a trailling "-mozilla-central", + it's no longer "-trunk" + - update src/minefield-packager.mk.in + * [ mozclient ] + - add support for external project files helping adoption + of mozilla-devscripts by downstream. Introduce MOZCLIENT_PROJECTDIR. + - update README + - update src/mozclient.mk.in + - don't run MOZCLIENT_EXCLUDE_SCRIPT if does not exist as it creates + false positives + - update src/mozclient/lib/MozClient/VCS.pm + - drop $(EXT), left-over from when mozclient.pl was substed and use -c + instead + - update src/mozclient.mk.in + - add support for git + - add src/mozclient/lib/MozClient/Git.pm + - update src/mozclient/mozclient.pl + - update src/mozclient/lib/MozClient/VCS.pm + - update debian/control + - move thunderbird-3.0 and seamonkey-2.0 from cvs to hg comm-central + - update src/mozclient/thunderbird-3.0.conf + - update src/mozclient/seamonkey-2.0.conf + - add src/mozclient/thunderbird-3.0-remove.binonly.sh + - add src/mozclient/seamonkey-2.0-remove.binonly.sh + - add project midbrowser (LP: #210314) + - add src/mozclient/midbrowser.conf + - update README + * [ compare ] + search for $(DEB_BUILDDIR)/mozilla/dist/bin, needed + by mozilla packages using MOZ_OBJDIR + - update src/compare.mk.in + * [ xpi ] + add support for xpi not located in the root directory. This is needed + for extensions built with xulapp.mk + - update src/xpi.mk + * [ xulapp ] + - allow caller to specify the xulrunner version by pre-setting + DEBIAN_XUL_VER + - update src/xulapp.mk.in + - add confdefs.h and a.out to the clean rule + - update src/xulapp.mk.in + + -- Fabien Tassin Sat, 15 Nov 2008 23:30:58 +0100 + +mozilla-devscripts (0.10) intrepid; urgency=low + + [ Sasa Bodiroza ] + * Add src/med-xpi-{pack,unpack} scripts to manage packing and unpacking of + XPI files. + * Add default build command in src/xpi.mk. + * In README: + - Document src/med-xpi-{pack,unpack} scripts. + - Document default build command in xpi.mk part. + * Add zip to Depends in debian/control, because src/med-xpi-{pack,unpack} + scripts need it. + * Add src/med-xpi-{pack,unpack} to debian/mozilla-devscripts.install to + install them to /usr/bin. + + [ Fabien Tassin ] + * Change Recommends into Suggests for cvs and mercurial as those are + not needed to use mozilla-devscripts as a build-dependency. + - update debian/control + * [mozclient] fix Mercurial tags not passed during checkout + - update src/mozclient/lib/MozClient/Mercurial.pm + + [ Alexander Sack ] + * inject awesome-browser branding into firefox source tree by + adding appropriate MOZCLIENT_POSTCOCMD to the mozclient configs + - update src/mozclient/firefox-3.0.conf + - update src/mozclient/firefox-3.1.conf + - update src/mozclient/firefox-4.0.conf + + -- Fabien Tassin Tue, 02 Sep 2008 13:29:40 +0200 + +mozilla-devscripts (0.09) intrepid; urgency=low + + * Move cvs and mercurial from depends to recommends + * [ mozclient ] + + Full refactoring of mozclient: It is now written in object-oriented Perl. + The makefile version was getting difficult to extend and to maintain. + We now have a base class called MozClient::VCS and a set of VCS classes + inheriting for it. + + New features: + * MOZCLIENT_DYNTAG and MOZCLIENT_DYNTAG_FILES: nspr and nss are now + using a dynamic tag. They used to fetch HEAD which made them tricky + to distribute. Now, we take NSPR_CO_TAG and NSS_CO_TAG from + mozilla/client.mk (fetched from HEAD or from a tag) and we assign + a version like nss-3.12.0.3+1.9~cvs without trailing cvs date + (as it's a tagged nss), or nss-3.12.0.3+1.9 when using a tagged + mozilla/client.mk + * add optional MOZCLIENT_SEPARATOR to specify what we want between + the version and the date/revision tag in the version (default to ~) + * run an optional package specific clean-up script. It should be called + src/mozclient/${pkg_name}-remove.binonly.sh + * add support for svn + * add optional MOZCLIENT_TAREXCLUDE to extend the list of dirs/files + to exclude from packaging + * change MOZCLIENT_CVS_LOC and MOZCLIENT_HG_LOC into a common + MOZCLIENT_VCS_LOC and make it mandatory + * add MOZCLIENT_APPNAME in order for xulrunner applications to specify + their toplevel directory name. It is set by default to 'mozilla' + * change version of all hg project to have YYYYMMDDrRRR instead of + RRR~YYYMMDD which was different from all other VCS + + New or updated projects: + * add projects for Prism and Flock using svn + * add project for Fennec using hg + * make xulrunner-1.9.1 and xulrunner-2.0 use embedded tarballs + * disable MOZCLIENT_POSTCOCMD for xulrunner-1.9.1 and firefox-3.1 + now that upstream made it obsolete + + Update global clean-up script to remove new .dll/.exe shipped + by upstream + + * [ compare ] + + Add build-tree/dist to the list of directories for compare1 + + add support for flock + + * [ xulapp ] + + Add a rules file for xulrunner applications installing a build + system from the xulrunner SDK + + -- Fabien Tassin Sat, 28 Jun 2008 16:41:05 +0200 + +mozilla-devscripts (0.08.1) intrepid; urgency=low + + Release cherry pick from 0.09 release to intrepid + [ Fabien Tassin ] + * Move cvs and mercurial from depends to recommends + - update debian/control + + -- Alexander Sack Fri, 30 May 2008 12:33:08 +0200 + +mozilla-devscripts (0.08) intrepid; urgency=low + + [ Alexander Sack ] + * add .NOTPARALLEL target to make mozclient.mk more reliable in parallel + make runs. We don't want parallel execution within the scope of + mozclient.mk. Maybe noteworthy that this doesn't prevent clients to + invoke get-orig-source with distinct parameters in parallel. + - update src/mozclient.mk.in + + [ Fabien Tassin ] + * [ mozclient ] + + change the mozclient-status target name to list-tags, easier to remember. + Preserve legacy mozclient-status + - update src/mozclient.mk.in + - update README + + add support for Mercurial (hg) in addition to cvs. + Add MOZCLIENT_VCS variable (default to cvs). Add mercurial to Depends. + The preferred way to fetch a particular hg snapshot is to use a revision + number, it's better than a date. + - update deban/control + - update src/mozclient.mk.in + - update README + + make the mozclient patch system optional by introducing a new variable + called MOZCLIENT_WANTPATCH. Set it only for firefox 3. + - update src/firefox-3.0-full.mk.in + - update src/firefox-3.0.mk.in + - update src/mozclient.mk.in + + add 4 projects using Mercurial. They need python (>= 2.4) so add + python | python2.4 to Depends. They also need a post checkout script to + fetch dependencies (nspr/nss/tamarin) so introduce a new variable called + MOZCLIENT_POSTCOCMD. We now use hgweb instead of bonsai to get revision + ids and dates. + - update deban/control + - add src/firefox-3.1.mk.in + - add src/firefox-4.0.mk.in + - add src/xulrunner-1.9.1.mk.in + - add src/xulrunner-2.0.mk.in + - update src/Makefile + + add a variable called DEBIAN_KEEP_VCS to preserve the VCS files such as + */CVS or .hg + - update src/mozclient.mk.in + - update README + + Add a mozclient-version target producing a VERSION=foo string on stdout + - update src/mozclient.mk.in + + Fix nspr and nss conf files to fetch xulrunner version file using + MOZCLIENT_FILE instead of MOZCLIENT_MODULES + - update src/nspr.mk.in + - update src/nss.mk.in + + * [ minefield-packager ] + + drop dpkg-shlibdeps's stderr messages, add a banner with a license + - udpate src/minefield-packager.mk.in + + change the description in the desktop file to identify more clearly + that this is an upstream nightly build + - udpate src/minefield-packager/debian/pkgname.desktop.in + + drop gif/jpg/png from the MimeType field so this minefield does not + appear in the Open With menu for images + - udpate src/minefield-packager/debian/pkgname.desktop.in + + -- Fabien Tassin Fri, 30 May 2008 12:33:08 +0200 + +mozilla-devscripts (0.07) hardy; urgency=low + + * [ mozclient ] + + Fix checkouts by date where the provided date was not + transformed into a date that cvs could recognize (LP: #215382) + - update src/mozclient.mk.in + + -- Fabien Tassin Thu, 10 Apr 2008 23:07:45 +0200 + +mozilla-devscripts (0.06) hardy; urgency=low + + [ Alexander Sack ] + * [ xpi ]: + + introduce support to extract xpi translations from any build tree that + ships chrome.manifest indexed xul/xpi translations. This feature is ment + to be hooked into install phase of then package build. cdbs users can just + include this helper as we ship the appropriate cdbs hooks. + - add src/lp-locale-export.mk + * [ lp-locale-export ]: + + add lp-locale-export.mk to the build (add to extra_mk_files) + - update src/Makefile + + add README stub for lp-locale-export.mk + - update README + + [ Fabien Tassin ] + * [ compare ]: + + Add support for compare in thunderbird-3.0 + - update src/thunderbird-3.0.mk.in + * [ mozclient ]: + + Update mozclient-status rule to list tags relative to each project + instead of just gecko trunk + - update src/mozclient.mk.in + + Update nspr project file to generate a version containing the gecko + version, such as 4.7.1~beta+1.9b5~cvs20080310t1054 or + 4.7.1~beta2+1.9b5~cvs20080314t1505 + - update src/nspr.mk.in + + Fail when MOZCLIENT_GETDATE was not able to find the date on bonsai + - update src/mozclient.mk.in + + Add a firefox-3.0-full project creating a full firefox tarball, + i.e. regular browser and not the ubuntu specific xulbrowser + - add src/firefox-3.0-full.mk.in + - update src/Makefile + + Add a xulrunner-1.8 project + - add src/xulrunner-1.8.mk.in + - update src/Makefile + * [ minefield-packager ] + + New module creating debs from Firefox nightly built tarballs + - add src/minefield-packager.mk.in + - add src/minefield-packager/debian/* + - update src/Makefile + - update README + + Add dpkg-dev (for dpkg-deb) and fakeroot to depends + - update debian/control + * Add $(extra_mk_dirs) to install a full directory and use it for + minefield-packager/debian and (mozclient/)patches + - update src/Makefile + + -- Fabien Tassin Fri, 04 Apr 2008 16:14:45 +0200 + +mozilla-devscripts (0.05) hardy; urgency=low + + * new release shipping xpi.mk (LP: #195366) + - this upload belongs to the general FF Exception of #193225. + + [ Fabien Tassin ] + * Update mozclient patch for xulbrowser now that firefox 3 needs + mozilla/memory to build + - update src/patches/xulbrowser_target.patch + * Rewrite package description now that we provide several scripts + - update debian/control + * Update the compare module to also check dist/bin vs debian/tmp + - update src/compare.mk.in + - update src/firefox-3.0.mk.in + - update src/xulrunner-1.9.mk.in + - update README + * Change nspr version in mozclient to ~~cvs now that upstream bumped + its version so we can change our versionning later + - update src/nspr.mk.in + + [ Alexander Sack ] + * add initial xpi makefile helper that tries to make extension package + maintenance as trivial as possible + - add src/xpi.mk + - update src/Makefile + * add libxml-xpath-perl to Depends: required by install.rdf introspection + in xpi.mk + - update debian/control + * add unzip (needed by xpi.mk) to Depends: of mozilla-devscript binary package + - update debian/control + * introduce MOZ_XPI_MOZILLA_DIRS in xpi.mk with default values: + "firefox-addons firefox" + - update src/xpi.mk + * document xpi.mk in README + - update README + + -- Fabien Tassin Mon, 25 Feb 2008 11:39:01 +0100 + +mozilla-devscripts (0.04) hardy; urgency=low + + * Add support in mozclient for DEBIAN_TAG for nss and nspr by not using + mozilla/client.mk for those two. + - update src/mozclient.mk.in and README + - update src/{nspr,nss}.mk.in + - drop src/patches/{nspr,nss}_target.patch + - update src/patches/xulbrowser_target.patch + - update src/patches/series + + -- Fabien Tassin Fri, 08 Feb 2008 22:13:42 +0100 + +mozilla-devscripts (0.03) hardy; urgency=low + + * Fix PST date missed for direct checkout + - update src/mozclient.mk.in + * Add the 'compare' script + - add src/compare.mk.in + - update src/Makefile + * Rephrase documentation and document 'compare' + - update README + - update src/mozclient.mk.in + * Add support for 'compare' in seamonkey, firefox and xulrunner + - update src/seamonkey-2.0.mk.in + - update src/xulrunner-1.9.mk.in + - update src/firefox-3.0.mk.in + + -- Fabien Tassin Tue, 29 Jan 2008 14:06:37 +0100 + +mozilla-devscripts (0.02) hardy; urgency=low + + * Move patches for mozilla/client.mk inside src/ as they were previously + missed at install time. This will prevent confusions with other future + scripts + * Add PST to dates passed to cvs so it matches dates from Bonsai + - update src/mozclient.mk.in + * Drop Changelog.txt, use debian/changelog instead + + -- Fabien Tassin Thu, 17 Jan 2008 22:17:46 +0100 + +mozilla-devscripts (0.01) hardy; urgency=low + + * Initial version (LP: #179501) + + -- Fabien Tassin Sun, 30 Dec 2007 21:06:05 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b0bd5bb --- /dev/null +++ b/debian/control @@ -0,0 +1,25 @@ +Source: mozilla-devscripts +Section: devel +Priority: optional +Maintainer: Debian Mozilla Extension Maintainers +Uploaders: Benjamin Drung , Andrea Veri , Sean Whitton +Build-Depends: debhelper (>= 9), python-all (>= 2.6.6-3~), python-librdf +Standards-Version: 3.9.7 +X-Python-Version: >= 2.6 +VCS-Browser: https://anonscm.debian.org/cgit/pkg-mozext/mozilla-devscripts.git/ +VCS-Git: https://anonscm.debian.org/git/pkg-mozext/mozilla-devscripts.git + +Package: mozilla-devscripts +Architecture: all +Depends: python-librdf, + unzip, + zip, + ${misc:Depends}, + ${perl:Depends}, + ${python:Depends} +Description: Development scripts used by Mozilla's addons packages + This package contains mozilla-devscripts, a collection of scripts + based on Makefile inheritance meant for packaging Firefox's and + Icedove's extensions. These tools will help maintainers to build + link and install all XUL extensions properly following the policies + outlined by the Debian Mozilla Extension Maintainers team. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..84ce51f --- /dev/null +++ b/debian/copyright @@ -0,0 +1,66 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: mozilla-devscripts +Source: git://git.debian.org/pkg-mozext/mozilla-devscripts.git + +Files: * +Copyright: 2009-2014, Benjamin Drung +License: ISC + +Files: README +Copyright: 2007-2009, Sasa Bodiroza + 2009-2011, Benjamin Drung + 2007-2009, Alexander Sack + 2007-2009, Fabien Tassin +License: GPL-2+ + +Files: amo-changelog man/amo-changelog.1 +Copyright: 2014, Jakub Wilk + 2014, Ximin Luo +License: ISC + +Files: xpi-pack xpi-unpack +Copyright: 2007-2009, Sasa Bodiroza + 2007-2009, Alexander Sack +License: GPL-2+ + +Files: data/xpi.mk +Copyright: 2008-2009 Canonical Ltd. +License: GPL-2+ + +Files: man/xpi-pack.1 man/xpi-unpack.1 +Copyright: 2007-2009, Sasa Bodiroza +License: GPL-2+ + +Files: perl/Debian/Buildsystem/xul_ext.pm perl/Debian/Sequence/xul_ext.pm +Copyright: 2010, Mike Hommey +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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package 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, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..4647c9c --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ --with python2 diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/dh_xul-ext b/dh_xul-ext new file mode 100755 index 0000000..221135b --- /dev/null +++ b/dh_xul-ext @@ -0,0 +1,426 @@ +#!/usr/bin/python + +# Copyright (c) 2009-2012, Benjamin Drung +# +# 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 csv +import glob +import optparse +import os +import subprocess +import sys + +from moz_version import (compare_versions, convert_moz_to_debian_version, + moz_to_next_debian_version) + +import RDF + +_VENDOR_ENV = "DH_XUL_EXT_VENDOR" +# error codes +COMMAND_LINE_SYNTAX_ERROR = 1 +MULTIPLE_INSTALL_RDFS = 2 +INVALID_VERSION_RANGE = 3 + +FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" +THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}" + + +class XulApp(object): + def __init__(self, xul_id, package, sol, eol): + self.xul_id = xul_id + self.package = package + self.sol = sol + self.eol = eol + self.min_version = None + self.max_version = None + + def __str__(self): + return(self.xul_id + ": " + self.package + " (" + self.sol + " to " + + self.eol + ")") + + def defaults_to_compatible(self): + """Returns true if the maximum and all later versions of the XUL + application defaults add-ons to compatible. The XUL extension will be + enabled even if the version of the XUL application is higher than the + specified maximum version in this case. + + Firefox/Iceweasel 10 and Thunderbird/Icedove 10 defaults add-ons to + compatible.""" + + return(self.xul_id in (FIREFOX_ID, THUNDERBIRD_ID) and + compare_versions(self.max_version, "10") >= 0) + + def get_breaks(self): + """Return a string for ${xpi:Breaks} for the XUL application.""" + breaks = [] + if self.min_version: + deb_min_version = convert_moz_to_debian_version(self.min_version) + breaks.append(self.package + " (<< " + deb_min_version + ")") + if self.max_version and not self.defaults_to_compatible(): + deb_max_version = moz_to_next_debian_version(self.max_version) + breaks.append(self.package + " (>> " + deb_max_version + ")") + return ", ".join(breaks) + + def get_eol(self): + return self.eol + + def get_id(self): + return self.xul_id + + def get_package(self): + return self.package + + def get_sol(self): + return self.sol + + def get_versioned_package(self): + versioned_package = self.package + if self.min_version: + deb_min_version = convert_moz_to_debian_version(self.min_version) + versioned_package += " (>= " + deb_min_version + ")" + return versioned_package + + def is_same_package(self, xul_app): + return self.xul_id == xul_app.xul_id and self.package == xul_app.package + + def set_max_version(self, max_version): + if compare_versions(self.eol, max_version) > 0: + self.max_version = max_version + + def set_min_version(self, min_version): + if compare_versions(self.sol, min_version) < 0: + self.min_version = min_version + + def update_version(self, sol, eol): + if compare_versions(self.sol, sol) > 0: + self.sol = sol + if compare_versions(self.eol, eol) < 0: + self.eol = eol + + +def _get_data_dir(): + """Get the data directory based on the module location.""" + if __file__.startswith("/usr/bin"): + data_dir = "/usr/share/mozilla-devscripts" + else: + data_dir = os.path.join(os.path.dirname(__file__), "data") + return data_dir + + +def get_vendor(): + """This function returns the vendor (e.g. Debian, Ubuntu) that should be + used for calculating the dependencies. DH_XUL_EXT_VENDOR will be used + if set. Otherwise dpkg-vendor will be used for determining the vendor.""" + if _VENDOR_ENV in os.environ: + vendor = os.environ[_VENDOR_ENV] + else: + cmd = ["dpkg-vendor", "--derives-from", "Ubuntu"] + retval = subprocess.call(cmd) + if retval == 0: + vendor = "Ubuntu" + else: + vendor = "Debian" + return vendor + + +def get_xul_apps(script_name, all_distros): + vendor = get_vendor() + data_dir = _get_data_dir() + if all_distros or vendor == "all": + csv_filenames = sorted(glob.glob(os.path.join(data_dir, + "xul-app-data.csv.*"))) + else: + csv_filename = os.path.join(data_dir, "xul-app-data.csv." + vendor) + if not os.path.isfile(csv_filename): + print >> sys.stderr, ('%s: Unknown vendor "%s" specified.' % + (script_name, vendor)) + sys.exit(1) + csv_filenames = [csv_filename] + + xul_apps = [] + for csv_filename in csv_filenames: + csvfile = open(csv_filename) + csv_reader = csv.DictReader(csvfile) + for row in csv_reader: + xul_app = XulApp(row["id"], row["package"], row["sol"], row["eol"]) + existing = [x for x in xul_apps if x.is_same_package(xul_app)] + if existing: + xul_app = existing[0] + xul_app.update_version(row["sol"], row["eol"]) + else: + xul_apps.append(xul_app) + + return xul_apps + + +def _get_id_max_min_triple(script_name, package, install_rdf): + """create array of id_max_min triples""" + id_max_min = [] + model = RDF.Model() + parser = RDF.Parser(name="rdfxml") + parser.parse_into_model(model, "file:" + install_rdf) + query = RDF.Query( + """ + PREFIX em: + SELECT ?id ?max ?min + WHERE { + [] em:targetApplication ?x . + ?x em:id ?id . + OPTIONAL { + ?x em:maxVersion ?max . + ?x em:minVersion ?min . + } . + } + """, query_language="sparql") + results = query.execute(model) + # append to id_max_min tripe to array + failures = 0 + for target in results: + appid = target["id"].literal_value["string"] + max_version = target["max"].literal_value["string"] + min_version = target["min"].literal_value["string"] + id_max_min.append((appid, max_version, min_version)) + # Sanity check version range + if compare_versions(min_version, max_version) > 0: + msg = ("%s: %s contains an invalid version range for %s:\n" + "%s: minVersion <= maxVersion is required, but %s > %s.\n" + "%s: Please either fix the versions or remove the entry " + "from install.xpi." % + (script_name, package, appid, script_name, min_version, + max_version, script_name)) + print >> sys.stderr, msg + failures += 1 + if failures > 0: + sys.exit(INVALID_VERSION_RANGE) + + return id_max_min + + +def get_supported_apps(script_name, xul_apps, install_rdf, package, + verbose=False): + id_max_min = _get_id_max_min_triple(script_name, package, install_rdf) + if verbose: + 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 xul_app in xul_apps: + supported_app = [x for x in id_max_min if x[0] == xul_app.get_id()] + if len(supported_app) == 1: + # package is supported by extension + (appid, max_version, min_version) = supported_app.pop() + if compare_versions(xul_app.get_sol(), max_version) <= 0: + if compare_versions(xul_app.get_eol(), min_version) >= 0: + xul_app.set_min_version(min_version) + xul_app.set_max_version(max_version) + supported_apps.append(xul_app) + if verbose: + print "%s: %s supports %s." % (script_name, package, + xul_app.get_package()) + elif verbose: + print "%s: %s does not support %s (any more)." % \ + (script_name, package, xul_app.get_package()) + elif verbose: + print "%s: %s does not support %s (yet)." % \ + (script_name, package, xul_app.get_package()) + elif len(supported_app) > 1: + print ("%s: Found error in %s. There are multiple entries for " + "application ID %s.") % (script_name, install_rdf, + xul_app.get_id()) + + return supported_apps + + +def get_all_packages(): + lines = open("debian/control").readlines() + package_lines = [x for x in lines if x.find("Package:") >= 0] + packages = [p[p.find(":")+1:].strip() for p in package_lines] + return packages + + +def get_source_package_name(): + source = None + control_file = open("debian/control") + for line in control_file: + if line.startswith("Source:"): + source = line[line.find(":")+1:].strip() + break + return source + + +def has_no_xpi_depends(): + lines = open("debian/control").readlines() + xpi_depends_lines = [l for l in lines if l.find("${xpi:Depends}") >= 0] + return len(xpi_depends_lines) == 0 + + +def get_provided_package_names(package, supported_apps): + ext_name = package + for prefix in ("firefox-", "iceweasel-", "mozilla-", "xul-ext-"): + if ext_name.startswith(prefix): + ext_name = ext_name[len(prefix):] + + # check if MOZ_XPI_EXT_NAME is defined in debian/rules + lines = open("debian/rules").readlines() + lines = [l for l in lines if l.find("MOZ_XPI_EXT_NAME") != -1] + if len(lines) > 0: + line = lines[-1] + ext_name = line[line.find("=")+1:].strip() + + provides = set() + provides.add("xul-ext-" + ext_name) + if ext_name == get_source_package_name(): + provides.add(ext_name) + + for xul_app in supported_apps: + app = xul_app.get_package() + for i in xrange(len(app) - 1, -1, -1): + if app[i] == '-': + app = app[:i] + elif not app[i].isdigit() and not app[i] == '.': + break + provides.add(app + "-" + ext_name) + + # remove package name from provide list + provides.discard(package) + + return list(provides) + + +def find_install_rdfs(path): + install_rdfs = set() + + if os.path.isfile(path) and os.path.basename(path) == "install.rdf": + install_rdfs.add(os.path.realpath(path)) + + if os.path.isdir(path): + # recursive walk + content = [os.path.join(path, d) for d in os.listdir(path)] + install_rdfs = reduce(lambda x, d: x.union(find_install_rdfs(d)), + content, install_rdfs) + + return install_rdfs + + +def generate_substvars(script_name, xul_apps, package, verbose=False): + install_rdfs = find_install_rdfs("debian/" + package) + if len(install_rdfs) == 0: + if verbose: + print(script_name + ": " + package + + " does not contain a XUL extension (no install.rdf found).") + return + elif len(install_rdfs) > 1: + print >> sys.stderr, ("%s: %s contains multiple install.rdf files. " + "That's not supported.") % (script_name, package) + basepath_len = len(os.path.realpath("debian/" + package)) + rdfs = [x[basepath_len:] for x in install_rdfs] + print >> sys.stderr, "\n".join(rdfs) + sys.exit(MULTIPLE_INSTALL_RDFS) + install_rdf = install_rdfs.pop() + + filename = "debian/" + package + ".substvars" + if os.path.exists(filename): + substvars_file = open(filename) + lines = substvars_file.readlines() + substvars_file.close() + else: + lines = list() + + # remove existing varibles + lines = [s for s in lines if not s.startswith("xpi:")] + + supported_apps = get_supported_apps(script_name, xul_apps, install_rdf, + package, verbose) + packages = [a.get_versioned_package() for a in supported_apps] + if has_no_xpi_depends(): + # Use xpi:Recommends instead of xpi:Depends for backwards compatibility + print ("%s: Warning: Please add ${xpi:Depends} to Depends. Using only " + "${xpi:Recommends} is deprecated.") % (script_name) + lines.append("xpi:Recommends=" + " | ".join(packages) + "\n") + else: + lines.append("xpi:Depends=" + " | ".join(packages) + "\n") + lines.append("xpi:Recommends=\n") + packages = [a.get_breaks() for a in supported_apps] + lines.append("xpi:Breaks=" + ", ".join(sorted(packages)) + "\n") + packages = [a.get_package() for a in supported_apps] + lines.append("xpi:Enhances=" + ", ".join(sorted(packages)) + "\n") + packages = get_provided_package_names(package, supported_apps) + lines.append("xpi:Provides=" + ", ".join(sorted(packages)) + "\n") + + # write new variables + substvars_file = open(filename, "w") + substvars_file.writelines(lines) + substvars_file.close() + + +class UnknownOptionIgnoringOptionParser(optparse.OptionParser): + def __init__(self, **options): + optparse.OptionParser.__init__(self, **options) + self.unknown_options = [] + + def _process_long_opt(self, rargs, values): + option = rargs[0].split("=")[0] + if not option in self._long_opt: + self.unknown_options.append(option) + del rargs[0] + else: + optparse.OptionParser._process_long_opt(self, rargs, values) + + def _process_short_opts(self, rargs, values): + option = rargs[0][0:2] + if not self._short_opt.get(option): + self.unknown_options.append(option) + del rargs[0] + else: + optparse.OptionParser._process_short_opts(self, rargs, values) + + +def main(): + script_name = os.path.basename(sys.argv[0]) + epilog = "See %s(1) for more info." % (script_name) + parser = UnknownOptionIgnoringOptionParser(epilog=epilog) + parser.add_option("--all", action="store_true", dest="all", + help="expand substvars to all known XUL applications " + "(not only of your distribution)", default=False) + parser.add_option("-p", "--package", dest="packages", metavar="PACKAGE", + action="append", default=[], + help="calculate substvars only for the specified PACKAGE") + parser.add_option("-v", "--verbose", action="store_true", dest="verbose", + default=False, help="print more information") + + options = parser.parse_args()[0] + + if len(options.packages) == 0: + options.packages = get_all_packages() + + if options.verbose: + for unknown_option in parser.unknown_options: + sys.stderr.write("%s: warning: no such option: %s\n" % + (script_name, unknown_option)) + print script_name + ": packages:", ", ".join(options.packages) + + xul_apps = get_xul_apps(script_name, options.all) + if options.verbose and len(xul_apps) > 0: + print script_name + ": found %i Xul applications:" % (len(xul_apps)) + for xul_app in xul_apps: + print xul_app + + for package in options.packages: + generate_substvars(script_name, xul_apps, package, options.verbose) + +if __name__ == "__main__": + main() diff --git a/install-xpi b/install-xpi new file mode 100755 index 0000000..aba8773 --- /dev/null +++ b/install-xpi @@ -0,0 +1,315 @@ +#!/usr/bin/python + +# Copyright (c) 2009-2013, Benjamin Drung +# +# 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. + +from __future__ import print_function + +import csv +import optparse +import os +import stat +import subprocess +import sys +import zipfile + +import RDF + +LICENSE_PATTERN_LIST = ( + "copying", + "gpl.txt", + "licence", + "license", + "licence.txt", + "license.txt" +) + +# error codes +COMMAND_LINE_SYNTAX_ERROR = 1 +XPI_FILE_DOES_NOT_EXISTS = 2 +RDF_ERROR = 3 + + +def get_debian_directory(script_name): + """Return the path to the debian/ directory. + + Search for a debian/ directory in the current working directory and crawling + up the parent directories until one is found. The script will fail if no + debian/ directory is found or the debian/ directory does not contain a + control file.""" + base_directory = os.getcwd() + while not os.path.isdir(os.path.join(base_directory, "debian")): + parent_directory = os.path.split(base_directory)[0] + if base_directory == parent_directory: + sys.stderr.write(script_name + ": Error: Failed to find a debian/ " + "directory. Please execute this script inside a " + "Debian source package.\n") + sys.exit(1) + else: + base_directory = parent_directory + package_directory = os.path.join(base_directory, "debian") + # Check if debian/control exists. + if not os.path.isfile(os.path.join(package_directory, "control")): + sys.stderr.write(script_name + ": Error: debian/control file is " + "missing.\n") + sys.exit(1) + return package_directory + + +def get_query_field_id_as_list(rdf_path, query_string): + ret = [] + model = RDF.Model() + parser = RDF.Parser(name="rdfxml") + parser.parse_into_model(model, "file:" + rdf_path) + query = RDF.Query("PREFIX em: " + + query_string, query_language="sparql") + results = query.execute(model) + for result in results: + ret.append(result["id"].literal_value["string"]) + return ret + + +def get_target_applications(install_rdf): + target_applications = get_query_field_id_as_list( + install_rdf, + "SELECT ?id WHERE { [] em:targetApplication ?x . ?x em:id ?id }" + ) + return target_applications + + +def get_extension_id(install_rdf): + extension_ids = set(get_query_field_id_as_list( + install_rdf, + "SELECT ?id WHERE {?x em:targetApplication [] . ?x em:id ?id }" + )) + return extension_ids.pop() + + +def get_arch(package, debian_directory): + lines = open(os.path.join(debian_directory, "control")).readlines() + package_lines = filter(lambda x: x.find("Package:") >= 0, lines) + packages = map(lambda x: x[x.find(":")+1:].strip(), package_lines) + architecture_lines = filter(lambda x: x.find("Architecture:") >= 0, lines) + architectures = map(lambda x: x[x.find(":")+1:].strip(), architecture_lines) + (_, arch) = filter(lambda (x, y): x == package, + zip(packages, architectures))[0] + return arch + + +def get_mode(filename): + statinfo = os.stat(filename) + mode = statinfo[stat.ST_MODE] + return mode & 0777 + + +def get_xul_apps(): + 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 install_xpi(script_name, package, xpi_file, exclude, install_dir, links, + correct_permissions, remove_licenses, system_prefs, + debian_directory, verbose=False): + # get xpi file content list + if not os.path.isfile(xpi_file): + print("%s: Error: xpi file %s does not exist." % + (script_name, xpi_file), file=sys.stderr) + sys.exit(XPI_FILE_DOES_NOT_EXISTS) + zfobj = zipfile.ZipFile(xpi_file) + xpi_content = sorted(zfobj.namelist()) + + # determine installation directory + if get_arch(package, debian_directory) == "all": + lib_share_dir = "share" + else: + lib_share_dir = "lib" + if install_dir is None: + install_dir = os.path.join("usr", lib_share_dir, "xul-ext", + package.replace("xul-ext-", "")) + copy_dir = os.path.join(debian_directory, package, install_dir.strip("/")) + if verbose: + print("%s: install directory: %s" % (script_name, install_dir)) + + # remove documented license files + if remove_licenses: + for name in filter(lambda x: not x.endswith('/'), xpi_content): + basename = os.path.basename(name).lower() + if basename in LICENSE_PATTERN_LIST: + exclude.append(name) + print("%s: exclude license file %s" % (script_name, name)) + + # create directory and extract xpi file + if not os.path.isdir(copy_dir): + os.makedirs(copy_dir) + # With unzip, the mtime of created files will depend on the timezone, + # which prevents reproducible builds. Let's make it UTC before unzipping. + os.environ['TZ'] = 'UTC' + command = ["unzip", "-o", "-d", copy_dir, xpi_file] + if len(exclude) > 0: + command.append("-x") + command.extend(exclude) + print(" ".join(command)) + subprocess.call(command) + + # correct permissons of files to 644 and directories to 755 + if correct_permissions: + for name in xpi_content: + filename = os.path.join(copy_dir, name) + if os.path.exists(filename): + mode = get_mode(filename) + if os.path.isdir(filename) and mode != 0755: + print("%s: correct permission from %s to %s of %s" % + (script_name, oct(mode), oct(0755), name)) + os.chmod(filename, 0755) + elif os.path.isfile(filename): + header = open(filename, "r").read(2) + if header != "#!" and mode != 0644: + # file without shebang + print("%s: correct permission from %s to %s of %s" % + (script_name, oct(mode), oct(0644), name)) + os.chmod(filename, 0644) + elif header == "#!" and mode != 0755: + # file with shebang + print("%s: correct permission from %s to %s of %s" % + (script_name, oct(mode), oct(0755), name)) + os.chmod(filename, 0755) + + # create a system preference file in /etc + if system_prefs: + # search for preference .js files in defaults/preferences/ + pref_dir = os.path.join("defaults", "preferences") + preferences = filter(lambda f: os.path.dirname(f) == pref_dir and + f.endswith(".js"), xpi_content) + if len(preferences) > 0: + prefdir = os.path.join("etc", "xul-ext") + full_prefdir = os.path.join(debian_directory, package, prefdir) + if not os.path.exists(full_prefdir): + os.makedirs(full_prefdir) + prefname = package.replace("xul-ext-", "") + ".js" + # create system preference file + f = open(os.path.join(full_prefdir, prefname), "w") + config_file = os.path.join(debian_directory, package + ".js") + if os.path.isfile(config_file): + # use debian/package.js as configuration file if it exists + content = open(config_file).read() + # replace @INSTALLDIR@ by the actual installation directory + content = content.replace("@INSTALLDIR@", + os.path.join("/", install_dir)) + f.write(content) + else: + f.write("// Place your preferences for " + package + + " in this file.\n") + f.write("// You can override here the preferences specified " + "in\n") + map(lambda x: f.write("// " + + os.path.join("/", install_dir, x) + + "\n"), preferences) + f.close() + link_source = os.path.join(prefdir, prefname) + link_target = os.path.join(install_dir, "defaults", "preferences", + "000system.js") + command = ["dh_link", "-p" + package, link_source, link_target] + if verbose: + print(" ".join(command)) + subprocess.call(command, cwd=os.path.dirname(debian_directory)) + + # get symlinks list + try: + extension_id = get_extension_id(os.path.join(copy_dir, "install.rdf")) + filename = os.path.join(copy_dir, "install.rdf") + target_applications = get_target_applications(filename) + except RDF.RedlandError as error: + print(script_name + ": Error while parsing install.rdf: " + str(error), + file=sys.stderr) + sys.exit(RDF_ERROR) + for target_application in target_applications: + destination = os.path.join("/usr", lib_share_dir, "mozilla/extensions", + target_application, extension_id) + links.add(destination) + + # create symlinks + for link in links: + command = ["dh_link", "-p" + package, install_dir, link] + print(" ".join(command)) + subprocess.call(command, cwd=os.path.dirname(debian_directory)) + + +def get_first_package(debian_directory): + lines = open(os.path.join(debian_directory, "control")).readlines() + package_lines = filter(lambda x: x.find("Package:") >= 0, lines) + packages = map(lambda x: x[x.find(":")+1:].strip(), package_lines) + return packages[0] + + +def main(): + script_name = os.path.basename(sys.argv[0]) + usage = "%s [options] " % (script_name) + epilog = "See %s(1) for more info." % (script_name) + parser = optparse.OptionParser(usage=usage, epilog=epilog) + + parser.add_option("--disable-system-prefs", + help="do not create a system preference file in /etc", + dest="system_prefs", action="store_false", default=True) + parser.add_option("-x", "--exclude", metavar="FILE", + help="do not install specified FILE", + dest="exclude", action="append", default=list()) + parser.add_option("-i", "--install-dir", metavar="DIRECTORY", + help="install extension into the specified DIRECTORY", + dest="install_dir") + parser.add_option("-l", "--link", metavar="DIRECTORY", + help="link from DIRECTORY to extension directory", + dest="links", action="append", default=list()) + parser.add_option("-p", "--package", metavar="PACKAGE", + help="install the extension into specified PACKAGE", + dest="package", default=None) + parser.add_option("--preserve-permissions", dest="correct_permissions", + action="store_false", default=True, + help="do not adjust the file permissions") + parser.add_option("-r", "--remove-license-files", dest="remove_licenses", + action="store_true", default=False, + help="do not install license files") + parser.add_option("-v", "--verbose", help="print more information", + dest="verbose", action="store_true", default=False) + + (options, args) = parser.parse_args() + + if len(args) == 0: + print("%s: Error: No xpi file specified." % (script_name), + file=sys.stderr) + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + elif len(args) > 1: + print("%s: Error: Multiple xpi files specified: %s" % + (script_name, ", ".join(args)), file=sys.stderr) + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + + debian_directory = get_debian_directory(script_name) + + if options.package is None: + options.package = get_first_package(debian_directory) + + if options.verbose: + print(script_name + ": Install %s into package %s." % + (args[0], options.package)) + + install_xpi(script_name, options.package, args[0], options.exclude, + options.install_dir, set(options.links), + options.correct_permissions, options.remove_licenses, + options.system_prefs, debian_directory, options.verbose) + +if __name__ == "__main__": + main() diff --git a/man/amo-changelog.1 b/man/amo-changelog.1 new file mode 100644 index 0000000..09ab68e --- /dev/null +++ b/man/amo-changelog.1 @@ -0,0 +1,64 @@ +.\" Copyright (c) 2014 Ximin Luo +.\" +.\" 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 AMO-CHANGELOG "1" "December 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/upstream/changelog.html debian/upstream/changelog + +\[char46]PHONY: get-orig-changelog +.br +get-orig-changelog: +.br + amo-changelog -p rst adblock-plus + +Using this approach, one would save the output files debian/upstream/{changelog.html,changelog} +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. +.TP +\fB\-f\fR, \fB\-\-html\-file\fR +File to write to. Default: debian/upstream/changelog.html +.TP +\fB\-p\fR, \fB\-\-plain\-format\fR +Generate a human-readable form of the changelog in the file without the .html +extension, using an external program. Possible options are text (uses lynx(1)), +markdown (pandoc(1)), or rst (pandoc(1)). Default: none. +.SH AUTHOR +Jakub Wilk and Ximin Luo diff --git a/man/dh_xul-ext.1 b/man/dh_xul-ext.1 new file mode 100644 index 0000000..3aba22d --- /dev/null +++ b/man/dh_xul-ext.1 @@ -0,0 +1,55 @@ +.\" Copyright (c) 2010-2011 Benjamin Drung +.\" +.\" 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 DH_XUL-EXT "1" "October 2011" "dh_xul-ext" "mozilla-devscripts suite" +.SH NAME +dh_xul-ext \- calculate XUL extension dependencies +.SH SYNOPSIS +.B dh_xul-ext +[\fIoptions\fP] +.SH DESCRIPTION +.B dh_xul-ext +is a helper tool for packaging XUL extensions. It calculates the supported +XUL applications for the packages that contain an install.rdf file. It will set +the substitution variables xpi:Depends, xpi:Recommends, xpi:Breaks, +xpi:Enhances, and xpi:Provides. Unknown options will be ignored. +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Display a brief help message. +.TP +\fB\-a\fR, \fB\-\-all\fR +Expand substvars to all known XUL applications. If this parameter is not +provided, substvars will only be expanded to the XUL applications that are +available on your distribution. Use this parameter if you want to create a +package that can be installed on all Debian-based systems without recompiling. +.TP +\fB\-p\fR \fIpackage\fP, \fB\-\-package\fR=\fIpackage\fP +Calcalate the substvars only for the specified package. If this parameter is not +provided, all package listed in the control file will be processed. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Print more information. +.SH ENVIRONMENT +.TP +.BR DH_XUL_EXT_VENDOR +The vendor (for example, \fBDebian\fR or \fBUbuntu\fR) that should be used for +calculating the dependencies. +.BR dpkg\-vendor (1) +will be used for determining the vendor if this environment variable is not set. +Setting the variable to \fBall\fR will have the same effect than calling +.BR dh_xul\-ext +with \fB\-\-all\fR. +.SH AUTHOR +Benjamin Drung diff --git a/man/install-xpi.1 b/man/install-xpi.1 new file mode 100644 index 0000000..3e6211a --- /dev/null +++ b/man/install-xpi.1 @@ -0,0 +1,77 @@ +.\" Copyright (c) 2010-2011 Benjamin Drung +.\" +.\" 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 INSTALL-XPI "1" "January 2010" "install-xpi" "mozilla-devscripts suite" +.SH NAME +install-xpi \- installs a xpi file into a Debian package +.SH SYNOPSIS +.B install-xpi +[\fIoptions\fP] +\fIxpi-file\fR +.SH DESCRIPTION +.B install-xpi +is a helper tool for packaging XUL extensions. It installs the given xpi file +into the correct directory and creates the required links based on the data +in the install.rdf file. +It corrects the file permissions unless \fR\-\-preserve\-permissions\fP is +specified. + +.B install-xpi +will create a configuration file in /etc if the XUL extension provides one or +more preferences files in defaults/preferences. The configuration file +contains only a description where to find the overridable preferences. +debian/package.js is used as configuration file instead if it +exists. The placeholder @INSTALLDIR@ is replaces by the actual installation +directory. You can disable the creation of a system configuration file with +\-\-disable\-system\-prefs. +.SH OPTIONS +.TP +.B \-\-disable\-system\-prefs +Do not create a system preference file in /etc. +.TP +\fB\-x\fR \fIfile\fP, \fB\-\-exclude\fR=\fIfile\fP +The specified \fIfile\fP from the xpi file will not be installed. You can use +this parameter several times. +.TP +\fB\-h\fR, \fB\-\-help\fR +Display a brief help message. +.TP +\fB\-i\fR \fIdirectory\fP, \fB\-\-install-dir\fR=\fIdirectory\fP +The xpi file will be installed in the specified directory. +.I directory +must be an absolute path. Use this parameter with care. +.TP +\fB\-l\fR \fIdirectory\fP, \fB\-\-link\fR=\fIdirectory\fP +An additional link from the \fIdirectory\fP to the installation directory of +the extension will be created. You can use this parameter several times. +.TP +\fB\-p\fR \fIpackage\fP, \fB\-\-package\fR=\fIpackage\fP +The xpi file will be installed in the specified binary package. If this +parameter is not provided, the first binary package listed in debian/control +will be used. +.TP +.B \-\-preserve\-permissions +The permissions of the files in the xpi file will not be modified. If this +parameter is not provided, +.B install-xpi +will try to correct the permissions of the files to 644 (files that starts with +a shebang will be corrected to 755). +.TP +\fB\-r\fR, \fB\-\-remove-license-files\fR +Files with names like copying, licence, or license will not be installed. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Print more information. +.SH AUTHOR +Benjamin Drung diff --git a/man/moz-version.1 b/man/moz-version.1 new file mode 100644 index 0000000..218f11e --- /dev/null +++ b/man/moz-version.1 @@ -0,0 +1,53 @@ +.\" Copyright (c) 2009-2011 Benjamin Drung +.\" +.\" 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 MOZ-VERSION "1" "August 2009" "moz-version" "mozilla-devscripts suite" +.SH NAME +moz-version \- version format handling tool +.SH SYNOPSIS +.B moz-version +[\fIoptions\fP] +\fIaction\fR +.SH DESCRIPTION +.B moz-version +is a tool for working with version string from the Mozilla suite. +It can compare Mozilla versions, convert Mozilla version into Debian upstream +version and the other way round. +.SH ACTIONS +.TP +\fB\-c\fR, \fB\-\-compare\fR \fIversion1 comparator version2\fP +Compare version numbers, where \fIcomparator\fP is a binary operator. +\fBmoz-version\fP returns success (zero result) if the specified condition is +satisfied, and failure (non-zero result) otherwise. The comparator must be one +of \fBlt le eq ne ge gt\fP. +.TP +\fB\-d\fR, \fB\-\-to\-deb\fR \fIversion\fP +Converts Mozilla \fIversion\fP into a Debian upstream version. For a full +Debian version you have to add a revision. +.TP +\fB\-m\fR, \fB\-\-to\-moz\fR \fIversion\fP +Converts Debian \fIversion\fP into a Mozilla version. The Debian revision and +the epoch will be stripped away. +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Display a brief help message. +.TP +\fB\-s\fR, \fB\-\-silent\fR +Do not print anything and die silent on errors. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Print more information. +.SH AUTHOR +Benjamin Drung diff --git a/man/xpi-pack.1 b/man/xpi-pack.1 new file mode 100644 index 0000000..e92b499 --- /dev/null +++ b/man/xpi-pack.1 @@ -0,0 +1,34 @@ +.TH XPI-PACK "1" "13 August 2009" + +.SH NAME +xpi-pack \- pack a directory to a XPI file + +.SH SYNOPSIS +\fBxpi-pack\fR <\fBinput_directory\fR> <\fBoutput_XPI_file\fR> + +.SH DESCRIPTION +\fBxpi-pack\fR packs a directory to a XPI file. It takes in consideration the unpacked JAR files, which are unpacked during the call of xpi-unpack script, in order to be able to distribute them through the repositories. +.LP +It is distributed as a part of mozilla-devscripts package, and is automatically called during the build process of Mozilla extension package, if the package includes xpi.mk script in debian/rules file. + + +.SH OPTIONS +.TP +None. + +.SH ENVIRONMENT VARIABLES +.TP +None. + +.SH EXAMPLE +.TP +xpi-pack ubufox ubufox.xpi +Packs the contents of the directory ubufox to file ubufox.xpi. + +.SH SEE ALSO +\fBxpi-unpack\fR + +.SH AUTHOR +\fBxpi-pack\fR was written by Alexander Sack and Sasa Bodiroza , and this manual page by Sasa Bodiroza . + +Both are released under the GNU General Public License, version 2 or later. diff --git a/man/xpi-repack.1 b/man/xpi-repack.1 new file mode 100644 index 0000000..1dd9736 --- /dev/null +++ b/man/xpi-repack.1 @@ -0,0 +1,54 @@ +.\" Copyright (c) 2010-2014 Benjamin Drung +.\" +.\" 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" "March 2014" "xpi-repack" "mozilla-devscripts suite" +.SH NAME +xpi-repack \- repack a xpi file into a tarball +.SH SYNOPSIS +.B xpi-repack +[\fIoptions\fP] +\fIxpi-file\fR +.SH DESCRIPTION +.B xpi-repack +is a helper tool for packaging XUL extensions. It repacks the given xpi file +into a proper tarball that can be used as source tarball for the Debian package. +It is designed to work with uscan. Here is an example for debian/watch: + +version=3 +.br +ftp://ftp.mozilla.org/pub/mozilla.org/addons//-([\\d\\.]+)\-.*\\.xpi debian xpi-repack +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Display a brief help message. +.TP +\fB\-p\fR \fIpackage\fP, \fB\-\-package\fR=\fIpackage\fP +The \fIpackage\fP name will be used for naming the resulting tarball. If this +parameter is not provided, the source package name in debian/control will be +used. +.TP +\fB\-u\fR \fIversion\fP, \fB\-\-upstream\-version\fR=\fIversion\fP +The \fIversion\fP will be used for naming the resulting tarball. You have to +specify this parameter. +.TP +\fB\-f\fR \fIcompression\fP, \fB\-\-format\fR=\fIcompression\fP +The specified format will be used for compressing the resulting tarball. +The formats \fIbz2\fR, \fIgz\fR, and \fIxz\fR are supported. When the parameter +is omitted, \fIxz\fR will be used for "3.0 (quilt)" source packages and +\fIgz\fR for all other source package types. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Print more information. +.SH AUTHOR +Benjamin Drung diff --git a/man/xpi-unpack.1 b/man/xpi-unpack.1 new file mode 100644 index 0000000..5907b95 --- /dev/null +++ b/man/xpi-unpack.1 @@ -0,0 +1,34 @@ +.TH XPI-UNPACK "1" "13 August 2009" + +.SH NAME +xpi-unpack \- unpack a XPI file to a directory + +.SH SYNOPSIS +\fBxpi-unpack\fR <\fBinput_XPI_file\fR> <\fBoutput_directory\fR> + +.SH DESCRIPTION +\fBxpi-pack\fR unpacks a XPI file to the specified output directory. It takes in consideration JAR files, which are usually shipped inside XPI files, and unpacks them, in order to be able to distribute them through the repositories. The unpacked JAR files are packed during build process on call of xpi-pack script. +.LP +It is distributed as a part of mozilla-devscripts package. It should be called by developer, when the XPI file needs to be unpacked during packaging. + + +.SH OPTIONS +.TP +None. + +.SH ENVIRONMENT VARIABLES +.TP +None. + +.SH EXAMPLE +.TP +xpi-unpack ubufox.xpi ubufox +Unpacks the contents of ubufox.xpi to directory ubufox. + +.SH SEE ALSO +\fBxpi-pack\fR + +.SH AUTHOR +\fBxpi-unpack\fR was written by Alexander Sack and Sasa Bodiroza , and this manual page by Sasa Bodiroza . + +Both are released under the GNU General Public License, version 2 or later. diff --git a/moz-version b/moz-version new file mode 100755 index 0000000..b14c7fb --- /dev/null +++ b/moz-version @@ -0,0 +1,155 @@ +#!/usr/bin/python + +# Copyright (c) 2009-2011, Benjamin Drung +# +# 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 getopt +import os +import sys + +from moz_version import (compare_versions, convert_debian_to_moz_version, + convert_moz_to_debian_version) + +# error codes +COMMAND_LINE_SYNTAX_ERROR = 2 +INVALID_COMPARATOR = 3 +EMPTY_VERSION_STRING = 4 + +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) + + if comparator == "lt": + return compare_versions(version1, version2, verbose) < 0 + elif comparator == "le": + return compare_versions(version1, version2, verbose) <= 0 + elif comparator == "eq": + return compare_versions(version1, version2, verbose) == 0 + elif comparator == "ne": + return compare_versions(version1, version2, verbose) != 0 + elif comparator == "ge": + return compare_versions(version1, version2, verbose) >= 0 + elif comparator == "gt": + return compare_versions(version1, version2, verbose) > 0 + + +def usage(output): + name = os.path.basename(sys.argv[0]) + print >> output, """Usage: %s [options] action + +Actions: + -c, --compare version1 comparator version2 + compare both Mozilla version numbers + comparator must be one of %s + -d, --to-deb version converts Mozilla into a Debian upstream version + -m, --to-moz version converts Debian into a Mozilla version + +Options: + -h, --help display this help and exit + -s, --silent do not print anything and die silent on errors + -v, --verbose print more information + +See %s(1) for more info.""" % (name, ", ".join(COMPARATORS), name) + + +def main(): + try: + long_opts = ["compare", "help", "silent", "to-deb", "to-moz", "verbose"] + opts, args = getopt.gnu_getopt(sys.argv[1:], "cdhmsv", long_opts) + except getopt.GetoptError, e: + # print help information and exit: + print >> sys.stderr, str(e) + usage(sys.stderr) + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + + actions = set() + silent = False + verbose = False + + for o, _ in opts: + if o in ("-c", "--compare"): + actions.add("compare") + elif o in ("-d", "--to-deb"): + actions.add("to-deb") + elif o in ("-h", "--help"): + usage(sys.stdout) + sys.exit() + elif o in ("-m", "--to-moz"): + actions.add("to-moz") + elif o in ("-s", "--silent"): + silent = True + elif o in ("-v", "--verbose"): + verbose = True + else: + assert False, "unhandled option" + + if len(actions) != 1: + if not silent: + print >> sys.stderr, "E: You must specify an action." + usage(sys.stderr) + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + + action = actions.pop() + + if action == "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) + elif action == "to-deb": + if len(args) != 1: + if not silent: + print >> sys.stderr, "E: The action --to-deb takes exactly " + \ + "one argument." + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + print convert_moz_to_debian_version(args[0], 0, verbose) + elif action == "to-moz": + if len(args) != 1: + if not silent: + print >> sys.stderr, "E: The action --to-moz takes exactly " + \ + "one argument." + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + print convert_debian_to_moz_version(args[0]) + +if __name__ == "__main__": + main() diff --git a/moz_version.py b/moz_version.py new file mode 100644 index 0000000..86ed727 --- /dev/null +++ b/moz_version.py @@ -0,0 +1,222 @@ +# Copyright (c) 2009-2011, Benjamin Drung +# +# 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. + +# 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] == "-": + 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] == "-"): + 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] == "-": + 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(version1, version2, verbose=False): + a = decode_version(version1, verbose) + b = decode_version(version2, verbose) + + 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 extract_upstream_version(debian_version): + # remove last part separated by a dash (1.0-2 -> 1.0) + parts = debian_version.split('-') + if len(parts) > 1: + del parts[-1] + upstream_version = '-'.join(parts) + + # remove epoch + parts = upstream_version.split(':') + if len(parts) > 1: + del parts[0] + upstream_version = ':'.join(parts) + + return upstream_version + + +def _convert_part_to_debian(part): + """Converts a Mozilla version part (like 5pre4) to a Debian version.""" + (number_a, string_b, number_c, string_d) = part + debian_version = "" + if string_d != "": + debian_version = "~" + string_d + if number_c != 0 or string_d != "": + debian_version = str(number_c) + debian_version + if string_b != "": + debian_version = "~" + string_b + debian_version + debian_version = str(number_a) + debian_version + return debian_version + + +def convert_debian_to_moz_version(debian_version): + upstream_version = extract_upstream_version(debian_version) + + # compatibility: strip +nobinonly and +build + parts = upstream_version.split('+') + if len(parts) > 1 and parts[-1] == "nobinonly": + del parts[-1] + if len(parts) > 1 and parts[-1].startswith("build"): + del parts[-1] + upstream_version = '+'.join(parts) + + moz_version = upstream_version.replace("~", "") + return moz_version + + +def convert_moz_to_debian_version(moz_version, epoch=0, verbose=False): + parts = decode_version(moz_version, verbose) + # tranform parts + parts = [_convert_part_to_debian(p) for p in parts] + debian_version = ".".join(parts) + if epoch != 0: + debian_version = str(epoch) + ":" + debian_version + return debian_version + + +def moz_to_next_debian_version(moz_version, epoch=0, verbose=False): + """Convert a given Mozilla version to the next Debian version. + + Compared to convert_moz_to_debian_version it does following: + * append 0 to a trailing letter, or + * append + to a trailing number, or + * replace a trailing * with +. + + Examples: + 9.0a => 9.0~a0 + 9.0a1 => 9.0~a1+ + 9.0 => 9.0+ + 9.0.* => 9.0.+ + """ + parts = decode_version(moz_version, verbose) + # tranform last parts + (number_a, string_b, number_c, string_d) = parts[-1] + last_part = "" + if string_d != "": + last_part = "~" + string_d + "0" + if number_c != 0 or string_d != "": + if last_part: + last_part = str(number_c) + last_part + else: + if number_c == sys.maxint: + last_part = "+" + else: + last_part = str(number_c) + "+" + if string_b != "": + if last_part: + last_part = "~" + string_b + last_part + else: + last_part = "~" + string_b + "0" + if last_part: + last_part = str(number_a) + last_part + else: + if number_a == sys.maxint: + last_part = "+" + else: + last_part = str(number_a) + "+" + + parts = [_convert_part_to_debian(p) for p in parts[:-1]] + [last_part] + debian_version = ".".join(parts) + if epoch != 0: + debian_version = str(epoch) + ":" + debian_version + return debian_version diff --git a/perl/Debian/Buildsystem/xul_ext.pm b/perl/Debian/Buildsystem/xul_ext.pm new file mode 100644 index 0000000..89c8763 --- /dev/null +++ b/perl/Debian/Buildsystem/xul_ext.pm @@ -0,0 +1,43 @@ +# 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'; +use Debian::Debhelper::Dh_Lib; + +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", ".", $dh{FIRSTPACKAGE} . ".xpi"); +} + +sub install { + my $this=shift; + $this->doit_in_sourcedir("install-xpi", $dh{FIRSTPACKAGE} . ".xpi"); +} + +sub clean { + my $this=shift; + $this->doit_in_sourcedir("rm", "-f", $dh{FIRSTPACKAGE} . ".xpi"); +} + +1 diff --git a/perl/Debian/Sequence/xul_ext.pm b/perl/Debian/Sequence/xul_ext.pm new file mode 100644 index 0000000..515deea --- /dev/null +++ b/perl/Debian/Sequence/xul_ext.pm @@ -0,0 +1,8 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Debian::Debhelper::Dh_Lib; + +insert_after("dh_install", "dh_xul-ext"); + +1; diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9174109 --- /dev/null +++ b/setup.py @@ -0,0 +1,44 @@ +#!/usr/bin/python + +import glob +import os +import re + +from distutils.core import setup + + +def get_debian_version(): + """look what Debian version we have""" + version = None + changelog = "debian/changelog" + if os.path.exists(changelog): + head = open(changelog).readline() + match = re.compile(r".*\((.*)\).*").match(head) + if match: + version = match.group(1) + return version + +SCRIPTS = [ + 'amo-changelog', + 'dh_xul-ext', + 'install-xpi', + 'xpi-pack', + 'xpi-repack', + 'xpi-unpack', + 'moz-version', +] + +if __name__ == '__main__': + setup( + name='mozilla-devscripts', + version=get_debian_version(), + scripts=SCRIPTS, + py_modules=['moz_version'], + data_files=[ + ('share/doc/mozilla-devscripts', ['README']), + ('share/man/man1', glob.glob("man/*.1")), + ('share/mozilla-devscripts', ['data/xpi.mk'] + glob.glob('data/xul-app-data.csv.*')), + ('share/perl5/Debian/Debhelper/Buildsystem', ['perl/Debian/Buildsystem/xul_ext.pm']), + ('share/perl5/Debian/Debhelper/Sequence', ['perl/Debian/Sequence/xul_ext.pm']), + ], + ) diff --git a/tests/dh_xul-ext/all/debian/changelog b/tests/dh_xul-ext/all/debian/changelog new file mode 100644 index 0000000..1b45ee9 --- /dev/null +++ b/tests/dh_xul-ext/all/debian/changelog @@ -0,0 +1,5 @@ +test-package (1.0-1) UNRELEASED; urgency=low + + * Initial release. + + -- Benjamin Drung Sat, 09 Jul 2011 12:55:23 +0200 diff --git a/tests/dh_xul-ext/all/debian/compat b/tests/dh_xul-ext/all/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/tests/dh_xul-ext/all/debian/compat @@ -0,0 +1 @@ +7 diff --git a/tests/dh_xul-ext/all/debian/control b/tests/dh_xul-ext/all/debian/control new file mode 100644 index 0000000..1aea594 --- /dev/null +++ b/tests/dh_xul-ext/all/debian/control @@ -0,0 +1,18 @@ +Source: test-package +Section: web +Priority: extra +Maintainer: Ubuntu Mozilla Team +Build-Depends: debhelper (>= 7.0.50~), mozilla-devscripts (>= 0.22~) +Standards-Version: 3.9.2 + +Package: xul-ext-test-package +Architecture: all +Depends: ${misc:Depends}, ${xpi:Depends} +Recommends: ${xpi:Recommends} +Provides: ${xpi:Provides} +Enhances: ${xpi:Enhances} +Breaks: ${xpi:Breaks} +Description: mozilla-devscripts test package + This is a test package designed to test some scripts in mozilla-devscripts. + It is part of the mozilla-devscripts test suite and may do very odd things. It + should not be installed like a regular package. It may be an empty package. diff --git a/tests/dh_xul-ext/all/debian/rules b/tests/dh_xul-ext/all/debian/rules new file mode 100755 index 0000000..c5e3b65 --- /dev/null +++ b/tests/dh_xul-ext/all/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_install: + dh_install install.rdf /usr/share/xul-ext/test-package/ + ../../../dh_xul-ext --all diff --git a/tests/dh_xul-ext/all/install.rdf b/tests/dh_xul-ext/all/install.rdf new file mode 100644 index 0000000..744c1df --- /dev/null +++ b/tests/dh_xul-ext/all/install.rdf @@ -0,0 +1,40 @@ + + + + {deadda7a-fee1-dead-coo1-d00ddeadc0de} + 1.0 + mozilla-devscripts test package + + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 3.5 + 7.0a + + + + + + {3550f703-e582-4d05-9a08-453d09bdfdc6} + 3.0 + 7.0a1 + + + + + + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 2.0 + 2.4 + + + + + + {a79fe89b-6662-4ff4-8e88-09950ad4dfde} + 0.1 + 100.* + + + + diff --git a/tests/dh_xul-ext/all_environment/debian/changelog b/tests/dh_xul-ext/all_environment/debian/changelog new file mode 100644 index 0000000..1b45ee9 --- /dev/null +++ b/tests/dh_xul-ext/all_environment/debian/changelog @@ -0,0 +1,5 @@ +test-package (1.0-1) UNRELEASED; urgency=low + + * Initial release. + + -- Benjamin Drung Sat, 09 Jul 2011 12:55:23 +0200 diff --git a/tests/dh_xul-ext/all_environment/debian/compat b/tests/dh_xul-ext/all_environment/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/tests/dh_xul-ext/all_environment/debian/compat @@ -0,0 +1 @@ +7 diff --git a/tests/dh_xul-ext/all_environment/debian/control b/tests/dh_xul-ext/all_environment/debian/control new file mode 100644 index 0000000..1aea594 --- /dev/null +++ b/tests/dh_xul-ext/all_environment/debian/control @@ -0,0 +1,18 @@ +Source: test-package +Section: web +Priority: extra +Maintainer: Ubuntu Mozilla Team +Build-Depends: debhelper (>= 7.0.50~), mozilla-devscripts (>= 0.22~) +Standards-Version: 3.9.2 + +Package: xul-ext-test-package +Architecture: all +Depends: ${misc:Depends}, ${xpi:Depends} +Recommends: ${xpi:Recommends} +Provides: ${xpi:Provides} +Enhances: ${xpi:Enhances} +Breaks: ${xpi:Breaks} +Description: mozilla-devscripts test package + This is a test package designed to test some scripts in mozilla-devscripts. + It is part of the mozilla-devscripts test suite and may do very odd things. It + should not be installed like a regular package. It may be an empty package. diff --git a/tests/dh_xul-ext/all_environment/debian/rules b/tests/dh_xul-ext/all_environment/debian/rules new file mode 100755 index 0000000..738481a --- /dev/null +++ b/tests/dh_xul-ext/all_environment/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_install: + dh_install install.rdf /usr/share/xul-ext/test-package/ + DH_XUL_EXT_VENDOR=all ../../../dh_xul-ext diff --git a/tests/dh_xul-ext/all_environment/install.rdf b/tests/dh_xul-ext/all_environment/install.rdf new file mode 100644 index 0000000..744c1df --- /dev/null +++ b/tests/dh_xul-ext/all_environment/install.rdf @@ -0,0 +1,40 @@ + + + + {deadda7a-fee1-dead-coo1-d00ddeadc0de} + 1.0 + mozilla-devscripts test package + + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 3.5 + 7.0a + + + + + + {3550f703-e582-4d05-9a08-453d09bdfdc6} + 3.0 + 7.0a1 + + + + + + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 2.0 + 2.4 + + + + + + {a79fe89b-6662-4ff4-8e88-09950ad4dfde} + 0.1 + 100.* + + + + diff --git a/tests/dh_xul-ext/debian/debian/changelog b/tests/dh_xul-ext/debian/debian/changelog new file mode 100644 index 0000000..1b45ee9 --- /dev/null +++ b/tests/dh_xul-ext/debian/debian/changelog @@ -0,0 +1,5 @@ +test-package (1.0-1) UNRELEASED; urgency=low + + * Initial release. + + -- Benjamin Drung Sat, 09 Jul 2011 12:55:23 +0200 diff --git a/tests/dh_xul-ext/debian/debian/compat b/tests/dh_xul-ext/debian/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/tests/dh_xul-ext/debian/debian/compat @@ -0,0 +1 @@ +7 diff --git a/tests/dh_xul-ext/debian/debian/control b/tests/dh_xul-ext/debian/debian/control new file mode 100644 index 0000000..1aea594 --- /dev/null +++ b/tests/dh_xul-ext/debian/debian/control @@ -0,0 +1,18 @@ +Source: test-package +Section: web +Priority: extra +Maintainer: Ubuntu Mozilla Team +Build-Depends: debhelper (>= 7.0.50~), mozilla-devscripts (>= 0.22~) +Standards-Version: 3.9.2 + +Package: xul-ext-test-package +Architecture: all +Depends: ${misc:Depends}, ${xpi:Depends} +Recommends: ${xpi:Recommends} +Provides: ${xpi:Provides} +Enhances: ${xpi:Enhances} +Breaks: ${xpi:Breaks} +Description: mozilla-devscripts test package + This is a test package designed to test some scripts in mozilla-devscripts. + It is part of the mozilla-devscripts test suite and may do very odd things. It + should not be installed like a regular package. It may be an empty package. diff --git a/tests/dh_xul-ext/debian/debian/rules b/tests/dh_xul-ext/debian/debian/rules new file mode 100755 index 0000000..26712f4 --- /dev/null +++ b/tests/dh_xul-ext/debian/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_install: + dh_install install.rdf /usr/share/xul-ext/test-package/ + DEB_VENDOR=Debian ../../../dh_xul-ext diff --git a/tests/dh_xul-ext/debian/install.rdf b/tests/dh_xul-ext/debian/install.rdf new file mode 100644 index 0000000..0b507de --- /dev/null +++ b/tests/dh_xul-ext/debian/install.rdf @@ -0,0 +1,48 @@ + + + + {deadda7a-fee1-dead-coo1-d00ddeadc0de} + 1.0 + mozilla-devscripts test package + + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 3.5 + 7.0a + + + + + + {3550f703-e582-4d05-9a08-453d09bdfdc6} + 3.0 + 7.0a1 + + + + + + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 2.0 + 2.4 + + + + + + {a79fe89b-6662-4ff4-8e88-09950ad4dfde} + 0.1 + 100.* + + + + + + {718e30fb-e89b-41dd-9da7-e25a45638b28} + 1.5 + 1.9 + + + + diff --git a/tests/dh_xul-ext/default-to-compatible/debian/changelog b/tests/dh_xul-ext/default-to-compatible/debian/changelog new file mode 100644 index 0000000..1b45ee9 --- /dev/null +++ b/tests/dh_xul-ext/default-to-compatible/debian/changelog @@ -0,0 +1,5 @@ +test-package (1.0-1) UNRELEASED; urgency=low + + * Initial release. + + -- Benjamin Drung Sat, 09 Jul 2011 12:55:23 +0200 diff --git a/tests/dh_xul-ext/default-to-compatible/debian/compat b/tests/dh_xul-ext/default-to-compatible/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/tests/dh_xul-ext/default-to-compatible/debian/compat @@ -0,0 +1 @@ +7 diff --git a/tests/dh_xul-ext/default-to-compatible/debian/control b/tests/dh_xul-ext/default-to-compatible/debian/control new file mode 100644 index 0000000..1aea594 --- /dev/null +++ b/tests/dh_xul-ext/default-to-compatible/debian/control @@ -0,0 +1,18 @@ +Source: test-package +Section: web +Priority: extra +Maintainer: Ubuntu Mozilla Team +Build-Depends: debhelper (>= 7.0.50~), mozilla-devscripts (>= 0.22~) +Standards-Version: 3.9.2 + +Package: xul-ext-test-package +Architecture: all +Depends: ${misc:Depends}, ${xpi:Depends} +Recommends: ${xpi:Recommends} +Provides: ${xpi:Provides} +Enhances: ${xpi:Enhances} +Breaks: ${xpi:Breaks} +Description: mozilla-devscripts test package + This is a test package designed to test some scripts in mozilla-devscripts. + It is part of the mozilla-devscripts test suite and may do very odd things. It + should not be installed like a regular package. It may be an empty package. diff --git a/tests/dh_xul-ext/default-to-compatible/debian/rules b/tests/dh_xul-ext/default-to-compatible/debian/rules new file mode 100755 index 0000000..26712f4 --- /dev/null +++ b/tests/dh_xul-ext/default-to-compatible/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_install: + dh_install install.rdf /usr/share/xul-ext/test-package/ + DEB_VENDOR=Debian ../../../dh_xul-ext diff --git a/tests/dh_xul-ext/default-to-compatible/install.rdf b/tests/dh_xul-ext/default-to-compatible/install.rdf new file mode 100644 index 0000000..d8958fe --- /dev/null +++ b/tests/dh_xul-ext/default-to-compatible/install.rdf @@ -0,0 +1,24 @@ + + + + {deadda7a-fee1-dead-coo1-d00ddeadc0de} + 1.0 + mozilla-devscripts test package + + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 4.0 + 11 + + + + + + {3550f703-e582-4d05-9a08-453d09bdfdc6} + 5.0 + 12.0 + + + + diff --git a/tests/dh_xul-ext/expected_result/all.substvars b/tests/dh_xul-ext/expected_result/all.substvars new file mode 100644 index 0000000..7588166 --- /dev/null +++ b/tests/dh_xul-ext/expected_result/all.substvars @@ -0,0 +1,5 @@ +xpi:Depends=iceweasel (>= 3.5) | firefox (>= 3.5) | firefox-esr (>= 3.5) | thunderbird (>= 3.0) | icedove (>= 3.0) | conkeror | seamonkey (>= 2.0) +xpi:Recommends= +xpi:Breaks=conkeror (>> 100.+), firefox (<< 3.5), firefox (>> 7.0~a0), firefox-esr (<< 3.5), firefox-esr (>> 7.0~a0), icedove (<< 3.0), icedove (>> 7.0~a1+), iceweasel (<< 3.5), iceweasel (>> 7.0~a0), seamonkey (<< 2.0), seamonkey (>> 2.4+), thunderbird (<< 3.0), thunderbird (>> 7.0~a1+) +xpi:Enhances=conkeror, firefox, firefox-esr, icedove, iceweasel, seamonkey, thunderbird +xpi:Provides=conkeror-test-package, firefox-esr-test-package, firefox-test-package, icedove-test-package, iceweasel-test-package, seamonkey-test-package, test-package, thunderbird-test-package diff --git a/tests/dh_xul-ext/expected_result/all_environment.substvars b/tests/dh_xul-ext/expected_result/all_environment.substvars new file mode 100644 index 0000000..7588166 --- /dev/null +++ b/tests/dh_xul-ext/expected_result/all_environment.substvars @@ -0,0 +1,5 @@ +xpi:Depends=iceweasel (>= 3.5) | firefox (>= 3.5) | firefox-esr (>= 3.5) | thunderbird (>= 3.0) | icedove (>= 3.0) | conkeror | seamonkey (>= 2.0) +xpi:Recommends= +xpi:Breaks=conkeror (>> 100.+), firefox (<< 3.5), firefox (>> 7.0~a0), firefox-esr (<< 3.5), firefox-esr (>> 7.0~a0), icedove (<< 3.0), icedove (>> 7.0~a1+), iceweasel (<< 3.5), iceweasel (>> 7.0~a0), seamonkey (<< 2.0), seamonkey (>> 2.4+), thunderbird (<< 3.0), thunderbird (>> 7.0~a1+) +xpi:Enhances=conkeror, firefox, firefox-esr, icedove, iceweasel, seamonkey, thunderbird +xpi:Provides=conkeror-test-package, firefox-esr-test-package, firefox-test-package, icedove-test-package, iceweasel-test-package, seamonkey-test-package, test-package, thunderbird-test-package diff --git a/tests/dh_xul-ext/expected_result/debian.substvars b/tests/dh_xul-ext/expected_result/debian.substvars new file mode 100644 index 0000000..1391809 --- /dev/null +++ b/tests/dh_xul-ext/expected_result/debian.substvars @@ -0,0 +1,5 @@ +xpi:Depends=iceweasel (>= 3.5) | firefox (>= 3.5) | firefox-esr (>= 3.5) | thunderbird (>= 3.0) | icedove (>= 3.0) | conkeror | iceowl +xpi:Recommends= +xpi:Breaks=conkeror (>> 100.+), firefox (<< 3.5), firefox (>> 7.0~a0), firefox-esr (<< 3.5), firefox-esr (>> 7.0~a0), icedove (<< 3.0), icedove (>> 7.0~a1+), iceowl (>> 1.9+), iceweasel (<< 3.5), iceweasel (>> 7.0~a0), thunderbird (<< 3.0), thunderbird (>> 7.0~a1+) +xpi:Enhances=conkeror, firefox, firefox-esr, icedove, iceowl, iceweasel, thunderbird +xpi:Provides=conkeror-test-package, firefox-esr-test-package, firefox-test-package, icedove-test-package, iceowl-test-package, iceweasel-test-package, test-package, thunderbird-test-package diff --git a/tests/dh_xul-ext/expected_result/default-to-compatible.substvars b/tests/dh_xul-ext/expected_result/default-to-compatible.substvars new file mode 100644 index 0000000..6b87b82 --- /dev/null +++ b/tests/dh_xul-ext/expected_result/default-to-compatible.substvars @@ -0,0 +1,5 @@ +xpi:Depends=iceweasel (>= 4.0) | firefox (>= 4.0) | firefox-esr (>= 4.0) | thunderbird (>= 5.0) | icedove (>= 5.0) +xpi:Recommends= +xpi:Breaks=firefox (<< 4.0), firefox-esr (<< 4.0), icedove (<< 5.0), iceweasel (<< 4.0), thunderbird (<< 5.0) +xpi:Enhances=firefox, firefox-esr, icedove, iceweasel, thunderbird +xpi:Provides=firefox-esr-test-package, firefox-test-package, icedove-test-package, iceweasel-test-package, test-package, thunderbird-test-package diff --git a/tests/dh_xul-ext/expected_result/ubuntu.substvars b/tests/dh_xul-ext/expected_result/ubuntu.substvars new file mode 100644 index 0000000..81ff22d --- /dev/null +++ b/tests/dh_xul-ext/expected_result/ubuntu.substvars @@ -0,0 +1,5 @@ +xpi:Depends=firefox | thunderbird (>= 3.0) | seamonkey (>= 2.0) +xpi:Recommends= +xpi:Breaks=firefox (>> 7.0~a0), seamonkey (<< 2.0), seamonkey (>> 2.4+), thunderbird (<< 3.0), thunderbird (>> 7.0~a1+) +xpi:Enhances=firefox, seamonkey, thunderbird +xpi:Provides=firefox-test-package, seamonkey-test-package, test-package, thunderbird-test-package diff --git a/tests/dh_xul-ext/test b/tests/dh_xul-ext/test new file mode 100755 index 0000000..fa98a77 --- /dev/null +++ b/tests/dh_xul-ext/test @@ -0,0 +1,78 @@ +#!/usr/bin/python + +# Copyright (c) 2011, Benjamin Drung +# +# 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 os +import sys +import subprocess + +TESTS = ("all", "all_environment", "debian", "default-to-compatible", "ubuntu") + +class TestError(Exception): + pass + +def escape_arg(arg): + "Shell-escpae arg, if necessary" + if ' ' not in arg: + return arg + return '"%s"' % arg.replace('\\', r'\\').replace('"', r'\"') + +def fail(message): + print >> sys.stderr, "dh_xul-ext test error: " + message + sys.exit(1) + +def check_call(cmd, cwd=None): + return_code = subprocess.call(cmd, cwd=cwd) + if return_code != 0: + raise TestError("'" + " ".join(escape_arg(cmd)) + "' returned " + + str(return_code) + ".") + +def compare_files(file1, file2): + actual = open(file1).read().strip() + expected = open(file2).read().strip() + if actual != expected: + raise TestError("\033[91m Actual substvars files differs from expected file.\n" + "Expected content:\n" + expected + "\n" + \ + "Actual content:\n" + actual + "\033[0m") + +def test_dh_xul_ext(test): + basedir = os.path.dirname(__file__) + testdir = os.path.join(basedir, test) + clean_cmd = ["fakeroot", "debian/rules", "clean"] + check_call(clean_cmd, cwd=testdir) + try: + cmd = ["fakeroot", "debian/rules", "install"] + check_call(cmd, cwd=testdir) + substvars = os.path.join(testdir, "debian", + "xul-ext-test-package.substvars") + expected = os.path.join(basedir, "expected_result", test + ".substvars") + compare_files(substvars, expected) + finally: + check_call(clean_cmd, cwd=testdir) + +def main(): + errors = 0 + for test in TESTS: + try: + test_dh_xul_ext(test) + except TestError, error: + errors += 1 + print >> sys.stderr, "dh_xul-ext error in " + test + " test: " + \ + str(error) + if errors > 0: + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/tests/dh_xul-ext/ubuntu/debian/changelog b/tests/dh_xul-ext/ubuntu/debian/changelog new file mode 100644 index 0000000..1b45ee9 --- /dev/null +++ b/tests/dh_xul-ext/ubuntu/debian/changelog @@ -0,0 +1,5 @@ +test-package (1.0-1) UNRELEASED; urgency=low + + * Initial release. + + -- Benjamin Drung Sat, 09 Jul 2011 12:55:23 +0200 diff --git a/tests/dh_xul-ext/ubuntu/debian/compat b/tests/dh_xul-ext/ubuntu/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/tests/dh_xul-ext/ubuntu/debian/compat @@ -0,0 +1 @@ +7 diff --git a/tests/dh_xul-ext/ubuntu/debian/control b/tests/dh_xul-ext/ubuntu/debian/control new file mode 100644 index 0000000..1aea594 --- /dev/null +++ b/tests/dh_xul-ext/ubuntu/debian/control @@ -0,0 +1,18 @@ +Source: test-package +Section: web +Priority: extra +Maintainer: Ubuntu Mozilla Team +Build-Depends: debhelper (>= 7.0.50~), mozilla-devscripts (>= 0.22~) +Standards-Version: 3.9.2 + +Package: xul-ext-test-package +Architecture: all +Depends: ${misc:Depends}, ${xpi:Depends} +Recommends: ${xpi:Recommends} +Provides: ${xpi:Provides} +Enhances: ${xpi:Enhances} +Breaks: ${xpi:Breaks} +Description: mozilla-devscripts test package + This is a test package designed to test some scripts in mozilla-devscripts. + It is part of the mozilla-devscripts test suite and may do very odd things. It + should not be installed like a regular package. It may be an empty package. diff --git a/tests/dh_xul-ext/ubuntu/debian/rules b/tests/dh_xul-ext/ubuntu/debian/rules new file mode 100755 index 0000000..692843b --- /dev/null +++ b/tests/dh_xul-ext/ubuntu/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_install: + dh_install install.rdf /usr/share/xul-ext/test-package/ + DH_XUL_EXT_VENDOR=Ubuntu ../../../dh_xul-ext diff --git a/tests/dh_xul-ext/ubuntu/install.rdf b/tests/dh_xul-ext/ubuntu/install.rdf new file mode 100644 index 0000000..744c1df --- /dev/null +++ b/tests/dh_xul-ext/ubuntu/install.rdf @@ -0,0 +1,40 @@ + + + + {deadda7a-fee1-dead-coo1-d00ddeadc0de} + 1.0 + mozilla-devscripts test package + + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 3.5 + 7.0a + + + + + + {3550f703-e582-4d05-9a08-453d09bdfdc6} + 3.0 + 7.0a1 + + + + + + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 2.0 + 2.4 + + + + + + {a79fe89b-6662-4ff4-8e88-09950ad4dfde} + 0.1 + 100.* + + + + diff --git a/tests/test-moz-version b/tests/test-moz-version new file mode 100755 index 0000000..fc47ab6 --- /dev/null +++ b/tests/test-moz-version @@ -0,0 +1,105 @@ +#!/usr/bin/python + +# Copyright (c) 2010 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. + +import getopt +import os +import sys + +sys.path.insert(1, os.path.abspath(os.path.dirname(sys.argv[0]) + "/..")) +from moz_version import compare_versions + +# error codes +COMMAND_LINE_SYNTAX_ERROR = 1 +TEST_FAILED_ERROR = 2 + +TEST_PATTERN = ( + ("1.-1", "lt", "1", True), + ("1", "eq", "1.", True), + ("1", "eq", "1.0", True), + ("1", "eq", "1.0.0", True), + ("1.0.0", "lt", "1.1a", True), + ("1.1a", "lt", "1.1aa", True), + ("1.1aa", "lt", "1.1ab", True), + ("1.1ab", "lt", "1.1b", True), + ("1.1b", "lt", "1.1c", True), + ("1.1pre", "eq", "1.1pre0", True), + ("1.1pre0", "eq", "1.0+", True), + ("1.0+", "lt", "1.1pre1a", True), + ("1.1pre1a", "lt", "1.1pre1aa", True), + ("1.1pre1aa", "lt", "1.1pre1b", True), + ("1.1pre1b", "lt", "1.1pre1", True), + ("1.1pre1", "lt", "1.1pre2", True), + ("1.1pre2", "lt", "1.1pre10", True), + ("1.1pre10", "lt", "1.1.-1", True), + ("1.1.-1", "lt", "1.1", True), + ("1.1", "eq", "1.1.0", True), + ("1.1.0", "eq", "1.1.00", True), + ("1.1.00", "lt", "1.10", True), + ("1.10", "lt", "1.*", True), + ("1.*", "lt", "1.*.1", True), + ("1.*.1", "lt", "2.0", True), + ("1.*.1", "gt", "2.0", False), +) + +def fail(message): + print >> sys.stderr, "E: " + message + sys.exit(TEST_FAILED_ERROR) + +def test_compare(verbose=False): + for pattern in TEST_PATTERN: + compare_result = compare_versions(pattern[0], pattern[2], verbose) + if pattern[1] == "lt": + if (compare_result < 0) != pattern[3]: + fail('Test pattern "%s %s %s" failed (result should be %s).' % \ + pattern) + elif pattern[1] == "eq": + if (compare_result == 0) != pattern[3]: + fail('Test pattern "%s %s %s" failed (result should be %s).' % \ + pattern) + elif pattern[1] == "gt": + if (compare_result > 0) != pattern[3]: + fail('Test pattern "%s %s %s" failed (result should be %s).' % \ + pattern) + else: + fail('Unknown pattern %s.' % (pattern[1])) + +def main(): + try: + long_opts = ["verbose"] + opts = getopt.gnu_getopt(sys.argv[1:], "v", long_opts)[0] + except getopt.GetoptError, e: + # print help information and exit: + print >> sys.stderr, str(e) + sys.exit(COMMAND_LINE_SYNTAX_ERROR) + + verbose = False + + for o, _ in opts: + if o in ("-v", "--verbose"): + verbose = True + else: + assert False, "unhandled option" + + test_compare(verbose) + +if __name__ == "__main__": + main() diff --git a/xpi-pack b/xpi-pack new file mode 100755 index 0000000..555e623 --- /dev/null +++ b/xpi-pack @@ -0,0 +1,89 @@ +#!/bin/sh + +# Copyright (c) 2008 Alexander Sack, Sasa Bodiroza +# Description: Script to pack indir to xpifile +# +# 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. + +# The script searches indir for unpacked jar files, which must be located in +# ./input_dir/path/to/file.jar!/ dir. It will jar it up to +# ./input_dir/path/to/file.jar, and then remove the contents of unpacked dir. +# After that, it will zip up the contents of indir to xpi file. +# Example: xpi-pack ubufox.out ubufox-ver.xpi + +INDIR=$1; +XPIFILE=$2; + +usage() { + echo "$0 - Script to produce XPI file from input directory." + echo + echo "The output XPI file is placed in top-level of the input directory."; + echo "To place it somewhere else, provide relative or absolute path to the"; + echo "output XPI file." + echo + echo "To run it call:"; + echo "$ $0 input_directory output_xpi_file" + echo + echo " input_directory - directory with the XPI source tree"; + echo " output_xpi_file - name of the produced file"; + exit 1; +} + +if [ "$1" = "--help" -o "$1" = "-h" ] ; then + usage +fi; + +if [ -z $INDIR ] ; then + echo "Missing input directory." + echo + usage; +fi; +if [ -z $XPIFILE ] ; then + echo "Missing XPI name." + echo + usage; +fi; +if [ ! -d $INDIR ] ; then + echo "E: Input directory doesn't exist." + echo + usage; +fi; + +START_DIR=`pwd`; +PACK_JAR_PATHS=""; +cd $INDIR; +for JAR_DIR in `find . -type d -name '*.jar\!'` ; do + JAR_FILE=`echo $JAR_DIR | sed "s/jar\!$/jar/"`; + ABS_JAR_PATH=`cd $JAR_DIR ; pwd`; + ABS_JAR_FILE=`echo $ABS_JAR_PATH | sed "s/jar\!$/jar/"`; + ABS_CUR_DIR=`pwd`; + cd $ABS_JAR_PATH; + echo "Packing $JAR_FILE"; + TZ=UTC zip -q -X -r $ABS_JAR_FILE .; + cd $ABS_CUR_DIR; + PACK_JAR_PATHS="$ABS_JAR_FILE $PACK_JAR_PATHS"; + rm -rf $ABS_JAR_PATH; +done; +echo "Packing $XPIFILE"; +TZ=UTC zip -q -X -r $START_DIR/$XPIFILE * -x debian/\* temp-*/\*; +[ -f $START_DIR/$XPIFILE ] && XPIDIR=`dirname $START_DIR/$XPIFILE` +ABS_XPIDIR=`cd $XPIDIR; pwd`; +echo "Packed XPI file. It is located in $ABS_XPIDIR"; +for JAR_PATH in $PACK_JAR_PATHS ; do + echo "Unpacking and removing $JAR_PATH"; + TZ=UTC unzip -q $JAR_PATH -d $JAR_PATH!; + rm -f $JAR_PATH; +done; +cd $START_DIR; diff --git a/xpi-repack b/xpi-repack new file mode 100755 index 0000000..080b0ad --- /dev/null +++ b/xpi-repack @@ -0,0 +1,105 @@ +#!/usr/bin/python + +# Copyright (c) 2010-2014, Benjamin Drung +# +# 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 os +import subprocess +import sys +import tempfile + +COMPRESSION_FORMATS = ["bz2", "gz", "xz"] +SCRIPT_NAME = "xpi-repack" + + +def remove_recursive(path): + """equivalent to rm -rf path""" + if os.path.exists(path): + for i in os.listdir(path): + full_path = os.path.join(path, i) + if os.path.isdir(full_path): + remove_recursive(full_path) + else: + os.remove(full_path) + os.rmdir(path) + + +def repack_xpi(package, upstream_version, xpi_file, extension, verbose): + # extract xpi file + tmp_dir = tempfile.mkdtemp(prefix=SCRIPT_NAME+".") + try: + extract_dir = package + "-" + upstream_version + full_extract_dir = os.path.join(tmp_dir, extract_dir) + subprocess.check_call(["xpi-unpack", xpi_file, full_extract_dir]) + + if not extension: + # check, if source 3.0 (quilt) format is used + extension = "gz" + if os.path.isfile("debian/source/format"): + source_format = open("debian/source/format").readline().strip() + if source_format == "3.0 (quilt)": + extension = "xz" + + # pack source + directory = os.path.realpath(os.path.dirname(xpi_file)) + tar_file = package + "_" + upstream_version + ".orig.tar." + extension + full_tar_file = os.path.join(directory, tar_file) + cmd = ["tar", "-ca", "-C", tmp_dir, "-f", full_tar_file, extract_dir] + if verbose: + print " ".join(cmd) + subprocess.check_call(cmd) + finally: + # remove temporary directory + remove_recursive(tmp_dir) + + +def get_source_package_name(): + if not os.path.isfile("debian/control"): + sys.stderr.write(SCRIPT_NAME + ": Error: debian/control file is " + "missing. Please execute the script in a Debian " + "source package or provide a source package name.\n") + sys.exit(1) + lines = open("debian/control").readlines() + package_lines = [x for x in lines if x.find("Source:") >= 0] + packages = [x[x.find(":")+1:].strip() for x in package_lines] + return packages[0] + + +def main(): + epilog = "See {prog}(1) for more info.".format(prog=SCRIPT_NAME) + parser = argparse.ArgumentParser(epilog=epilog) + parser.add_argument("xpi_file", metavar="", + help=".xpi file that should be repacked") + parser.add_argument("-p", "--package", help="specify source package name") + parser.add_argument("-u", "--upstream-version", dest="version", + help="specify the upstream version") + parser.add_argument("-f", "--format", choices=COMPRESSION_FORMATS, + help="compression format for the produced tarball") + parser.add_argument("-v", "--verbose", action="store_true", + help="print more information") + + args = parser.parse_args() + + if not args.package: + args.package = get_source_package_name() + if not args.version: + parser.error("Unknown upstream version. " + "You have to specify one with --upstream-version.") + + repack_xpi(args.package, args.version, args.xpi_file, args.format, + args.verbose) + +if __name__ == "__main__": + main() diff --git a/xpi-unpack b/xpi-unpack new file mode 100755 index 0000000..b4ebf06 --- /dev/null +++ b/xpi-unpack @@ -0,0 +1,76 @@ +#!/bin/sh + +# Copyright (c) 2008 Alexander Sack, Sasa Bodiroza +# Description: Script to unpack xpifile to outdir +# +# 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. + +# The script unpacks the xpi file, then searches it for jar files. If it +# finds any it will unzip it to ./outpur_dir/path/to/file.jar!/ dir. +# Example: xpi-unpack ubufox-ver.xpi ubufox.out + +XPIFILE=$1; +OUTDIR=$2; + +usage() { + echo "$0 - Script to unpack XPI file to output directory." + echo + echo "To run it call:"; + echo "$ $0 input_xpi_file output_directory" + echo + echo " input_xpi_file - packed XPI source tree"; + echo " output_directory - location where the unpacked XPI file is placed"; + exit 1; +} + +if [ "$1" = "--help" -o "$1" = "-h" ] ; then + usage; +fi; + +if [ -z $XPIFILE ] ; then + echo "Missing XPI file." + echo + usage +fi; +if [ -z $OUTDIR ] ; then + echo "Missing output directory." + echo + usage +fi; +if [ -d $OUTDIR ] ; then + echo "E: Output directory already exists." + echo + usage +fi; + +if [ ! -f $XPIFILE ] ; then + echo "E: XPI file doesn't exist." + echo + usage +fi; + +mkdir $OUTDIR; +echo "Unpacking $XPIFILE"; + +TZ=UTC unzip -q $XPIFILE -d $OUTDIR; +cd $OUTDIR; +for JAR_PATH in `find . -name '*.jar'` ; do + echo "Unpacking $JAR_PATH"; + TZ=UTC unzip -q $JAR_PATH -d $JAR_PATH!; + rm -f $JAR_PATH; +done; +cd ..; + +echo "Unpacked xpi file."; -- cgit v1.2.3