Bug 237010 - Remove __DATE__ and __TIME__ from code
Summary: Remove __DATE__ and __TIME__ from code
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Portability-Runtime (show other bugs)
Version: 1.2.0
Platform: openSUSE Unspecified
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-09 19:49 UTC by Christian Morales Vega
Modified: 2021-01-20 10:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Morales Vega 2010-05-09 19:49:49 UTC
Version:           1.2.0 (using KDE 4.4.3)
Installed from:    openSUSE RPMs

libs/3rdparty/cimg/CImg.h and digikam/version.h.cmake have __DATE__ and __TIME__ entries that make a build irreproducible.

Be reproducible is something good because of a lot of causes. But in openSUSE it also means each time Digikam is rebuilt (because of a change in a dependency) we can detect if the new build has differences with the old one and only make users redownload Digikam if it's really needed.

The one at digikam/version.h.cmake has the extra problem of being internationalizes, making it extra difficult to remove it with a local patch. Notice also that the about dialog gets "Build date" translated but the date itself isn't, so IMHO it's best to just remove the build date.


If you really want the build time I would like at least a cmake option to disable it.
Comment 1 Christian Morales Vega 2010-05-10 22:37:57 UTC
Exactly the same thing applies to kipi-plugins 1.2.0 with the file common/libkipiplugins/tools/kpaboutdata.cpp
Comment 2 Marcel Wiesweg 2011-01-26 12:30:12 UTC
If you already have a local patch, preferably with a CMake option, please attach...
Comment 3 caulier.gilles 2011-12-13 09:42:53 UTC
Christian, do you see comment #2 from Marcel ?

Gilles Caulier
Comment 4 Christian Morales Vega 2011-12-13 10:20:18 UTC
Has been quite a long time since I touched that package. But right now openSUSE is using this patch:

https://build.opensuse.org/package/view_file?file=digikam-buildtime.patch&package=digikam&project=KDE%3ADistro%3AFactory&rev=ed32de9cfa5637640a0418f8eec08a87

and this in the .spec file

# Remove build time references so build-compare can do its work
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" core/digikam/utils/version.h.cmake

In general we have started to use the sed trick since it avoids problems when someone is parsing the output and expects to find the date. So it's not such a big deal for us anymore. Feel free to close the bug if you want to.
Comment 5 Marcel Wiesweg 2011-12-24 16:59:45 UTC
I could think of a CMake option to provide this date, if there is interest
Comment 6 caulier.gilles 2011-12-24 21:52:55 UTC
Marcel,

+1 for me for a pure Cmake option.

Gilles Caulier
Comment 7 caulier.gilles 2013-11-25 14:40:31 UTC
Christian, 

Do you find any solution based on CMake as Marcel explain in comment #5.

Gilles Caulier
Comment 8 caulier.gilles 2014-08-22 12:11:09 UTC
As proposed in comment #5, i close this file as DOWNSTREAM now...

Gilles Caulier
Comment 9 caulier.gilles 2021-01-12 19:41:03 UTC
Git commit c8e6dbe60bf653fd35fe1467e010e36fb03c184b by Gilles Caulier.
Committed on 12/01/2021 at 19:39.
Pushed by cgilles into branch 'master'.

use cmake target object to handle build date intead __DATE__ and __TIME__ macro.
add dependency to libdigikamcore to this target to be shure that build date is always updated at compile time.
FIXED-IN: 7.2.0

M  +2    -1    NEWS
M  +1    -0    core/app/DigikamCoreTarget.cmake
M  +1    -28   core/app/utils/digikam_version.cpp
M  +0    -5    core/app/utils/digikam_version.h.cmake.in
M  +1    -0    core/libs/CMakeLists.txt
A  +38   -0    core/libs/dbuilddate/CMakeLists.txt
A  +40   -0    core/libs/dbuilddate/dbuilddate.cpp     [License: GPL (v2+)]
A  +46   -0    core/libs/dbuilddate/dbuilddate.h     [License: GPL (v2+)]
M  +1    -0    core/libs/onlineversion/onlineversionchecker.cpp
M  +1    -0    core/libs/onlineversion/onlineversiondlg.cpp

https://invent.kde.org/graphics/digikam/commit/c8e6dbe60bf653fd35fe1467e010e36fb03c184b
Comment 10 caulier.gilles 2021-01-13 11:22:23 UTC
Git commit 6cc8e8b0459966ee3ca59873b55bfca80db43450 by Gilles Caulier.
Committed on 13/01/2021 at 11:21.
Pushed by cgilles into branch 'master'.

Use a cmake script to handle build date, as git revision is done. It's more powerful and do not force cmake to re-run from scratch at any make command

M  +3    -0    core/CMakeLists.txt
M  +1    -1    core/app/DigikamCoreTarget.cmake
M  +1    -0    core/app/DigikamTarget.cmake
M  +6    -1    core/app/utils/digikam_version.cpp
M  +5    -0    core/app/utils/digikam_version.h.cmake.in
A  +22   -0    core/cmake/modules/MacroBuildDateHeader.cmake
R  +7    -16   core/cmake/templates/builddate.h.cmake.in [from: core/libs/dbuilddate/dbuilddate.cpp - 065% similarity]
A  +61   -0    core/cmake/templates/builddatescript.cmake.in
M  +6    -0    core/cmake/templates/gitscript.cmake.in
M  +0    -1    core/libs/CMakeLists.txt
D  +0    -1    core/libs/dbuilddate/BUILD_DATE.cmake.in
D  +0    -43   core/libs/dbuilddate/CMakeLists.txt
D  +0    -46   core/libs/dbuilddate/dbuilddate.h
M  +0    -1    core/libs/onlineversion/onlineversionchecker.cpp
M  +0    -1    core/libs/onlineversion/onlineversiondlg.cpp
M  +1    -0    core/showfoto/CMakeLists.txt
M  +2    -3    project/bundles/appimage/03-build-digikam.sh
M  +1    -1    project/bundles/appimage/04-build-appimage.sh
M  +2    -3    project/bundles/macports/03-build-digikam.sh
M  +1    -1    project/bundles/macports/04-build-installer.sh
M  +2    -3    project/bundles/mxe/03-build-digikam.sh
M  +1    -1    project/bundles/mxe/04-build-installer.sh

https://invent.kde.org/graphics/digikam/commit/6cc8e8b0459966ee3ca59873b55bfca80db43450
Comment 11 caulier.gilles 2021-01-19 18:31:58 UTC
Git commit a5212599f40ff6cbcfa63674fa4e6ee5e7584c6c by Gilles Caulier.
Committed on 19/01/2021 at 18:31.
Pushed by cgilles into branch 'master'.

These warnings rules can be removed now.

M  +0    -6    core/CMakeLists.txt

https://invent.kde.org/graphics/digikam/commit/a5212599f40ff6cbcfa63674fa4e6ee5e7584c6c
Comment 12 caulier.gilles 2021-01-20 10:02:16 UTC
Git commit 2f1d08a19a6a055e2bf5070c90926e4a4a83d443 by Gilles Caulier.
Committed on 20/01/2021 at 10:01.
Pushed by cgilles into branch 'master'.

Remove __DATE__ and __TIME__ from CImg.h

M  +7    -4    core/libs/dimg/filters/greycstoration/cimg/CImg.h

https://invent.kde.org/graphics/digikam/commit/2f1d08a19a6a055e2bf5070c90926e4a4a83d443