[Bug 266942] bsd.port.mk: Use .MAKE.UID instead of calling id(1)

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 10 Oct 2022 14:57:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266942

            Bug ID: 266942
           Summary: bsd.port.mk: Use .MAKE.UID instead of calling id(1)
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Ports Framework
          Assignee: portmgr@FreeBSD.org
          Reporter: naddy@FreeBSD.org
                CC: ports-bugs@FreeBSD.org

Created attachment 237190
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=237190&action=edit
bsd.port.mk.patch

Assigning the output of a shell command to a make variable is expensive since
the command is spawned every time the makefile is parsed.

In bsd.port.mk, we can save an invocation of id(1) by using the built-in
.MAKE.UID variable instead.  Since older versions of bmake (12.x) don't have
.MAKE.UID yet, we need to check with defined() first.  See the attached patch.

That said, this change does not result in any measurable speedup for "make
index".

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