rdrgmnzs / pulp_centos_errata_import

Imports CentOS (from http://cefs.steve-meier.de/) errata into Pulp / Katello
61 stars 22 forks source link

Pulp returns empty string when searching for package with plus symbol #4

Closed geronimodings closed 9 years ago

geronimodings commented 9 years ago

btw thanks for the script,

The issue I encountered was with a package that contains a plus character.

DEBUG: Package: memtest86+-4.20-14.el7.x86_64.rpm -> memtest86+-4.20-14.el7.x86_64.rpm -> Default_Organization-Centos7_os-os_x86_64 INFO: Creating errata for CEBA-2014:1181 (CentOS memtest86+ FASTTRACK BugFix Update) (1 of 2) Use of uninitialized value $pkgdetails[4] in concatenation (.) or string at ./errata_import.pl line 195. Use of uninitialized value in concatenation (.) or string at ./errata_import.pl line 195. Use of uninitialized value in concatenation (.) or string at ./errata_import.pl line 195. Use of uninitialized value in concatenation (.) or string at ./errata_import.pl line 195. Use of uninitialized value in concatenation (.) or string at ./errata_import.pl line 195. Use of uninitialized value in concatenation (.) or string at ./errata_import.pl line 195. Use of uninitialized value in concatenation (.) or string at ./errata_import.pl line 210. INFO: Command: erratum Description: creates a new erratum

I narrowed down the Problem to line 193

   @pkgdetails = `pulp-admin rpm repo content rpm --repo-id=$name2channel{$package} --match="filename=$package" --fields=name,version,release,epoch,arch,checksum,checksumtype | awk '{print \$2}'`;

when pulp admin tries to match a package with a plus character it returns nothing. If you escape the plus like this: memtest86\+-4.20-14.el7.x86_64.rpm it returns the right package.

my fix would looks like this

 my $temp = $package;
 $temp =~ s/\+/\\\+/g;
 @pkgdetails = `pulp-admin rpm repo content rpm --repo-id=$name2channel{$package} --match="filename=$temp" 
rdrgmnzs commented 9 years ago

Awesome thanks! I've included the fix in the script.