[opensuse-buildservice] how to get the date of last package change
Hi. From within spec file I want to get the date when the package was edited last time. Unfortunately obs repos do not seem to save the correct timestamps of source files. The only way I could imagine right now is to take the timestamp of the last "*.changes" entry. Is there a better way? cu, Rudi -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On Tuesday 2015-04-14 14:10, Ruediger Meier wrote:
Unfortunately obs repos do not seem to save the correct timestamps of source files. The only way I could imagine right now is to take the timestamp of the last "*.changes" entry. Is there a better way?
This is in fact the advertised way if you absolutely need the "current" time. (For example, if you intend to replace -TIME__/__DATE__. Though, in case of __DATE__/__TIME__, I just define them to the empty string, which is a lot quicker.) -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On Tuesday 14 April 2015, Jan Engelhardt wrote:
On Tuesday 2015-04-14 14:10, Ruediger Meier wrote:
Unfortunately obs repos do not seem to save the correct timestamps of source files. The only way I could imagine right now is to take the timestamp of the last "*.changes" entry. Is there a better way?
This is in fact the advertised way if you absolutely need the "current" time. (For example, if you intend to replace -TIME__/__DATE__. Though, in case of __DATE__/__TIME__, I just define them to the empty string, which is a lot quicker.)
I'd like to have a reasonable build date in --version output as supposed by upstream. I find it funny that OBS does not support such feature ... But no problem I'm going to parse the .changes file like this: %build # export deterministic BUILD_DATE, format like "__DATE__ __TIME__" CL_DATE="$(awk -F " - " 'NR==2{print $1;}' %{_sourcedir}/%{name}.changes)" test -n "$CL_DATE" export BUILD_DATE="$(LANG=C date --utc -d "${CL_DATE}" +"%b %e %Y %T")" cu, Rudi -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
Ruediger Meier <sweet_f_a@gmx.de> Tue, 14 Apr 2015 19:16:33 +0300:
On Tuesday 14 April 2015, Jan Engelhardt wrote:
On Tuesday 2015-04-14 14:10, Ruediger Meier wrote:
Unfortunately obs repos do not seem to save the correct timestamps of source files. The only way I could imagine right now is to take the timestamp of the last "*.changes" entry. Is there a better way?
This is in fact the advertised way if you absolutely need the "current" time. (For example, if you intend to replace -TIME__/__DATE__. Though, in case of __DATE__/__TIME__, I just define them to the empty string, which is a lot quicker.)
I'd like to have a reasonable build date in --version output as supposed by upstream. I find it funny that OBS does not support such feature ...
But no problem I'm going to parse the .changes file like this:
%build # export deterministic BUILD_DATE, format like "__DATE__ __TIME__" CL_DATE="$(awk -F " - " 'NR==2{print $1;}' %{_sourcedir}/%{name}.changes)" test -n "$CL_DATE" export BUILD_DATE="$(LANG=C date --utc -d "${CL_DATE}" +"%b %e %Y %T")"
cu, Rudi
Providing of build date causes unreproducible builds that increases service load so the latest changes date is much better. -- Best regards, Dmitriy DA(P).DarkneSS Perlow @ Linux x64 -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On Tue, 2015-04-14 at 18:16 +0200, Ruediger Meier wrote:
%build # export deterministic BUILD_DATE, format like "__DATE__ __TIME__" CL_DATE="$(awk -F " - " 'NR==2{print $1;}' %{_sourcedir}/%{name}.changes)" test -n "$CL_DATE" export BUILD_DATE="$(LANG=C date --utc -d "${CL_DATE}" +"%b %e %Y %T")"
Make sure to add the .changes file to the Source: list when you access it during build (and reference it by %{sourceN} Otherwise the resulting .src.rpm is useless. Dominique -- Dimstar / Dominique Leuenberger <dimstar@opensuse.org>
On Tuesday 14 April 2015, Dimstar / Dominique Leuenberger wrote:
On Tue, 2015-04-14 at 18:16 +0200, Ruediger Meier wrote:
%build # export deterministic BUILD_DATE, format like "__DATE__ __TIME__" CL_DATE="$(awk -F " - " 'NR==2{print $1;}' %{_sourcedir}/%{name}.changes)" test -n "$CL_DATE" export BUILD_DATE="$(LANG=C date --utc -d "${CL_DATE}" +"%b %e %Y %T")"
Make sure to add the .changes file to the Source: list when you access it during build (and reference it by %{sourceN}
Otherwise the resulting .src.rpm is useless.
I see, thanks! cu, Rudi -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (4)
-
Dimstar / Dominique Leuenberger
-
Dmitriy Perlow
-
Jan Engelhardt
-
Ruediger Meier