Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate.py: don't skip files with mtime = 0 #78

Merged
merged 1 commit into from
Jun 5, 2017
Merged

generate.py: don't skip files with mtime = 0 #78

merged 1 commit into from
Jun 5, 2017

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Jun 2, 2017

TL;DR:

'generate.py' fails to generate tests on file with mtime=0:

$ touch --date=@0 clar.{c,h}
$ python generate.py
Traceback (most recent call last):
  File "generate.py", line 242, in <module>
    if suite.write():
  File "generate.py", line 211, in write
    data.write(t.render())
  File "generate.py", line 25, in render
    out = "\n".join("extern %s;" % cb['declaration'] for cb in self.module.callbacks) + "\n"
AttributeError: 'Module' object has no attribute 'callbacks'

Long story:

Error happens because 'generate.py' uses '0' as a sentinel value.

In order to enhance reproducibility of builds some build systems
timestamps to a stable date (say, release tarball date).

https://www.gnu.org/software/guix/ goes even farther that that
and sets mtime to '0'. Unfortunately it is exactly the same as
sentinel value in 'generate.py'. That causes 'generate.py' to
treat all test files as "already read".

The change changes value to 'None'.

Signed-off-by: Sergei Trofimovich slyfox@gentoo.org

TL;DR:

'generate.py' fails to generate tests on file with mtime=0:

```
$ touch --date=@0 clar.{c,h}
$ python generate.py
Traceback (most recent call last):
  File "generate.py", line 242, in <module>
    if suite.write():
  File "generate.py", line 211, in write
    data.write(t.render())
  File "generate.py", line 25, in render
    out = "\n".join("extern %s;" % cb['declaration'] for cb in self.module.callbacks) + "\n"
AttributeError: 'Module' object has no attribute 'callbacks'
```

Long story:

Error happens because 'generate.py' uses '0' as a sentinel value.

In order to enhance reproducibility of builds some build systems
timestamps to a stable date (say, release tarball date).

https://www.gnu.org/software/guix/ goes even farther that that
and sets mtime to '0'. Unfortunately it is exactly the same as
sentinel value in 'generate.py'. That causes 'generate.py' to
treat all test files as "already read".

The change changes value to 'None'.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
mbakke pushed a commit to guix-mirror/guix that referenced this pull request Jun 3, 2017
This commit reverts 'patch' hack introduced in
a48a107 and fixes bug in the Clar test
framework.

Patch is proposed to Clar upstream as
<clar-test/clar#78>.

* gnu/local.mk: Add libgit2-0.25.1-mtime-0.patch.
* gnu/packages/patches/libgit2-0.25.1-mtime-0.patch: New file.
* gnu/packages/version-control.scm (libgit2)[arguments]:
Remove 'apply-patch' phase.
[inputs]: Remove "patch".
[source]: Add 'patches' field.

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
@vmg
Copy link
Collaborator

vmg commented Jun 5, 2017

Now that's a corner case! :p

@vmg vmg merged commit 3d491a0 into clar-test:master Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants