Hello community,

here is the log from the commit of package mozaddon-devel for openSUSE:Factory 
checked in at 2015-08-05 19:17:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mozaddon-devel (Old)
 and      /work/SRC/openSUSE:Factory/.mozaddon-devel.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mozaddon-devel"

Changes:
--------
--- /work/SRC/openSUSE:Factory/mozaddon-devel/mozaddon-devel.changes    
2014-01-02 18:30:30.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.mozaddon-devel.new/mozaddon-devel.changes       
2015-08-05 19:17:55.000000000 +0200
@@ -1,0 +2,6 @@
+Wed Aug  5 09:41:47 UTC 2015 - [email protected]
+
+- Recognize <Description> XML tags with arbitrary namespace
+  prefixes
+
+-------------------------------------------------------------------

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

Other differences:
------------------
++++++ mozaddon-devel.spec ++++++
--- /var/tmp/diff_new_pack.aJOQh7/_old  2015-08-05 19:17:55.000000000 +0200
+++ /var/tmp/diff_new_pack.aJOQh7/_new  2015-08-05 19:17:55.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package mozaddon-devel
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           mozaddon-devel
-Version:        0
+Version:        1
 Release:        0
 Summary:        RPM macros for building Mozilla extensions under openSUSE
 License:        SUSE-Public-Domain

++++++ mozaddondev-getappid ++++++
--- /var/tmp/diff_new_pack.aJOQh7/_old  2015-08-05 19:17:56.000000000 +0200
+++ /var/tmp/diff_new_pack.aJOQh7/_new  2015-08-05 19:17:56.000000000 +0200
@@ -3,53 +3,82 @@
 # authored by Jan Engelhardt, 2011-03-24
 # released into the Public Domain
 #
+use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
 use XML::Simple;
+&main();
 
-my $file = shift || die "Usage: $0 [install.rdf|somefile.xpi]\n";
-my $xml;
+sub get_rdf
+{
+       my $file = shift @_;
 
-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 {
+       if ($file eq "install.rdf") {
+               return XMLin($file);
+       }
+       if (substr($file, -4, 4) eq ".xpi") {
+               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;
+               return XMLin($data);
+       }
        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} ];
+sub get_desc
+{
+       my $xml = shift @_;
+       my $desc;
+       foreach my $tag (keys %$xml) {
+               if ($tag !~ m{^(\w+:)?Description$}) {
+                       next;
                }
+               if (ref($xml->{$tag}) eq "ARRAY") {
+                       return $xml->{$tag};
+               }
+               return [$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"};
+sub get_id
+{
+       my $desc = shift @_;
+       my $id;
+
+       foreach (qw(id em:id)) {
+               if (exists($desc->{$_})) {
+                       $id = $desc->{$_};
+                       last;
+               }
        }
+       return $id;
 }
 
-if (defined $id) {
+sub main
+{
+       my $file = shift @ARGV;
+       if (!defined($file)) {
+               print "Usage: $0 {install.rdf|something.xpi}\n";
+               exit 1;
+       }
+       my $xml = get_rdf($file);
+       if (!defined($xml)) {
+               die "xml: $!\n";
+       }
+       my $desc_list = &get_desc($xml);
+       my $id;
+       foreach my $one_desc (@$desc_list) {
+               my $value = &get_id($one_desc);
+               if ($value =~ /\@|{[[:xdigit:]]+-/) {
+                       if (defined($id)) {
+                               print STDERR "Warning: multiple IDs/UUIDs!\n";
+                       }
+                       $id = $value;
+               }
+       }
+       if (!defined($id)) {
+               exit 1;
+       }
        print "$id\n";
-} elsif (defined $uuid) {
-       print "$uuid\n";
-} else {
-       exit 1;
 }


Reply via email to