Skip to content

Commit

Permalink
Create .changes files for reproducible builds
Browse files Browse the repository at this point in the history
release rpm files currently do not have .changes files, but these are
needed to extract SOURCE_DATE_EPOCH for reproducible builds.

Using the time stamp of the last commit to the input, which is the
000package-groups source package, as the time for the changes entry
would be reproducible, however there is resistance to that.

The other date that would is somewhat related is the time of the last
source change for any input to the whole distribution, however AFAIK
this date is not cheap enough to compute for OBS-VCS. This hopefully
changes once we move to git. But I think the change date of
000package-groups makes more sense conceptually, because AFAIK that is
the only information that can causes a change.

However to not delay making progress with reproducible builds in
Factory, I propose this change which is non-reproducible, by using the
current wall-clock time. We can revisit this later.

See https://reproducible-builds.org/ for more general information on
this topic.
  • Loading branch information
JanZerebecki committed Mar 7, 2024
1 parent 9919e02 commit d555cf0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkglistgen/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import subprocess
import yaml

from datetime import datetime, timezone

from typing import Any, Mapping, Optional

from lxml import etree as ET
Expand Down Expand Up @@ -717,6 +719,14 @@ def update_and_solve_target(
if not product_version:
# for stagings the product version doesn't matter (I hope)
product_version = '1'
with open(product_dir + "/release.changes", 'w', encoding="utf-8") as f:
date = datetime.now(timezone.utc)
date = date.strftime("%a %b %d %H:%M:%S %Z %Y")
f.write(
"-------------------------------------------------------------------\n"
+ date + " - openSUSE <packaging@lists.opensuse.org>\n\n"
"- automatically generated by openSUSE-release-tools/pkglistgen\n\n"
)
for product_file in glob.glob(os.path.join(product_dir, '*.product')):
self.replace_product_version(product_file, product_version)
logging.debug(subprocess.check_output(
Expand All @@ -730,6 +740,8 @@ def update_and_solve_target(

spec_files = glob.glob(os.path.join(product_dir, '*.spec'))
file_utils.move_list(spec_files, release_dir)
changes_files = glob.glob(os.path.join(product_dir, '*.changes'))
file_utils.move_list(changes_files, release_dir)
inc_files = glob.glob(os.path.join(group_dir, '*.inc'))
# filter special inc file
inc_files = filter(lambda file: file.endswith('weakremovers.inc'), inc_files)
Expand Down

0 comments on commit d555cf0

Please sign in to comment.