Hello community, here is the log from the commit of package brp-extract-appdata for openSUSE:Factory checked in at 2015-02-08 11:41:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/brp-extract-appdata (Old) and /work/SRC/openSUSE:Factory/.brp-extract-appdata.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "brp-extract-appdata" Changes: -------- --- /work/SRC/openSUSE:Factory/brp-extract-appdata/brp-extract-appdata.changes 2014-03-02 18:22:04.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.brp-extract-appdata.new/brp-extract-appdata.changes 2015-02-08 11:41:56.000000000 +0100 @@ -1,0 +2,5 @@ +Mon Feb 2 14:15:07 CET 2015 - m...@suse.de + +- add workaround so that components generate valid xml + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ brp-extract-appdata.spec ++++++ --- /var/tmp/diff_new_pack.hGZ0e5/_old 2015-02-08 11:41:57.000000000 +0100 +++ /var/tmp/diff_new_pack.hGZ0e5/_new 2015-02-08 11:41:57.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package brp-extract-appdata # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 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 ++++++ brp-extract-appdata.pl ++++++ --- /var/tmp/diff_new_pack.hGZ0e5/_old 2015-02-08 11:41:57.000000000 +0100 +++ /var/tmp/diff_new_pack.hGZ0e5/_new 2015-02-08 11:41:57.000000000 +0100 @@ -123,9 +123,10 @@ my $content = slurp($appdatafile); return undef unless $content; + $content =~ s/\n?$/\n/s; # make sure file ends with a nl $appdatafile =~ s/.*appdata\///; - my $dd; - $dd = parse_desktop_data("usr/share/applications/$1") if $content =~ /<id type=\"desktop\">(.*)</m; + my $dd = {}; + $dd = parse_desktop_data("usr/share/applications/$1") if $content =~ /<id(?: type=\"desktop\")?>(.*)</m; if ($dd->{'comment'} && $content !~ /<summary/) { my $xml = " <summary>".escape($dd->{'comment'})."</summary>\n"; for (sort keys %$dd) { @@ -149,7 +150,7 @@ my $xml = " <keywords>\n"; $xml .= " <keyword>".escape($_)."</keyword>\n" for split(/\s*;\s*/, $dd->{'keywords'}); $xml .= " </keywords>\n"; - $content =~ s/^(\s*<\/application>)/$xml$1/m; + $content =~ s/^(\s*<\/(?:application|component)>)/$xml$1/m; } if ($dd->{'icon'} && $content !~ /<icon/) { my $idata = get_icon_data($dd->{'icon'}); @@ -157,14 +158,14 @@ my $xml = " <icon type='embedded'>\n <name>".escape($dd->{'icon'})."</name>\n"; $xml .= " <filecontent file='".escape($_->[0])."'>\n$_->[1] </filecontent>\n" for @$idata; $xml .= " </icon>\n"; - $content =~ s/^(\s*<\/application>)/$xml$1/m; + $content =~ s/^(\s*<\/(?:application|component)>)/$xml$1/m; } } if ($dd->{'categories'} && $content !~ /<appcategories/) { my $xml = " <appcategories>\n"; $xml .= " <appcategory>".escape($_)."</appcategory>\n" for split(/\s*;\s*/, $dd->{'categories'}); $xml .= " </appcategories>\n"; - $content =~ s/^(\s*<\/application>)/$xml$1/m; + $content =~ s/^(\s*<\/(?:application|component)>)/$xml$1/m; } return $content; } @@ -172,14 +173,20 @@ my @appdatas; find( { wanted => sub { push @appdatas, $_ if /\.appdata\.xml$/ } , no_chdir => 1}, "usr/share/appdata/"); -print OUTPUT "<?xml version='1.0'?>\n"; -print OUTPUT "<applications version='0.1'>\n"; +my $output = ''; + for my $appdata (@appdatas) { my $c = read_and_extend_appdata($appdata); next unless $c; $c =~ s/^<\?xml[^\n]*\n//s; $c =~ s/\n?$/\n/s; $c =~ s/^(\s*<)/ $1/mg; - print OUTPUT $c; + $output .= $c; } -print OUTPUT "</applications>\n"; + +my $type = 'applications'; +$type = $1 if $output =~ /(application|component)/s; +print OUTPUT "<?xml version='1.0'?>\n"; +print OUTPUT "<$1s version='0.1'>\n"; # hmm? +print OUTPUT $output; +print OUTPUT "</$1s>\n"; ++++++ create-appdata-xml.pl ++++++ --- /var/tmp/diff_new_pack.hGZ0e5/_old 2015-02-08 11:41:57.000000000 +0100 +++ /var/tmp/diff_new_pack.hGZ0e5/_new 2015-02-08 11:41:57.000000000 +0100 @@ -37,13 +37,17 @@ unlink $appdata; # remove start and end tags -$content =~ s/.*\n<applications[^\n]*>\n//s; -$content =~ s/<\/applications>\n$//s; +$content =~ s/.*\n<(?:applications|components)[^\n]*>\n//s; +$content =~ s/<\/(?:applications|components)>\n$//s; # split into application chunks -my @appdatas = split(/<application/, $content); +my @appdatas = split(/<(?:application|component)/, $content); for (@appdatas) { - $_ = " <application$_"; + if (/<\/component/) { + $_ = " <component$_"; + } else { + $_ = " <application$_"; + } s/ *$//s; } @@ -79,8 +83,10 @@ my $output = "$build_root$TOPDIR/OTHER/$rpmname-appdata.xml"; open(APPDATA, '>', $output) || die "can't write to $output"; print APPDATA "<?xml version='1.0'?>\n"; - print APPDATA "<applications version='0.1'>\n"; + my $type = 'application'; + $type = $1 if ($appresults{$rpmname}->[0] || '') =~ /(application|component)/; + print APPDATA "<${type}s version='0.1'>\n"; print APPDATA $_ for @{$appresults{$rpmname}}; - print APPDATA "</applications>\n"; + print APPDATA "</${type}s>\n"; close APPDATA; } -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org