Skip to content

Commit

Permalink
python/sepolicy: allow to override manpage date
Browse files Browse the repository at this point in the history
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This patch was done while working on reproducible builds for openSUSE.

Signed-off-by: Bernhard M. Wiedemann <[email protected]>
  • Loading branch information
bmwiedemann authored and bachradsusi committed Nov 13, 2020
1 parent 89dab46 commit fadcc83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/sepolicy/sepolicy/manpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
equiv_dict = {"smbd": ["samba"], "httpd": ["apache"], "virtd": ["virt", "libvirt"], "named": ["bind"], "fsdaemon": ["smartmon"], "mdadm": ["raid"]}

equiv_dirs = ["/var"]
man_date = time.strftime("%y-%m-%d", time.gmtime(
int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
modules_dict = None


Expand Down Expand Up @@ -569,7 +571,7 @@ def _typealias_gen_man(self, t):

def _typealias(self,typealias):
self.fd.write('.TH "%(typealias)s_selinux" "8" "%(date)s" "%(typealias)s" "SELinux Policy %(typealias)s"'
% {'typealias':typealias, 'date': time.strftime("%y-%m-%d")})
% {'typealias':typealias, 'date': man_date})
self.fd.write(r"""
.SH "NAME"
%(typealias)s_selinux \- Security Enhanced Linux Policy for the %(typealias)s processes
Expand All @@ -588,7 +590,7 @@ def _typealias(self,typealias):

def _header(self):
self.fd.write('.TH "%(domainname)s_selinux" "8" "%(date)s" "%(domainname)s" "SELinux Policy %(domainname)s"'
% {'domainname': self.domainname, 'date': time.strftime("%y-%m-%d")})
% {'domainname': self.domainname, 'date': man_date})
self.fd.write(r"""
.SH "NAME"
%(domainname)s_selinux \- Security Enhanced Linux Policy for the %(domainname)s processes
Expand Down

0 comments on commit fadcc83

Please sign in to comment.