[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [core-updates] issues with python's zip
From: |
Andreas Enge |
Subject: |
Re: [core-updates] issues with python's zip |
Date: |
Thu, 20 Apr 2023 00:19:45 +0200 |
Hello,
Am Fri, Apr 14, 2023 at 06:47:04PM -0400 schrieb Brian Cully via Development of
GNU Guix and the GNU System distribution.:
> I've run into issues with two packages on core-updates that fail to build
> because the zip library being used can't handle dates before 1980. I assume
> there are more.
> Do we have a way to handle this gracefully? In the mean time I've patched
> both packages (‘sssd’ and ‘criu’) with a new build phase:
criu fails like this for me:
copying crit.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
pycriu.images.__pycache__.__init__.cpython-310: module references __file__
creating dist
creating 'dist/crit-3.17.1-py3.10.egg' and adding
'build/bdist.linux-x86_64/egg' to it
Traceback (most recent call last):
File "/tmp/guix-build-criu-3.17.1.drv-0/source/scripts/crit-setup.py", line
16, in <module>
setup(name="crit",
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/_distutils/core.py",
line 177, in setup
return run_commands(dist)
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/_distutils/core.py",
line 193, in run_commands
dist.run_commands()
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/_distutils/dist.py",
line 968, in run_commands
self.run_command(cmd)
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/dist.py",
line 1217, in run_command
super().run_command(command)
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/_distutils/dist.py",
line 987, in run_command
cmd_obj.run()
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/command/install.py",
line 74, in run
self.do_egg_install()
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/command/install.py",
line 123, in do_egg_install
self.run_command('bdist_egg')
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/_distutils/cmd.py",
line 317, in run_command
self.distribution.run_command(command)
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/dist.py",
line 1217, in run_command
super().run_command(command)
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/_distutils/dist.py",
line 987, in run_command
cmd_obj.run()
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/command/bdist_egg.py",
line 226, in run
make_zipfile(self.egg_output, archive_root, verbose=self.verbose,
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/command/bdist_egg.py",
line 452, in make_zipfile
visit(z, dirname, files)
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/command/bdist_egg.py",
line 445, in visit
z.write(path, p)
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/zipfile.py",
line 1739, in write
zinfo = ZipInfo.from_file(filename, arcname,
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/zipfile.py",
line 518, in from_file
zinfo = cls(arcname, date_time)
File
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/zipfile.py",
line 362, in __init__
raise ValueError('ZIP does not support timestamps before 1980')
ValueError: ZIP does not support timestamps before 1980
I came across this:
https://docs.python.org/3/library/zipfile.html#zipfile-objects
So apparently when creating a zipfile object (this is the constructor
we are looking at, right?), one can pass a parameter that tells it to
not bother about time stamps of old files.
Then it is a matter of finding out where it happens. I think it is
line 450 of (in my case)
/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/setuptools/command/bdist_egg.py
which reads
z = zipfile.ZipFile(zip_filename, mode, compression=compression)
Maybe we should patch our Python so that it becomes
z = zipfile.ZipFile(zip_filename, mode, compression=compression,
strict_timestamps=False)
?
(not before the core-updates merge, however)
But is a bit surprising that it does not happen all the time;
or are only a few packages calling bdist_egg.py?
Andreas