Skip to content

Commit fadcc83

Browse files
bmwiedemannbachradsusi
authored andcommitted
python/sepolicy: allow to override manpage date
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]>
1 parent 89dab46 commit fadcc83

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/sepolicy/sepolicy/manpage.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
equiv_dict = {"smbd": ["samba"], "httpd": ["apache"], "virtd": ["virt", "libvirt"], "named": ["bind"], "fsdaemon": ["smartmon"], "mdadm": ["raid"]}
4040

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

4446

@@ -569,7 +571,7 @@ def _typealias_gen_man(self, t):
569571

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

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

0 commit comments

Comments
 (0)