From 2f509889834d278e9424fb1120a35598b9c8b3c1 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Fri, 16 Apr 2010 23:35:45 -0700 Subject: [PATCH] RPM Copyright tag has been deprecated in favour of License tag since rpm 4.0 --- Alien/Package/Rpm.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index c03b01c..5680ab6 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -76,11 +76,12 @@ sub scan { POSTIN => 'postinst', PREUN => 'prerm', POSTUN => 'postrm', + LICENSE => 'copyright', # RPM Copyright tag has been deprecated in favour of License tag since rpm 4.0 ); # Use --queryformat to pull out all the fields we need. foreach my $field (qw{NAME VERSION RELEASE ARCH CHANGELOGTEXT - SUMMARY DESCRIPTION COPYRIGHT PREFIXES}, + SUMMARY DESCRIPTION PREFIXES}, keys(%fieldtrans)) { my $value=$this->runpipe(0, "LANG=C rpm -qp --queryformat \%{$field} $file"); my $key; @@ -122,12 +123,18 @@ sub scan { $this->summary('Converted RPM package'); } } - if (! $this->copyright) { - $this->copyright('unknown'); - } if (! $this->description) { $this->description($this->summary); } + if (! $this->copyright) { + # Older rpms have no licence tag, but have a copyright. + $this->copyright($this->runpipe(0, "LANG=C rpm -qp --queryformat \%{COPYRIGHT} $file")); + + # Fallback. + if (! $this->copyright) { + $this->copyright('unknown'); + } + } if (! $this->release || ! $this->version || ! $this->name) { die "Error querying rpm file";