Skip to content

Commit

Permalink
Fix failing to install packages with -noarch in name
Browse files Browse the repository at this point in the history
We're missing a `\.` at the beginning, since `.join()` only puts `|\.`
in between items:

```
>> ARCH_REGEX = Regexp.new(ARCH_LIST.join('|\.'))
=> /noarch|\.i386|\.i686|\.ppc|\.ppc64|\.armv3l|\.armv4b|\.armv4l|\.armv4tl|\.armv5tel|\.armv5tejl|\.armv6l|\.armv7l|\.m68kmint|\.s390|\.s390x|\.ia64|\.x86_64|\.sh3|\.sh4/
```

Currently puppet is failing to install package with `-noarch` string in
its name because of the invalid ARCH_REGEX:

```
package { 'package-name-noarch':
  ensure => '1.0.0.el8'
}
```

```
Debug: Executing: '/bin/dnf -d 0 -e 1 -y install package-name--1.0.0.el8noarch'
Error: Could not update: Execution of '/bin/dnf -d 0 -e 1 -y install package-name--1.0.0.el8noarch' returned 1: Error: Unable to find a match: package-name--1.0.0.el7noarch
```
  • Loading branch information
anhpt379 committed Jul 10, 2023
1 parent 37d460c commit ca36fc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/util/rpm_compare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Puppet::Util::RpmCompare
armv5tejl armv6l armv7l m68kmint s390 s390x ia64 x86_64 sh3 sh4
).freeze

ARCH_REGEX = Regexp.new(ARCH_LIST.join('|\.'))
ARCH_REGEX = Regexp.new('\.' + ARCH_LIST.join('|\.'))

# This is an attempt at implementing RPM's
# lib/rpmvercmp.c rpmvercmp(a, b) in Ruby.
Expand Down

0 comments on commit ca36fc6

Please sign in to comment.