devel/py-pbr spends time on build (PR#264363)

From: Norikatsu Shigemura <nork_at_FreeBSD.org>
Date: Mon, 06 Jun 2022 03:36:16 UTC
Hi python developers.

When I made a new port, devel/py-jschema_to_python [PR#264362],

I noticed that I spend time during build [PR#264363].

[PR#264362] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264362
[PR#264363] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264363

So I researched this issue like following, I noticed that python run

'git --git-dir=/usr/ports/.git'.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# make
===>  License MIT accepted by the user
===>   py310-jschema_to_python-1.2.3 depends on file: 
/usr/local/sbin/pkg - found
===> Fetching all distfiles required by py310-jschema_to_python-1.2.3 
for building
(omitted)
===>  Configuring for py310-jschema_to_python-1.2.3
(RUN: /usr/local/bin/python3.10 -c import sys; import setuptools;  
__file__='setup.py'; sys.argv[0]='setup.py'; exec(compile(open(__file__, 
'rb').read().replace(b'\\r\\n', b'\\n'), __file__, 'exec')) build)
(RUN: git --git-dir=/usr/ports/.git log --decorate=full 
--format=%h%x00%s%x00%d)
(after 36 sec)
running config
===>  Building for py310-jschema_to_python-1.2.3
(RUN: git --git-dir=/usr/ports/.git log --pretty=%B HEAD)
(after 36 sec)
running build
running build_py
(omitted)
===>   py310-jschema_to_python-1.2.3 depends on file: 
/usr/local/bin/python3.10 - found
===>   Generating temporary packing list
(RUN: git --git-dir=/usr/ports/.git log --pretty=%B HEAD)
(after 36 sec)
running install
[pbr] Writing ChangeLog
[pbr] Generating ChangeLog
[pbr] ChangeLog complete (24.5s)
[pbr] Generating AUTHORS
(RUN: git --git-dir=/usr/ports/.git log --format=%aN <%aE>)
[pbr] AUTHORS complete (42.4s)
running build
running build_py
(omitted)
===> Creating unique files: Move MAN files needing SUFFIX
===> Creating unique files: Move files needing SUFFIX
====> Compressing man pages (compress-man)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Oh my god, I confirmed that py-pbr makes junk data.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ls -lh work-py310/jschema-to-python-1.2.3/AUTHORS 
work-py310/jschema-to-python-1.2.3/ChangeLog
-rw-r--r--  1 root  wheel    38K Jun  4 04:23 
work-py310/jschema-to-python-1.2.3/AUTHORS
-rw-r--r--  1 root  wheel    31M Jun  4 04:22 
work-py310/jschema-to-python-1.2.3/ChangeLog
# wc -l work-py310/jschema-to-python-1.2.3/AUTHORS 
work-py310/jschema-to-python-1.2.3/ChangeLog
     1092 work-py310/jschema-to-python-1.2.3/AUTHORS
   584940 work-py310/jschema-to-python-1.2.3/ChangeLog
   586032 total
# head -5 work-py310/jschema-to-python-1.2.3/AUTHORS 
work-py310/jschema-to-python-1.2.3/ChangeLog
==> work-py310/jschema-to-python-1.2.3/AUTHORS <==
Aaron Dalton <aaron@FreeBSD.org>
Aaron LI <aly@aaronly.me>
Adam David <adam@FreeBSD.org>
Adam Jimerson <vendion@gmail.com>
Adam Weinberger <adamw@FreeBSD.org>

==> work-py310/jschema-to-python-1.2.3/ChangeLog <==
CHANGES
=======

* devel/py-twilio: update to version 7.9.2
* net/natscli: update to version 0.0.33
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I tried to remove git repository or git command, but it's too bad.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# mv /usr/ports/.git /usr/ports/.git.IGNORE
   or
# mv /usr/local/bin/git /usr/local/bin/git.IGNORE
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# make
(omitted)
===>  Configuring for py310-jschema_to_python-1.2.3
Error parsing
Traceback (most recent call last):
   File "/usr/local/lib/python3.10/site-packages/pbr/core.py", line 111, 
in pbr
     attrs = util.cfg_to_args(path, dist.script_args)
   File "/usr/local/lib/python3.10/site-packages/pbr/util.py", line 272, 
in cfg_to_args
     pbr.hooks.setup_hook(config)
   File "/usr/local/lib/python3.10/site-packages/pbr/hooks/__init__.py", 
line 25, in setup_hook
     metadata_config.run()
   File "/usr/local/lib/python3.10/site-packages/pbr/hooks/base.py", 
line 27, in run
     self.hook()
   File "/usr/local/lib/python3.10/site-packages/pbr/hooks/metadata.py", 
line 25, in hook
     self.config['version'] = packaging.get_version(
   File "/usr/local/lib/python3.10/site-packages/pbr/packaging.py", line 
872, in get_version
     raise Exception("Versioning for this project requires either an sdist"
Exception: Versioning for this project requires either an sdist tarball, 
or access to an upstream git repository. It's also possible that there 
is a mismatch between the package name in setup.cfg and the argument 
given to pbr.version.VersionInfo. Project name jschema_to_python was 
given, but was not able to be found.
error in setup command: Error parsing 
/usr/ports/devel/py-jschema_to_python/work-py310/jschema-to-python-1.2.3/setup.cfg: 
Exception: Versioning for this project requires either an sdist tarball, 
or access to an upstream git repository. It's also possible that there 
is a mismatch between the package name in setup.cfg and the argument 
given to pbr.version.VersionInfo. Project name jschema_to_python was 
given, but was not able to be found.
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-jschema_to_python
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I think that py-pbr requires git on runtime, but...

I don't have any idea to fix this issue,  what I should fix my port or

not, so please help me.