Subject: [PATCH 0/4] gnu: bap, python-glcontext: Fix hash and update.
From: Simon Tournier <[email-masked]>
To: [email-masked]
Cc: Simon Tournier <[email-masked]>
Date: Fri, 15 Sep 2023 20:38:34 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

The package “bap” and “python-glcontext” have hash mismatches.  In both cases,
it is because upstream changed the lable tag.  The Git tag pointed some
content and now the same Git tag points another content.

The path I follow for fixing this issue: The first patch of each package does
not modify the checksum hash that had been introduced in Guix; the patch just
restore the correspondance with the immutable content.

Since we are here :-) the second patch of each update them to the last version
available – keeping the explicit commit because there is no reason that
upstream will not replace the Git tag again.

*Please note*.  Because of the referencing to mutable Git tag as reference for
Guix source package, the packages “bap” and “python-glcontext” for all the
Guix revisions containing the first tag reference (now wrong; pointing to past
content) are now broken forever.  They are still installable because they are
still available as substitutes in the build farms but they can vanish at the
next garbage collection of the substitute farms.

Upstream applies the policy they want for their mutable Git tags.  They want
to append ’-alpha’ for some pre-release and do not version the pre-release
candidates.  Fine.  They want to replace the content tagged as a release by
another content and rewrite the tag.  Fine.

However, must we know what is the upstream policy when packaging?  No.

Therefore, rely on mutable Git tag leads to troubles when it is easy to avoid
them: explicity refer to the commit hash in the Guix definition of the
package.  I will open again a discussion about that.

For the record, here some more explanations.

* About bap
===========

If I read correctly, “bap” had been updated to 2.5.0-alpha in Guix with:

        404df667e3b06f1e9a416c956e53c03ca3642140
        AuthorDate: Sun Jun 19 08:43:00 2022 +0200
        CommitDate: Tue Jun 28 19:34:50 2022 +0200

Today, an user gets the source of “bap” because the Guix project still
stores the checkout substitute.  But we cannot predict when the store of
the build farms will be garbage collected and this checkout substitute
will disappear, so making this package broken for many Guix revisions.

To be precise, this source of the package “bap” are unreachable by the Guix
recipe since Jul 8 2022!  Other said, the source of “bap” was correct only few
days and broken since more than one year, it is unsatisfactory.

--8<---------------cut here---------------start------------->8---
$ guix build -S bap
/gnu/store/axrfwjm357glpn02dil5zfis8ma51z6w-bap-2.5.0-alpha-checkout

$ guix build -S bap --check
The following derivation will be built:
  /gnu/store/931x0yxqr800alglvc3gkqaqkfrgwh1b-bap-2.5.0-alpha-checkout.drv
building /gnu/store/931x0yxqr800alglvc3gkqaqkfrgwh1b-bap-2.5.0-alpha-checkout.drv...
guile: warning: failed to install locale
environment variable `PATH' set to `/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/bin:/gnu/store/78rf44kf4xf6lc01jjy9ci5905j2344l-gzip-1.12/bin:/gnu/store/z45rrcnvcw31h1wbl1zh8hh79jkwv0gs-tar-1.34/bin'
Initialized empty Git repository in /gnu/store/axrfwjm357glpn02dil5zfis8ma51z6w-bap-2.5.0-alpha-checkout/.git/
From https://github.com/BinaryAnalysisPlatform/bap
 * tag               v2.5.0-alpha -> FETCH_HEAD

[...]

HEAD is now at baa9022 prevents knowledge conflicts on mangled names (#1535)
r:sha256 hash mismatch for /gnu/store/axrfwjm357glpn02dil5zfis8ma51z6w-bap-2.5.0-alpha-checkout:
  expected hash: 1fw9pp0xnssc08qqfkcafffap4f46hw7zmk80gif5yc4nazga8w5
  actual hash:   0lywz6ld9jmbryf8m4fnq793ylwh34kf5qws6w60ibkhg8wkjhlz
hash mismatch for store item '/gnu/store/axrfwjm357glpn02dil5zfis8ma51z6w-bap-2.5.0-alpha-checkout'
build of /gnu/store/931x0yxqr800alglvc3gkqaqkfrgwh1b-bap-2.5.0-alpha-checkout.drv failed
View build log at '/var/log/guix/drvs/93/1x0yxqr800alglvc3gkqaqkfrgwh1b-bap-2.5.0-alpha-checkout.drv.gz'.
guix build: error: build of `/gnu/store/931x0yxqr800alglvc3gkqaqkfrgwh1b-bap-2.5.0-alpha-checkout.drv' failed

$ git clone https://github.com/BinaryAnalysisPlatform/bap

$ git -C bap checkout v2.5.0-alpha
$ guix hash -rx bap
0lywz6ld9jmbryf8m4fnq793ylwh34kf5qws6w60ibkhg8wkjhlz

$ git -C bap checkout a972f8a419294dfb21847db5172ba58c5d7767eb
$ guix hash -rx bap
1fw9pp0xnssc08qqfkcafffap4f46hw7zmk80gif5yc4nazga8w5

$ git -C bap log --oneline a972f8a419294dfb21847db5172ba58c5d7767eb..v2.5.0-alpha
baa902209ee4 (tag: v2.5.0-alpha) prevents knowledge conflicts on mangled names (#1535)
46c93ca54bba fixes calling convention for ms64 (#1533)
2b789c446e45 improves the main subroutine discovery within glibc runtime (#1532)
c100c28d6a71 makes the ABI processors usable programmatically (#1529)
7e3d4066e98d adds patterns to recognize certain x86 endbr as function starts (#1531)
411c73306e28 turns x86 endbr instructions into nops by default (#1530)
02c953ba034e fixes armv4t name that was missing the arm prefix (#1528)
2af9d9199a6e restructures powerpc targets and reimplements ppc32 eabi (#1526)
4b9932b0612e enables passing arguments by reference (#1525)
5a71fb10683f adds c layouts (#1524)
4d019ce6f267 rewrites mips targets and abi (#1523)
1054959144c0 reimplements ARM ABI specification (#1522)
acbb6d512d4b reimplements x86 targets using the new infrastructure (#1521)
f26063f9b895 adds the high-level calling convention specification language (#1520)
b1f5784684df extends Core Theory with target registration and lookup (#1519)
28e4d883d4e0 uses signed casts for promoting arguments (#1518)
ce62b09cf059 publishes Theory.Target.nicknames and extends Primus Contexts (#1517)
63c79e5b43f2 adds armv8 BFM instructions (#1516)
f07b27040d2c allows target overriding (#1515)
6ef5e3d86259 x86_disasm: support padd instructions (#1513)
577ef721fe21 adds the mmap dependency (#1514)
43b0dcf473d7 Adds more missing Thumb instructions (#1511)
5730f5c21274 adds an example on how to create a monad transformer stack (#1354) (#1510)
096e41eab0d5 restores the old bitvector order, changes the Primus Value order (#1509)
--8<---------------cut here---------------end--------------->8---

* About python-glcontext
=======================

--8<---------------cut here---------------start------------->8---
$ guix build -S python-glcontext --check
The following derivation will be built:
  /gnu/store/j05qbsnlak0xff4k6dd34yyn20q630w3-python-glcontext-2.4.0-checkout.drv
building /gnu/store/j05qbsnlak0xff4k6dd34yyn20q630w3-python-glcontext-2.4.0-checkout.drv...
guile: warning: failed to install locale
environment variable `PATH' set to `/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/bin:/gnu/store/78rf44kf4xf6lc01jjy9ci5905j2344l-gzip-1.12/bin:/gnu/store/z45rrcnvcw31h1wbl1zh8hh79jkwv0gs-tar-1.34/bin'
Initialized empty Git repository in /gnu/store/iixrcir0g1kidxzwnhbvcmc1l5psyyp7-python-glcontext-2.4.0-checkout/.git/
From https://github.com/moderngl/glcontext
 * tag               2.4.0      -> FETCH_HEAD
Note: switching to 'FETCH_HEAD'.

[...]

HEAD is now at 0af21b7 bump to 2.4.0
r:sha256 hash mismatch for /gnu/store/iixrcir0g1kidxzwnhbvcmc1l5psyyp7-python-glcontext-2.4.0-checkout:
  expected hash: 0zzpwyqg19y600n09xz07cxk4jimh9vjraszda7g7ipijq6iasac
  actual hash:   03xpw776pvv8c5n58049yczlkgcqdh9vfcpjlghh3p6cal3yiq8a
hash mismatch for store item '/gnu/store/iixrcir0g1kidxzwnhbvcmc1l5psyyp7-python-glcontext-2.4.0-checkout'
build of /gnu/store/j05qbsnlak0xff4k6dd34yyn20q630w3-python-glcontext-2.4.0-checkout.drv failed
View build log at '/var/log/guix/drvs/j0/5qbsnlak0xff4k6dd34yyn20q630w3-python-glcontext-2.4.0-checkout.drv.gz'.
guix build: error: build of `/gnu/store/j05qbsnlak0xff4k6dd34yyn20q630w3-python-glcontext-2.4.0-checkout.drv' failed

$ git clone https://github.com/moderngl/glcontext

$ for ci in $(git -C glcontext log --format=%H); \
do
  git -C glcontext checkout $ci 2>/dev/null ;\
  echo $ci $(guix hash -rx glcontext)
done | grep 0zzpwyqg19y600n09xz07cxk4jimh9vjraszda7g7ipijq6iasac
beebc1fd08ee850f06f4390be4b280824e383074 0zzpwyqg19y600n09xz07cxk4jimh9vjraszda7g7ipijq6iasac

$ git -C glcontext log --oneline beebc1fd08ee850f06f4390be4b280824e383074..0af21b7
0af21b7c8a8c (tag: 2.4.0) bump to 2.4.0
e962e631067d Update build.yml
c6c1b38a3e28 Update publish.yml
8b2d89cd31e6 disable experimental backends
8a6918336869 fix some platform specific typecast issues
001178af0c7d Update publish.yml
--8<---------------cut here---------------end--------------->8---

Cheers,
simon

Simon Tournier (4):
  gnu: bap: Update to 2.5.0-alpha-0.a972f8a.
  gnu: bap: Update to 2.6.0-alpha-0.f995d28.
  gnu: python-glcontext: Update to 2.4.0-0.beebc1f.
  gnu: python-glcontext: Update to 2.4.0-1.0af21b7.

 gnu/packages/ocaml.scm      | 148 ++++++++++++++++++------------------
 gnu/packages/python-xyz.scm | 100 ++++++++++++------------
 2 files changed, 128 insertions(+), 120 deletions(-)

base-commit: b696fb41bc0dfcb7130a5aa6d69aff2ae191c283
prerequisite-patch-id: 62fc21d64477426edaa901fdf00d27556cb3ce68
prerequisite-patch-id: 01fbfb50e705a21f272c328e67a682868c52087d
-- 
2.38.1