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

Make the manpages build reproducible via datalad.source.epoch (to be used in Debian packaging) #6997

Merged
merged 3 commits into from Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/docbuild.yml
Expand Up @@ -26,3 +26,11 @@ jobs:
- name: Build docs
run: |
make -C docs html doctest;
- name: Test building manpages
run: |
# with custom date
DATALAD_SOURCE_EPOCH=100000000 python setup.py build_manpage
grep '\.TH "datalad" "1" "1973' ./build/man/datalad.1
# no custom date - should be good for the next 980 years
python setup.py build_manpage
grep '\.TH "datalad" "1" "2' ./build/man/datalad.1
8 changes: 6 additions & 2 deletions _datalad_build_support/formatters.py
Expand Up @@ -7,7 +7,9 @@

import argparse
import datetime
import os
import re
import time
from textwrap import wrap


Expand All @@ -25,7 +27,7 @@ def __init__(self,
authors=None,
version=None
):

from datalad import cfg
super(ManPageFormatter, self).__init__(
prog,
indent_increment=indent_increment,
Expand All @@ -34,7 +36,9 @@ def __init__(self,

self._prog = prog
self._section = 1
self._today = datetime.date.today().strftime('%Y\\-%m\\-%d')
self._today = datetime.datetime.utcfromtimestamp(
cfg.obtain('datalad.source.epoch')
).strftime('%Y\\-%m\\-%d')
self._ext_sections = ext_sections
self._version = version

Expand Down
6 changes: 6 additions & 0 deletions changelog.d/pr-6997.md
@@ -0,0 +1,6 @@
### Internal

- Introduce datalad.source.epoch configuration to make the build reproducible
(on Debian only ATM) by providing date to use in the manpages.
[PR #6997](https://github.com/datalad/datalad/pull/6997) (by
[@yarikoptic](https://github.com/yarikoptic))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I even took time to tune up this ;)

14 changes: 14 additions & 0 deletions datalad/interface/common_cfg.py
Expand Up @@ -17,13 +17,15 @@
from os import environ
from os.path import expanduser
from os.path import join as opj
import time

from platformdirs import AppDirs

from datalad.support.constraints import (
EnsureBool,
EnsureChoice,
EnsureInt,
EnsureFloat,
EnsureListOf,
EnsureNone,
EnsureStr,
Expand Down Expand Up @@ -709,6 +711,18 @@ def get_default_ssh():
'type': EnsureChoice('warning', 'error', 'none'),
'default': 'warning',

},
'datalad.source.epoch': {
'ui': ('question', {
'title': 'Datetime epoch to use for dates in built materials',
'text': "Datetime to use for reproducible builds. Originally introduced "
"for Debian packages to interface SOURCE_DATE_EPOCH described at "
"https://reproducible-builds.org/docs/source-date-epoch/ ."
"By default - current time"
}),
'type': EnsureFloat(),
'default': time.time(),

},
'datalad.ssh.executable': {
'ui': ('question', {
Expand Down