Open JanZerebecki opened 11 months ago
Previously I tried to implement this in https://github.com/openSUSE/product-builder/pull/26 and https://github.com/rpm-software-management/rpm/pull/2677 , both of which turned out to be the wrong place.
I think you should do this in /etc/profile.d/suse-buildsystem.sh which is part of the post-build-checks package.
@mlschroe would you be willing to implement this, as I have no idea about this area? E.g. I have the following questions:
How can one get at the changelog for the current build? How can one get the last commit time, e.g. from the metadata for obs version controlled source for the current build, like is available in .osc for osc checkouts? How can one get the last commit time if the source is from git, when we move to that for ALP, i.e. where to find the the .git? post-build-checks is not installed for podman/docker type builds, so what to do for these?
For git based builds the mtime is available in the source:
> iosc api /source/SUSE:ALP:Source:Standard:Core:1.0:Build/kernel-source/_scmsync.obsinfo
mtime: 1695368662
commit: 30adb0966b6635f406ad54781bfbe26f3b752557
url: https://src.suse.de/ALP-pool/kernel-source
revision: 30adb0966b6635f406ad54781bfbe26f3b752557
projectscmsync: https://src.suse.de/products/SUSE_ALP_Standard#38f989dfa5fed7564353e78aa3600fe7e26a31a7
We could add the buildcounter/revision to be available at build time in the file /.buildenv
.
The obsinfo file should be available as $TOPDIR/SOURCES/_scmsync.obsinfo
.
The change in https://github.com/openSUSE/obs-build/commit/5d1da8553791ecdf35ab538bddd6afa4494d66d0 works in my local testing. Together with https://github.com/openSUSE/post-build-checks/pull/58 it should fix this issue.
@mlschroe Please make a release and whatever is necessary to have it deployed on build.opensuse.org.
Set SOURCE_DATE_EPOCH and incorporate rebuild counter / release, so that even for rebuilds with unchanged source but updated build depends the date always increases and no build has the same date.
Initially for rpm to replace %use_source_date_epoch_as_buildtime .
But later also needed for other build types, like kiwi, podman, docker, etc. When there is no changelog use the last git commit date or osc commit date.