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
This commit is contained in:
Wolfgang Rosenauer 2013-06-11 04:51:52 +00:00 committed by Git OBS Bridge
commit dadda7508a
6 changed files with 162 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

26
macros.mozaddon Normal file
View File

@ -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[<em:maxVersion>.*?</em:maxVersion>][<em:maxVersion>*</em:maxVersion>]' '{}' '+'; \
%nil

4
mozaddon-devel.changes Normal file
View File

@ -0,0 +1,4 @@
-------------------------------------------------------------------
Mon Apr 1 20:36:52 UTC 2013 - jengelh@inai.de
- Initial package (version 0) for build.opensuse.org

53
mozaddon-devel.spec Normal file
View File

@ -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

55
mozaddondev-getappid Normal file
View File

@ -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;
}