Subject: Re: bug#63044: [PATCH] gnu: python-setuptools: Disable date checking in bdist_egg.py

From: Brian Cully <[email-masked]>
Date: Wed, 03 May 2023 20:37:14 -0400

Brian Cully <[email-masked]> writes:

> Ludovic Courtès <[email-masked]> writes:
>
>> The way to do that is to add (guix build python-build-system) 
>> to
>> #:imported-modules and #:modules in those packages, and then to 
>> use
>> ‘modify-phases’ to add that ‘ensure-no-mtimes-pre-1980’ phase 
>> to
>> those
>> of ‘gnu-build-system’.
>>
>> How does that sound, Brian?
>
> That sounds reasonable to me. I'll update the ticket in a bit 
> with
> these changes.

This turns out to be trickier than it first appears:

For one thing, ‘ensure-no-mtimes-pre-1980’ isn't exported from 
(guix build python-build-system). I can use ‘@@’ to reference it, 
but that seems less-than-ideal.

A larger problem is that ‘ensure-no-mtimes-pre-1980’ has a bug: it 
blindly tries to change the utime of files even if they're 
symlinks, which raises an “operation not permitted” 
exception. It's easy enough to fix this, but since it changes 
‘python-build-system’, it causes a tremendous amount of 
rebuilding.

I'm not sure how to proceed. The bug with the build system should 
certainly be fixed, but it'll be disruptive. Until then, at least 
‘criu’ will remain broken — though ‘sssd’ is now building 
correctly with the new phase.

This is the patch:

--8<---------------cut here---------------start------------->8---
diff --git a/guix/build/python-build-system.scm 
b/guix/build/python-build-system.scm
index aa04664b25..1236ea62cd 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -270,7 +270,8 @@ (define* (ensure-no-mtimes-pre-1980 #:rest _)
   ;; timestamps before 1980.
   (let ((early-1980 315619200))  ; 1980-01-02 UTC
     (ftw "." (lambda (file stat flag)
-               (unless (<= early-1980 (stat:mtime stat))
+               (unless (or (<= early-1980 (stat:mtime stat))
+                           (eq? (stat:type stat) 'symlink))
                  (utime file early-1980 early-1980))
                #t))))
 
--8<---------------cut here---------------end--------------->8---

-bjc