mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-24 14:00:17 +00:00
Fix empty field fix, to take into account that "0" is a false value
Instead, avoid populating fields with empty strings if rpm fails to get a field value, either due to not knowing the field, or due to the field not being set.
This commit is contained in:
BIN
Alien/Package/.Rpm.pm.swp
Normal file
BIN
Alien/Package/.Rpm.pm.swp
Normal file
Binary file not shown.
@@ -76,7 +76,7 @@ sub scan {
|
|||||||
POSTIN => 'postinst',
|
POSTIN => 'postinst',
|
||||||
PREUN => 'prerm',
|
PREUN => 'prerm',
|
||||||
POSTUN => 'postrm',
|
POSTUN => 'postrm',
|
||||||
LICENSE => 'copyright', # RPM Copyright tag has been deprecated in favour of License tag since rpm 4.0
|
LICENSE => 'copyright',
|
||||||
);
|
);
|
||||||
|
|
||||||
# Use --queryformat to pull out all the fields we need.
|
# Use --queryformat to pull out all the fields we need.
|
||||||
@@ -84,6 +84,7 @@ sub scan {
|
|||||||
SUMMARY DESCRIPTION PREFIXES},
|
SUMMARY DESCRIPTION PREFIXES},
|
||||||
keys(%fieldtrans)) {
|
keys(%fieldtrans)) {
|
||||||
my $value=$this->runpipe(0, "LANG=C rpm -qp --queryformat \%{$field} $file");
|
my $value=$this->runpipe(0, "LANG=C rpm -qp --queryformat \%{$field} $file");
|
||||||
|
next if $? || $value eq 'none';
|
||||||
my $key;
|
my $key;
|
||||||
if (exists $fieldtrans{$field}) {
|
if (exists $fieldtrans{$field}) {
|
||||||
$key=$fieldtrans{$field};
|
$key=$fieldtrans{$field};
|
||||||
@@ -91,7 +92,6 @@ sub scan {
|
|||||||
else {
|
else {
|
||||||
$key=lc($field);
|
$key=lc($field);
|
||||||
}
|
}
|
||||||
$value='' if $value eq '(none)';
|
|
||||||
$this->$key($value);
|
$this->$key($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ sub scan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Sanity check and sanitize fields.
|
# Sanity check and sanitize fields.
|
||||||
if (! $this->summary) {
|
unless (defined $this->summary) {
|
||||||
# Older rpms will have no summary, but will have a
|
# Older rpms will have no summary, but will have a
|
||||||
# description. We'll take the 1st line out of the
|
# description. We'll take the 1st line out of the
|
||||||
# description, and use it for the summary.
|
# description, and use it for the summary.
|
||||||
@@ -123,10 +123,10 @@ sub scan {
|
|||||||
$this->summary('Converted RPM package');
|
$this->summary('Converted RPM package');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! $this->description) {
|
unless (defined $this->description) {
|
||||||
$this->description($this->summary);
|
$this->description($this->summary);
|
||||||
}
|
}
|
||||||
if (! $this->copyright) {
|
unless (defined $this->copyright) {
|
||||||
# Older rpms have no licence tag, but have a copyright.
|
# Older rpms have no licence tag, but have a copyright.
|
||||||
$this->copyright($this->runpipe(0, "LANG=C rpm -qp --queryformat \%{COPYRIGHT} $file"));
|
$this->copyright($this->runpipe(0, "LANG=C rpm -qp --queryformat \%{COPYRIGHT} $file"));
|
||||||
|
|
||||||
@@ -135,8 +135,8 @@ sub scan {
|
|||||||
$this->copyright('unknown');
|
$this->copyright('unknown');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! $this->release || ! $this->version ||
|
if (! defined $this->release || ! defined $this->version ||
|
||||||
! $this->name) {
|
! defined $this->name) {
|
||||||
die "Error querying rpm file";
|
die "Error querying rpm file";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user