From dadda7508a1040d0216bc37b66cfb5fc92dcf95c9aa554746d0f18f795688cf6 Mon Sep 17 00:00:00 2001 From: Wolfgang Rosenauer Date: Tue, 11 Jun 2013 04:51:52 +0000 Subject: [PATCH] Accepting request 178209 from home:jengelh:dev This is how I thought of addons/extensions.. OBS-URL: https://build.opensuse.org/request/show/178209 OBS-URL: https://build.opensuse.org/package/show/mozilla:addons/mozaddon-devel?expand=0&rev=1 --- .gitattributes | 23 ++++++++++++++++++ .gitignore | 1 + macros.mozaddon | 26 ++++++++++++++++++++ mozaddon-devel.changes | 4 +++ mozaddon-devel.spec | 53 ++++++++++++++++++++++++++++++++++++++++ mozaddondev-getappid | 55 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 162 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 macros.mozaddon create mode 100644 mozaddon-devel.changes create mode 100644 mozaddon-devel.spec create mode 100644 mozaddondev-getappid diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/macros.mozaddon b/macros.mozaddon new file mode 100644 index 0000000..9ff8a89 --- /dev/null +++ b/macros.mozaddon @@ -0,0 +1,26 @@ +%mozilla_mozillapath %%_libdir/mozilla +%mozilla_pluginsdir %%_libdir/browser-plugins +%mozilla_firefox_appid \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\} +%mozilla_thunderbird_appid \{3550f703-e582-4d05-9a08-453d09bdfdc6\} +%mozilla_seamonkey_appid \{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a\} +%mozilla_sunbird_appid songbird@songbirdnest.com +%mozilla_moduledir %(if [ "%_target_cpu" = "noarch" ]; then echo "%_datadir/mozilla"; else echo "%_libdir/mozilla"; fi) +%mozilla_addondir %mozilla_moduledir/extensions + +%mozilla_addon_install() \ + extid="$(mozaddondev-getappid '%1')"; \ + extdir="%buildroot%mozilla_addondir/global/$extid"; \ + mkdir -p "$extdir"; \ + %__unzip -q -d "$extdir" "%1"; \ + for i in "%mozilla_firefox_appid" "%mozilla_thunderbird_appid" "%mozilla_seamonkey_appid" "%mozilla_sunbird_appid"; do \ + extdir="%buildroot%mozilla_addondir/$i"; \ + mkdir -p "$extdir"; \ + ln -s "%mozilla_addondir/global/$extid" "$extdir/"; \ + done; \ + find "%buildroot%mozilla_addondir" -type d -exec chmod a+rx "{}" "+"; \ + find "%buildroot%mozilla_addondir" -type f -exec chmod a+r "{}" "+"; \ + %nil + +%mozilla_unlock_addons() \ + find "%buildroot%mozilla_addondir/global" -type f -name install.rdf -exec perl -i -pe 's[.*?][*]' '{}' '+'; \ + %nil diff --git a/mozaddon-devel.changes b/mozaddon-devel.changes new file mode 100644 index 0000000..941c880 --- /dev/null +++ b/mozaddon-devel.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Mon Apr 1 20:36:52 UTC 2013 - jengelh@inai.de + +- Initial package (version 0) for build.opensuse.org diff --git a/mozaddon-devel.spec b/mozaddon-devel.spec new file mode 100644 index 0000000..167f942 --- /dev/null +++ b/mozaddon-devel.spec @@ -0,0 +1,53 @@ +# +# spec file for package mozaddon-devel +# +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: mozaddon-devel +Version: 0 +Release: 0 +Summary: RPM macros for building Mozilla extensions under openSUSE +License: SUSE-Public-Domain +Group: Development/Tools/Other + +Source2: mozaddondev-getappid +Source3: macros.mozaddon +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildArch: noarch +Requires: unzip +Requires: perl(Archive::Zip) +Requires: perl(XML::Simple) + +%description +Development files for Mozilla programs to make packaging of addons +easier. + +%prep + +%build + +%install +b="%buildroot"; +mkdir -p "$b/%_bindir" "$b/%_sysconfdir/rpm"; +install -pm0755 "%{S:2}" "$b/%_bindir/"; +install -pm0644 "%{S:3}" "$b/%_sysconfdir/rpm/"; + +%files +%defattr(-,root,root) +%config %_sysconfdir/rpm/ +%_bindir/moz* + +%changelog diff --git a/mozaddondev-getappid b/mozaddondev-getappid new file mode 100644 index 0000000..052bb07 --- /dev/null +++ b/mozaddondev-getappid @@ -0,0 +1,55 @@ +#!/usr/bin/perl -w +# +# authored by Jan Engelhardt, 2011-03-24 +# released into the Public Domain +# +use XML::Simple; + +my $file = shift || die "Usage: $0 [install.rdf|somefile.xpi]\n"; +my $xml; + +if ($file =~ /\.xpi$/) { + use Archive::Zip qw/:ERROR_CODES :CONSTANTS/; + my $zip = Archive::Zip->new(); + if ( $zip->read($file) != AZ_OK ) { + die "zip file read error\n"; + } + my $data = $zip->contents("install.rdf"); + die "missing install.rdf in $file\n" unless $data; + $xml = XMLin($data) || die "$!\n"; +} elsif ($file =~ /install.rdf/) { + $xml = XMLin($file) || die "$!\n"; +} else { + die "unsupported file format\n"; +} + +my $desc; +for my $tag (qw/RDF:Description Description/) { + if (exists $xml->{$tag}) { + if (ref $xml->{$tag} eq 'ARRAY') { + $desc = $xml->{$tag}; + } else { + $desc = [ $xml->{$tag} ]; + } + } +} + +my $uuid; +my $id; +for my $x (@$desc) { + if ($x->{"em:id"} =~ /{[[:xdigit:]]+-/) { + print STDERR "Warning: multiple uuids!\n" if defined $uuid; + $uuid = $x->{"em:id"}; + } elsif ($x->{"em:id"} =~ /@/) { + print STDERR "Warning: multiple ids!\n" if defined $id; + $id = $x->{"em:id"}; + } +} + +if (defined $id) { + print "$id\n"; +} elsif (defined $uuid) { + print "$uuid\n"; +} else { + exit 1; +}