[Bug 267215] Mk/bsd.gcc.mk: Stop checking if specific version requested is already installed

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 20 Oct 2022 01:02:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267215

            Bug ID: 267215
           Summary: Mk/bsd.gcc.mk: Stop checking if specific version
                    requested is already installed
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Only Me
          Priority: ---
         Component: Ports Framework
          Assignee: gerald@FreeBSD.org
          Reporter: yasu@freebsd.org
                CC: gerald@FreeBSD.org, ports-bugs@FreeBSD.org,
                    salvadore@freebsd.org
             Flags: maintainer-feedback?(gerald@FreeBSD.org)
                CC: gerald@FreeBSD.org

Created attachment 237472
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=237472&action=edit
Patch file

I'm not sure why it is included in the logic to determine which version of GCC
is used. But it sometimes causes unexpected result in non-cleanroom
environment.

Let me assume following situation.

* I'm user of portmaster.
* On my FreeBSD system some ports that use 'USE_GCC=yes' are installed.
* I'd like to change default version of GCC from 11 to 12.

To achieve my purpose I take following steps.

1. Add 'DEFAULT_VERSIONS+=gcc=12' to /etc/make.conf
2. Execute `portmaster "$(pkg info -r gcc11 | grep -v ':$')"`

After finishing them, it is expected that gcc12 is installed and all packages
that depended on gcc11 now depend on it. But what really happens is that gcc12
isn't installed and dependency doesn't change at all.

It is because Mk/bsd.gcc.mk checks if specific version requested is already
installed and installed gcc11 package is detected and used. But obviously it
conflicts with the result user usually expects when he sets DEFAULT_VERSIONS in
/etc/make.conf.

So change the logic so it doesn't check installed version of GCC at all.

-- 
You are receiving this mail because:
You are on the CC list for the bug.