Hello community,

here is the log from the commit of package brp-extract-appdata for 
openSUSE:Factory checked in at 2012-03-02 13:46:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-02-22 16:07:43.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.brp-extract-appdata.new/brp-extract-appdata.changes 
    2012-03-02 13:47:02.000000000 +0100
@@ -1,0 +2,5 @@
+Thu Mar  1 11:15:36 UTC 2012 - co...@suse.com
+
+- make the brp script a perl script too and let it find icons
+
+-------------------------------------------------------------------

Old:
----
  brp-extract-appdata.sh

New:
----
  brp-extract-appdata.pl

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ brp-extract-appdata.spec ++++++
--- /var/tmp/diff_new_pack.ZGwhBi/_old  2012-03-02 13:47:04.000000000 +0100
+++ /var/tmp/diff_new_pack.ZGwhBi/_new  2012-03-02 13:47:04.000000000 +0100
@@ -23,7 +23,7 @@
 License:        MIT
 Group:          Development/Tools/Building
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Source0:        %{name}.sh
+Source0:        %{name}.pl
 Source1:        create-appdata-xml.pl
 BuildArch:      noarch
 

++++++ brp-extract-appdata.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.

#
# find files and extract them for later processing
#
use File::Basename;
use File::Find;
use MIME::Base64;

my $basedir=dirname($ENV{'RPM_SOURCE_DIR'}) . "/OTHER";

my $outputfile = "$basedir/$ENV{'RPM_PACKAGE_NAME'}.applications";

if (! -f "/.buildenv") {
  # this looks fishy, skip it
  print "WARNING: I better not trim without a /.buildenv around\n";
  exit(0);
}

if (! -w "$basedir") {
  print "WARNING: Can't write to $BASEDIR, skipping\n";
  exit(0);
}

open(OUTPUT, '>', $outputfile);

chdir("/" . $ENV{'RPM_BUILD_ROOT'});

my @icondirs;

for my $prefix (qw{/usr /opt/kde3 usr opt/kde3}) {
   for my $suffix (qw{pixmaps icons/hicolor icons/crystalsvg icons/gnome}) {
      push(@icondirs, "$prefix/share/$suffix");
   }
}
find(\&wanted, "usr/share/applications/");

my @icons;

sub wanted
{
  return unless $_ =~ /\.desktop$/;
  print OUTPUT "<</$File::Find::name>>\n";
  open(DESKTOP, $_) or return;
  while ( <DESKTOP> ) {
    if ($_ =~ /^Icon=(.*)$/) { push(@icons, $1); }
    print OUTPUT $_;
  }
  close(DESKTOP);
}

our $icon;

sub outputicon
{
  return unless ($_ =~ /^$icon\.(png|svg|svgz|xpm)$/);
  open(my $icon, '<', $_) or return;
  my $content = do { local $/; <$icon> };
  close($icon);
  my $fname = $File::Find::name;
  $fname = "/$fname" unless $fname =~ m,^/,;
  print OUTPUT "<<$fname>>\n";
  print OUTPUT encode_base64($content) . "\n";
}

for $icon (@icons) {
  find(\&outputicon, @icondirs);
}

close(OUTPUT);
++++++ create-appdata-xml.pl ++++++
--- /var/tmp/diff_new_pack.ZGwhBi/_old  2012-03-02 13:47:04.000000000 +0100
+++ /var/tmp/diff_new_pack.ZGwhBi/_new  2012-03-02 13:47:04.000000000 +0100
@@ -35,6 +35,7 @@
 my $currentfile = '';
 my $indesktopentry = 0;
 my %apphash;
+my %fullfiles;
 
 while ( <APPDATA> ) {
   chomp;
@@ -49,7 +50,10 @@
      print "ERROR: haven't seen a file before $_\n";
      exit 0;
   }
-
+  
+  my $content = $fullfiles{$currentfile} || '';
+  $fullfiles{$currentfile} = $content . $_;
+ 
   if (m/^\[Desktop Entry\]\s*$/) {
      if ($indesktopentry) {
        print "ERROR: 2 desktop entries? I'm out\n";
@@ -81,6 +85,7 @@
     open (URL, "chroot $build_root rpm -qp --qf '%{URL}' $rpm|");
     chomp(my $url = <URL>);
     close URL; 
+    $url = undef if $url eq '(none)';
     # ignore empty rpm as rpmlint will catch them
     @files = grep {!/^\(none\)/} @files;
     for my $file (@files) {
@@ -104,7 +109,8 @@
 
     my $applications_output = 0;
 
-    while (my ($file, $hash) = each(%apphash)) {
+    for my $file (sort keys %apphash) {
+        my $hash = $apphash{$file};
        next if (($hash->{nodisplay} || '') =~ m,true,i);
        next if ($hash->{pkgname} ne $rpmname);
        $applications_output++;
@@ -126,7 +132,16 @@
            print APPDATA "    </keywords>\n";
        }
        if ($hash->{icon}) {
-           print APPDATA "    <icon type='local'>" . _e($hash->{icon}) . 
"</icon>\n";
+           print APPDATA "    <icon type='embedded'>\n";
+            print APPDATA "      <name>" . _e($hash->{icon}) . "</name>\n";
+            for my $ifile (sort keys %fullfiles) {
+               if ($ifile =~ m,$hash->{icon}\.(png|svg|svgz|xpm)$,) {
+                   print APPDATA "      <filecontent file='$ifile'>\n";
+                   print APPDATA $fullfiles{$ifile};
+                   print APPDATA "      </filecontent>\n";
+                }
+            }
+            print APPDATA "    </icon>\n";
        }
        print APPDATA "    <appcategories>\n";
        for my $keyword (split(/\s*;\s*/, $hash->{categories})) {

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to