Page MenuHomeFreeBSD

whereis(1): Respect PORTSDIR variable
Needs ReviewPublic

Authored by fernape on Oct 11 2023, 11:12 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 24, 10:41 AM
Unknown Object (File)
Nov 22 2024, 1:20 PM
Unknown Object (File)
Nov 18 2024, 4:36 PM
Unknown Object (File)
Nov 18 2024, 4:15 PM
Unknown Object (File)
Nov 17 2024, 8:11 PM
Unknown Object (File)
Nov 14 2024, 1:56 PM
Unknown Object (File)
Nov 14 2024, 10:49 AM
Unknown Object (File)
Oct 30 2024, 3:00 PM

Details

Reviewers
None
Group Reviewers
Src Committers
Summary

Respect PORTSDIR variable for those who have the ports collection in a different
place than /usr/ports. PORTSDIR is a very common variable used in the ports
framework and in /etc/make.conf among other places.

Add note to manual page.
.Dd to be bumped at commit time.

Note that this same behavior can be achieved by doing something like:

export PORTSDIR=~/FreeBSD-repos/ports
whereis -S $PORTSDIR/** -f converseen

Assuming the shell is able to expand the **, but it is much less convenient.

Test Plan

Assuming the ports tree is in $HOME/FreeBSD-repos/ports and that there is no
/usr/ports, if we execute the following:

$ whereis converseen
converseen:

Apply the patch and run the following:

$ PORTSDIR=$HOME/FreeBSD-repos/ports ./whereis converseen
converseen: /home/fernape/FreeBSD-repos/ports/graphics/converseen

If we create the /usr/ports directory and populate some directories:

$ ls -R /usr/ports/
foo/      graphics/

/usr/ports/foo:
bar/

/usr/ports/foo/bar:

/usr/ports/graphics:
converseen/

/usr/ports/graphics/converseen:
Makefile   distinfo   pkg-descr  pkg-plist

and execute the same command we get the /usr/ports result as expected:

$ PORTSDIR=$HOME/FreeBSD-repos/ports ./whereis converseen
converseen: /usr/ports/graphics/converseen

Asking for all results gives both entries:

$ PORTSDIR=$HOME/FreeBSD-repos/ports ./whereis -a converseen
converseen: /usr/ports/graphics/converseen
/home/fernape/FreeBSD-repos/ports/graphics/converseen

Unsetting the variable works as expected:

$ ./whereis -a converseen
converseen: /usr/ports/graphics/converseen

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 53923
Build 50813: arc lint + arc unit