Skip to content

Commit 2336aae

Browse files
bhouse-nexthopmshych
authored andcommitted
contrib: git-stats: drop vendored python2 gitdm, auto-install a python3 gitdm
The git-stats tooling vendored a full copy of gitdm (git.lwn.net) under contrib/git-stats/gitdm. That copy is python2 and effectively unmaintained, so it does not survive the python2-to-3 port. Rather than carry (and port/maintain) a copy of gitdm in this tree, remove the vendored gitdm and have onie-git-stats obtain a python3 port of gitdm on demand: - On first run, onie-git-stats clones a pinned python3 gitdm (OSSystems/gitdm, which is a straight python3 port of Corbet's gitdm) into a local, git-ignored cache directory (contrib/git-stats/.gitdm) and reuses it thereafter. The source and revision are pinned and overridable via GITDM_REPO / GITDM_REF. - A user who already has a python3-capable gitdm can set GITDM to point at it; onie-git-stats then uses it directly and skips the clone entirely. - gitdm is now invoked with python3 (was python2), and the pinned upstream's harmless SyntaxWarnings are silenced. The ONIE-specific gitdm configuration (gitdm-config/) and the onie-git-stats wrapper are kept; only the vendored gitdm engine is removed. README.md documents the auto-install, the pinning/override knobs, and how to use a pre-existing gitdm. Signed-off-by: Brad House <bhouse@nexthop.ai> Signed-off-by: Michael Shych <michaelsh@nvidia.com>
1 parent f067a33 commit 2336aae

41 files changed

Lines changed: 91 additions & 4155 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

contrib/git-stats/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto-installed python3 gitdm cache (see onie-git-stats).
2+
/.gitdm/

contrib/git-stats/README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,51 @@ statistics, based on gitdm by Jonathan Corbet <corbet@lwn.net>.
55

66
Original source: `git://git.lwn.net/gitdm.git`
77

8+
# gitdm
9+
10+
gitdm itself is **no longer vendored in this tree**. The upstream
11+
gitdm is python2 and is effectively unmaintained; rather than carry a
12+
copy here, `onie-git-stats` obtains a python3 port of gitdm on demand.
13+
14+
By default the script auto-installs a pinned python3 gitdm the first
15+
time it is run, so in the common case you can just run it as-is (see
16+
[Running](#running) below). This requires `git` and `python3` on your
17+
`PATH`.
18+
19+
## Where gitdm comes from
20+
21+
On first run, `onie-git-stats` clones a python3 port of gitdm into a
22+
local, git-ignored cache directory next to the script
23+
(`contrib/git-stats/.gitdm/`) and reuses it on subsequent runs. The
24+
source and revision are pinned and can be overridden with environment
25+
variables:
26+
27+
| Variable | Default | Meaning |
28+
| ------------ | ------------------------------------------ | --------------------------------------- |
29+
| `GITDM_REPO` | `https://github.com/OSSystems/gitdm.git` | git URL to clone gitdm from |
30+
| `GITDM_REF` | `b7b1f8e7d567fc41dcfc249de5e967a6a30aa9b5` | commit/tag/branch of gitdm to check out |
31+
32+
To refresh the cache (e.g. after changing `GITDM_REF`), delete the
33+
cache directory and re-run:
34+
35+
```
36+
$ rm -rf contrib/git-stats/.gitdm
37+
```
38+
39+
## Using a pre-existing gitdm (skip the auto-install)
40+
41+
If you already have a python3-capable gitdm installed, set the `GITDM`
42+
environment variable to point at its `gitdm` executable. When `GITDM`
43+
is set, `onie-git-stats` uses it directly and does **not** clone or
44+
install anything:
45+
46+
```
47+
$ GITDM=/path/to/your/gitdm ./onie-git-stats 2024.05..HEAD quarterly
48+
```
49+
50+
Note that gitdm must be a python3 port -- `onie-git-stats` invokes it
51+
with `python3`.
52+
853
# Running
954

1055
The script takes two arguments.
@@ -52,4 +97,5 @@ changes are controlled by the gitdm configuration files in the
5297

5398
The most common changes are mapping an email domain name to a
5499
corporate name for the report. This is controlled by the `domain-map`
55-
file. See `gitdm/README` for complete configuration details.
100+
file. See the documentation of the gitdm the script installs (or that
101+
`GITDM_REPO` points at) for complete configuration details.

contrib/git-stats/gitdm/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

contrib/git-stats/gitdm/COPYING

Lines changed: 0 additions & 2 deletions
This file was deleted.

contrib/git-stats/gitdm/ConfigFile.py

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)