Hi Michael,

Sorry this sat for six months. I've picked it up and prepared the patch for
upload; a merge request against the team repository is here:

  
https://salsa.debian.org/python-team/packages/python-cpuinfo/-/merge_requests/2

One thing worth recording for whoever looks at this next: the patch as
attached does not apply to the packaging tree as-is. It was generated against
a tree that already had 0001-python-cpuinfo-hppa-v2.patch applied, so the two
hunks touching the arch list in _check_arch() and the exception message
conflict with the hppa patch. Ordering it after that patch in
debian/patches/series is enough - no changes to the diff itself were needed.

I made three cosmetic changes while rebasing, nothing functional: aligned the
new 'ALPHA' list entry with the surrounding tab indentation, dropped a stray
blank line before "# Various fields", and removed two trailing semicolons on
the hz_actual lines.

With the full stack applied the upstream test suite still passes here: 166
passed, 1 skipped - though that only shows the change doesn't regress other
architectures, since none of those tests exercise the new code.

To check the Alpha paths themselves I mocked DataSource against a
reconstructed Alpha /proc/cpuinfo (built from show_cpuinfo() in
arch/alpha/kernel/setup.c - I have no Alpha hardware here). Before and after,
same input:

                      unpatched                  patched
  _parse_arch()       (None, None)               ('ALPHA', 64)
  _check_arch()       raises                     no exception
  brand_raw           'Alpha'                    'EV6'
  hz_actual           None                       (466337464, 0) = 466.3375 MHz
  hardware_raw        None                       'AlphaServer ES40 6/667'

So the mechanism does what it says, and the " est." suffix on the cycle
frequency line parses fine. The 'cpu model' and 'platform string' overrides
both trigger. What I can't confirm is that my reconstructed fixture matches
what a real machine prints, which brings me to the first ask below.

Two things I could use your help with.

First, a test fixture. Upstream keeps one test file per architecture
(tests/test_linux_aarch64_64.py, tests/test_linux_fedora_5_s390x.py and so
on), and there's no Alpha equivalent yet. Could you send the output of

  cat /proc/cpuinfo

from the machine you tested on, plus

  python3 -c "import cpuinfo, json; print(json.dumps(cpuinfo.get_cpu_info(), 
indent=2))"

with the patch applied? That would let me write tests/test_linux_alpha.py in
the same shape as the others. The Hz handling in particular deserves a test,
since Alpha is the only architecture reporting "cycle frequency [Hz]" in Hz
rather than MHz and the scale factor change touches every other arch's code
path.

Second, has this been sent upstream? The patch is currently marked
Forwarded: no. Upstream is https://github.com/workhorsy/py-cpuinfo and a
pull request there would spare Debian carrying this indefinitely. Happy to
open it myself with you as the author if you'd rather not.

Note that I can't upload this myself - I'm neither DD nor DM - so it still
needs a sponsor. Emmanuel Arias has the ITA (#1093668); I've pinged him on
the merge request.

Regards,
Malik

Reply via email to