devel/py-setuptools_scm: Do not run "git archive" on Ports tree
- In build environments have git installed in conjunction with a git-based Ports tree and haven't WRKDIRPREFIX set, there will be significant delays when building devel/py-setuptools_scm or ports that depend on it.
This is because the top-level directory of the git repository is determined during build via "git rev-parse --show-toplevel" which is issued inside the WRKSRC directory.
Once the top-level directory (which is PORTSDIR) has been determined, an archive is created from this point using "git archive" which is then very time-consuming due the complexity of the Ports tree.
In environments (e.g. poudriere) that have WRKDIRPREFIX set and also have git present during build, the issue doesn't appear because "git rev-parse --show-toplevel" fails silently with "not a git repo".
Remedy the issue by returning only the actual path of WRKSRC, but only if it has "setup.py" in it (= devel/py-setuptools_scm is built) or a test session is performed.
- Modernize the "do-test" target while I'm here and bump PORTREVISION due package change.
PR: 258891
Reported by: Robert Clausecker <fuz@fuz.su>
Obtained from: OpenIndiana
MFH: 2021Q4 (after 1 week)
(cherry picked from commit adc0cc3f69aeac37b9678c6d5b4d548d9c60cfae)