* [ptxdist] reproducible timestamps in ipkg package
@ 2020-04-20 16:28 Jon Ringle
2020-04-20 18:16 ` Jon Ringle
0 siblings, 1 reply; 3+ messages in thread
From: Jon Ringle @ 2020-04-20 16:28 UTC (permalink / raw)
To: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 1130 bytes --]
I am having an issue where the timestamps for the files in the ipkg have
the current timestamp instead of the reproducible timestamp coming from
SOURCE_DATE_EPOCH.
I added a debug log message to ptxd_install_fixup_timestamps() found in
scripts/lib/ptxd_make_xpkg_pkg.sh to show the timestamp being used:
ptxd_install_fixup_timestamps() {
local timestamp="@${SOURCE_DATE_EPOCH}"
local touch_args
if touch --help | grep -q -- --no-dereference &> /dev/null; then
touch_args="--no-dereference"
fi
echo "ptxd_install_fixup_timestamps ${timestamp} ($(date
--date=${timestamp}))"
find "${1}" -print0 | xargs -0 touch ${touch_args} -c -d "${timestamp}"
}
I am currently using ptxdist-2019.11.0, and I get the expected result when
directly printing SOURCE_DATE_EPOCH:
$ ptxdist print SOURCE_DATE_EPOCH
1572566400
$ date --date=@$(ptxdist print SOURCE_DATE_EPOCH)
Fri Nov 1 00:00:00 UTC 2019
However, the debug output I added to ptxd_install_fixup_timestamps()
produces this output that corresponds to the current datetime:
ptxd_install_fixup_timestamps @1587399767 (Mon Apr 20 16:22:47 UTC 2020)
-Jon
[-- Attachment #1.2: Type: text/html, Size: 1404 bytes --]
[-- Attachment #2: Type: text/plain, Size: 92 bytes --]
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ptxdist] reproducible timestamps in ipkg package
2020-04-20 16:28 [ptxdist] reproducible timestamps in ipkg package Jon Ringle
@ 2020-04-20 18:16 ` Jon Ringle
2020-04-21 5:40 ` Michael Olbrich
0 siblings, 1 reply; 3+ messages in thread
From: Jon Ringle @ 2020-04-20 18:16 UTC (permalink / raw)
To: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 2014 bytes --]
On Mon, Apr 20, 2020 at 12:28 PM Jon Ringle <jon@ringle.org> wrote:
> I am having an issue where the timestamps for the files in the ipkg have
> the current timestamp instead of the reproducible timestamp coming from
> SOURCE_DATE_EPOCH.
> I added a debug log message to ptxd_install_fixup_timestamps() found in
> scripts/lib/ptxd_make_xpkg_pkg.sh to show the timestamp being used:
>
> ptxd_install_fixup_timestamps() {
> local timestamp="@${SOURCE_DATE_EPOCH}"
> local touch_args
> if touch --help | grep -q -- --no-dereference &> /dev/null; then
> touch_args="--no-dereference"
> fi
>
> echo "ptxd_install_fixup_timestamps ${timestamp} ($(date
> --date=${timestamp}))"
> find "${1}" -print0 | xargs -0 touch ${touch_args} -c -d "${timestamp}"
> }
>
> I am currently using ptxdist-2019.11.0, and I get the expected result when
> directly printing SOURCE_DATE_EPOCH:
> $ ptxdist print SOURCE_DATE_EPOCH
> 1572566400
> $ date --date=@$(ptxdist print SOURCE_DATE_EPOCH)
> Fri Nov 1 00:00:00 UTC 2019
>
> However, the debug output I added to ptxd_install_fixup_timestamps()
> produces this output that corresponds to the current datetime:
> ptxd_install_fixup_timestamps @1587399767 (Mon Apr 20 16:22:47 UTC 2020)
>
>
Ok... I found that this behavior is being caused by this code in
ptxd_make_world_init():
#
# check if we shall use a local work-in-progress tree instead
# of the configured URL.
#
# If a link in local_src/<label>.<platform> exists and points to
# a directory, use this instead of the real one.
#
local
wip_sources="${PTXDIST_WORKSPACE}/local_src/${pkg_label}${PTXDIST_PLATFORMSUFFIX}"
if [ -d "$(readlink -f "${wip_sources}")" ]; then
pkg_url="file://${wip_sources}"
unset pkg_src
# always use a new timestamp for wip builds
SOURCE_DATE_EPOCH="$(echo $(date "+%s"))"
fi
I would like to have a way to conditionally not set SOURCE_DATE_EPOCH in
this case. Suggestions anyone?
-Jon
> -Jon
>
[-- Attachment #1.2: Type: text/html, Size: 2955 bytes --]
[-- Attachment #2: Type: text/plain, Size: 92 bytes --]
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ptxdist] reproducible timestamps in ipkg package
2020-04-20 18:16 ` Jon Ringle
@ 2020-04-21 5:40 ` Michael Olbrich
0 siblings, 0 replies; 3+ messages in thread
From: Michael Olbrich @ 2020-04-21 5:40 UTC (permalink / raw)
To: ptxdist
On Mon, Apr 20, 2020 at 02:16:30PM -0400, Jon Ringle wrote:
> On Mon, Apr 20, 2020 at 12:28 PM Jon Ringle <jon@ringle.org> wrote:
>
> > I am having an issue where the timestamps for the files in the ipkg have
> > the current timestamp instead of the reproducible timestamp coming from
> > SOURCE_DATE_EPOCH.
> > I added a debug log message to ptxd_install_fixup_timestamps() found in
> > scripts/lib/ptxd_make_xpkg_pkg.sh to show the timestamp being used:
> >
> > ptxd_install_fixup_timestamps() {
> > local timestamp="@${SOURCE_DATE_EPOCH}"
> > local touch_args
> > if touch --help | grep -q -- --no-dereference &> /dev/null; then
> > touch_args="--no-dereference"
> > fi
> >
> > echo "ptxd_install_fixup_timestamps ${timestamp} ($(date
> > --date=${timestamp}))"
> > find "${1}" -print0 | xargs -0 touch ${touch_args} -c -d "${timestamp}"
> > }
> >
> > I am currently using ptxdist-2019.11.0, and I get the expected result when
> > directly printing SOURCE_DATE_EPOCH:
> > $ ptxdist print SOURCE_DATE_EPOCH
> > 1572566400
> > $ date --date=@$(ptxdist print SOURCE_DATE_EPOCH)
> > Fri Nov 1 00:00:00 UTC 2019
> >
> > However, the debug output I added to ptxd_install_fixup_timestamps()
> > produces this output that corresponds to the current datetime:
> > ptxd_install_fixup_timestamps @1587399767 (Mon Apr 20 16:22:47 UTC 2020)
> >
> >
> Ok... I found that this behavior is being caused by this code in
> ptxd_make_world_init():
>
> #
> # check if we shall use a local work-in-progress tree instead
> # of the configured URL.
> #
> # If a link in local_src/<label>.<platform> exists and points to
> # a directory, use this instead of the real one.
> #
> local
> wip_sources="${PTXDIST_WORKSPACE}/local_src/${pkg_label}${PTXDIST_PLATFORMSUFFIX}"
> if [ -d "$(readlink -f "${wip_sources}")" ]; then
> pkg_url="file://${wip_sources}"
> unset pkg_src
> # always use a new timestamp for wip builds
> SOURCE_DATE_EPOCH="$(echo $(date "+%s"))"
> fi
>
> I would like to have a way to conditionally not set SOURCE_DATE_EPOCH in
> this case. Suggestions anyone?
local_src/<pkg>.<suffix> is really only a development feature. If you want
to use sources in local_src/ permanently, then you should overwrite the
URL. Note that you don't need to overwrite the whole rule file if only the
URL changes:
$ cat rules/post/mypkg-fixup.make
MYPKG_URL := local_src/my-pkg
undefine MYPKG_SOURCE
And just use something that does not match the <pkg>.<suffix> pattern used
above.
Michael
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-21 5:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 16:28 [ptxdist] reproducible timestamps in ipkg package Jon Ringle
2020-04-20 18:16 ` Jon Ringle
2020-04-21 5:40 ` Michael Olbrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox