Bug 1220540

Summary: rpm: 0003-Error-out-on-a-missing-changelog-date.patch breaks packages
Product: [openSUSE] openSUSE Tumbleweed Reporter: Ludwig Nussel <lnussel>
Component: BasesystemAssignee: Jan Zerebecki <jzerebecki>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: mls
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Ludwig Nussel 2024-02-28 10:11:17 UTC
0003-Error-out-on-a-missing-changelog-date.patch breaks packages such as
https://build.opensuse.org/package/show/Base:System:ci:aaa_base/aaa_base
which build from git using tar_scm. What is the suggested fix?
Comment 1 Ludwig Nussel 2024-02-28 10:12:09 UTC
FTR:

[   12s] WARNING could not set SOURCE_DATE_EPOCH, ensure mtime is in $TOPDIR/SOURCES/_scmsync.obsinfo or BUILD_CHANGELOG_TIMESTAMP is set in /.buildenv
[   12s] WARNING could not set SOURCE_DATE_EPOCH, ensure BUILD_RELEASE is set in /.buildenv
[   12s] /etc/profile.d/suse-buildsystem.sh: line 53: test: : integer expression expected
[   12s] Running build time source services...
[   12s] -----------------------------------------------------------------
[   12s] I have the following modifications for aaa_base.spec:
[   12s] 37c37
[   12s] < Release:        0
[   12s] ---
[   12s] > Release:        28.7
[   13s] -----------------------------------------------------------------
[   13s] ----- building aaa_base.spec (user abuild)
[   13s] -----------------------------------------------------------------
[   13s] -----------------------------------------------------------------
[   13s] WARNING could not set SOURCE_DATE_EPOCH, ensure mtime is in $TOPDIR/SOURCES/_scmsync.obsinfo or BUILD_CHANGELOG_TIMESTAMP is set in /.buildenv
[   13s] WARNING could not set SOURCE_DATE_EPOCH, ensure BUILD_RELEASE is set in /.buildenv
[   13s] /etc/profile.d/suse-buildsystem.sh: line 53: test: : integer expression expected
[   13s] + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --define '_build_create_debug 1' --define 'disturl obs://build.opensuse.org/Base:System:ci:aaa_base/openSUSE_Factory/02e1c226ee92f25b6625cd025a68047f-aaa_base' /home/abuild/rpmbuild/SOURCES/aaa_base.spec
[   13s] error: source_date_epoch_from_changelog set but %changelog is missing
Comment 2 Jan Zerebecki 2024-02-28 10:44:53 UTC
You already have changesgenerate enabled in _service, but it seems that only works if a aaa_base.changes exists. I think we should fix that to always create it. At least locally it works after creating an empty one. So as a workaround I'd suggest commiting an empty one in the place where the _service file is.
Comment 3 Ludwig Nussel 2024-02-28 10:51:28 UTC
Ok so that is a bug in tar_scm then I guess. However, the setting also breaks trivial pacckages with no .changes files. That's perfectly valid to have in OBS if they are not intended for Factory.
Comment 4 Jan Zerebecki 2024-02-28 11:19:33 UTC
https://github.com/openSUSE/obs-service-tar_scm/pull/484

Note as an alternative workaround you can also disable the rpm check by rpm macro, e.g. in prjconf or spec file: %source_date_epoch_from_changelog 0

But the above PR should fix it.
Comment 5 Jan Zerebecki 2024-02-28 11:25:44 UTC
Do you think a macro setting like that is enough for packages that really want to avoid giving a last source change date? (For git based packages we have a way to get the date, but with obs vcs it is more complicated.)
Comment 6 Ludwig Nussel 2024-02-28 12:17:50 UTC
I set the macro once I found out what's going on. Nevertheless it just complicates things for no reason. IMO it should stay a warning in the default case. If Factory needs to enforce last source change date, then a macro that is only active in Factory itself (and staging) could turn it into an error.
Comment 7 Jan Zerebecki 2024-03-01 11:49:49 UTC
I guess you suggest to use obs prjconf syntax like
%if "%_project" == "openSUSE:Factory"
to only enable the error on missing changes inside Factory and staging project. The downside is that as it would not be inherited in devel projects, so such errors will not be noticed on the submit request to devel, only in the staging build after submitting to Factory. I'll think about this.

An alternative would be to derive the date from the mtimes on files in the obs vcs (from log will not do well as it changes on branch), if we can get at that information from obs-build.
Comment 8 Jan Zerebecki 2024-03-08 07:20:04 UTC
Another alternative might be to set SDE to a low constant value and only enforce the error in Factory. That allows the packages to still be reproducible.