Hello community,
here is the log from the commit of package brp-extract-appdata for openSUSE:Factory checked in at 2012-03-07 13:41:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/brp-extract-appdata (Old)
and /work/SRC/openSUSE:Factory/.brp-extract-appdata.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "brp-extract-appdata", Maintainer is ""
Changes:
--------
--- /work/SRC/openSUSE:Factory/brp-extract-appdata/brp-extract-appdata.changes 2012-03-02 13:47:02.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.brp-extract-appdata.new/brp-extract-appdata.changes 2012-03-07 13:41:34.000000000 +0100
@@ -1,0 +2,5 @@
+Wed Mar 7 09:25:17 UTC 2012 - coolo@suse.com
+
+- adding extract-icons.pl script to be called for kiwi products
+
+-------------------------------------------------------------------
New:
----
extract-icons.pl
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ brp-extract-appdata.spec ++++++
--- /var/tmp/diff_new_pack.AYyetE/_old 2012-03-07 13:41:39.000000000 +0100
+++ /var/tmp/diff_new_pack.AYyetE/_new 2012-03-07 13:41:39.000000000 +0100
@@ -25,11 +25,20 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: %{name}.pl
Source1: create-appdata-xml.pl
+Source2: extract-icons.pl
BuildArch: noarch
%description
Extract appdata.xml from all .deskop files found in build root
+%package -n extract-appdata-icons
+Summary: A little perl script to split appdata.xml
+Group: Development/Tools/Building
+
+%description -n extract-appdata-icons
+OBS generated appdata.xml contains all icons and this little tool splits
+the XML into the format expected from software center
+
%prep
%build
@@ -37,10 +46,15 @@
%install
install -m0755 -D %SOURCE0 $RPM_BUILD_ROOT%_rpmconfigdir/brp-suse.d/brp-72-extract-appdata
install -m0755 -D %SOURCE1 $RPM_BUILD_ROOT/usr/lib/build/checks/72-translate-appdata
+install -m0755 -D %SOURCE2 $RPM_BUILD_ROOT/usr/bin/extract-appdata-icons
%files
%defattr(-,root,root)
%_rpmconfigdir/brp-suse.d
/usr/lib/build
+%files -n extract-appdata-icons
+%defattr(-,root,root)
+/usr/bin/extract-appdata-icons
+
%changelog
++++++ extract-icons.pl ++++++
#! /usr/bin/perl
# Copyright (c) 2012 Stephan Kulow, SUSE Linux Products GmbH
# 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.
use strict;
use XML::Simple;
use Data::Dumper;
use File::Temp;
use MIME::Base64;
use Cwd;
use File::Path;
my %ids;
sub find_perfect_match($)
{
my ($ref) = @_;
my @candidates = sort @$ref;
if (@candidates == 1) {
return $candidates[0];
}
foreach my $size (qw(32 48 64 24 )) {
my @sized_icons;
my $pattern = "/$size" . "x$size/";
for my $can (@candidates) {
push(@sized_icons,$can) if ($can =~ m/($pattern)/);
}
return $sized_icons[0] if (@sized_icons == 1);
if (@sized_icons) {
for my $can (@sized_icons) {
return $can if ($can =~ m,/hicolor/,);
}
print "UNKNOWN $size " . join(' , ', @sized_icons) . "\n";
return $sized_icons[0];
}
}
print "UNKNOWN " . join(' , ', @candidates) . "\n";
return $candidates[0];
}
sub extract_icon($$)
{
my ($ref, $tmpdir) = @_;
my $name = 'fancy';
my $name = shift @{$ref->{name}};
return $name unless ($ref->{filecontent});
my %files;
my @fcontent = @{$ref->{filecontent}};
foreach my $icon (@fcontent) {
$files{$icon->{file}} = $icon->{content};
}
my @candidates = keys %files;
my $best = find_perfect_match(\@candidates);
my $suffix = $best;
$suffix =~ s,^.*\.([^.]*)$,$1,;
open(ICON, ">", "$tmpdir/$name.$suffix");
print ICON decode_base64($files{$best});
close(ICON);
#print "$name $best\n";
return $name;
}
if (@ARGV != 2 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
print "Usage: $0