Bug 1886728

Summary: Wrong devtoolset prefix is selected when multiple devtoolset packages is installed
Product: Red Hat Software Collections Reporter: gnaggnoyil
Component: scl-utilsAssignee: Joe Orton <jorton>
Status: CLOSED NOTABUG QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: jorton, kanderso
Target Milestone: alpha   
Target Release: 3.6   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-09 10:08:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description gnaggnoyil 2020-10-09 08:57:40 UTC
### Environment

```
$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
$ uname -a
Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ yum list | grep scl-utils
scl-utils.x86_64                           20130529-19.el7        @anaconda
scl-utils-build.x86_64                     20130529-19.el7        @base
scl-utils-debuginfo.x86_64                 20130529-19.el7        base-debuginfo
```

### Steps to reproduce

1. `yum install centos-release-scl`
2. `yum-config-manager --enable rhel-server-rhscl-7-rpms`
3. `yum install devtoolset-8`
4. `yum install devtoolset-9-build`
5. `curl -L http://vault.centos.org/centos/7/sclo/Source/rh/devtoolset-8-gcc-8.3.1-3.2.el7.src.rpm -O`
6. `yum-builddep devtoolset-8-gcc-8.3.1-3.2.el7.src.rpm`
7. `mkdir -p ~/rpmbuild/SOURCES`
8. `cd ~/rpmbuild/SOURCES && rpm2cpio ~/devtoolset-8-gcc-8.3.1-3.2.el7.src.rpm | cpio -idmv`
9. `cd ~/rpmbuild/SOURCES && rpmbuild -ba --nocheck --noclean gcc.spec`
10. `ls ~/rpmbuild/RPMS/x86_64 | grep 'devtoolset-9-'`

### Expected behavior

Step 10 will not produce any outputs, as there are no packages prefixed with "devtoolset-9-" exists

### Actual behavior

Step 10 produced outputs with filename like "devtoolset-9-gcc-8.3.1-3.2.el7.x86_64.rpm"

### Additional info

Running command `rpmbuild --showrc | grep devtoolset-` after step 3 and before step 4 gives the following output:

```
$ rpmbuild --showrc | grep devtoolset-
-14: enable_devtoolset8 %global ___build_pre %{___build_pre}; source scl_source enable devtoolset-8 || :
-14: scl        devtoolset-8
```

Running the same command after step 4 then gives the following output:

```
$ rpmbuild --showrc | grep devtoolset-
-14: enable_devtoolset8 %global ___build_pre %{___build_pre}; source scl_source enable devtoolset-8 || :
-14: enable_devtoolset9 %global ___build_pre %{___build_pre}; source scl_source enable devtoolset-9 || :
-14: scl        devtoolset-9
```

Comment 2 Joe Orton 2020-10-09 10:08:41 UTC
Please note that we don't support CentOS.  The -build package installed dictates the SCL prefix as indicated:

-14: scl        devtoolset-9