Re: [Reproducible-builds] [Help-tar] [PATCH] Add --clamp-mtime option

2015-06-04 Thread Paul Eggert

Jérémy Bobbio wrote:

We use BUILD_DATE="$(dpkg-parsechangelog -S Date)" to get the time of
the latest debian/changelog entry. Other projects could use
BUILD_DATE="$(git log -1 --pretty="%cd")".


Hah!  I use "git log -1 --format='tformat:%ct'" for this situation in the tzcode 
distribution.  Great minds think (nearly) alike.


I guess I'm not still seeing why it's a win to add an option to tar, since we 
seem to have a solution that doesn't involve messing with tar.


___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Re: [Reproducible-builds] [Help-tar] [PATCH] Add --clamp-mtime option

2015-06-04 Thread Jérémy Bobbio
Paul Eggert:
> On 06/04/2015 08:59 AM, Jérémy Bobbio wrote:
> >BUILD_DATE="Mon, 01 Jun 2015 18:11:50 +0200"
> 
> Yes, that's the hassle I was referring to.  Something has to keep track of
> BUILD_DATE and update it when appropriate.  It would be better if this were
> automated somehow.  (Sorry, I don't have an answer here, just pointing out
> the problem.)

We use BUILD_DATE="$(dpkg-parsechangelog -S Date)" to get the time of
the latest debian/changelog entry. Other projects could use
BUILD_DATE="$(git log -1 --pretty="%cd")". I had inlined a value to
put an emphasis on the fact that it was not Debian specific.

> >we currently do:
> >
> > find "$DIR" -newermt "$BUILD_DATE' -print0 | \
> > xargs -0r touch --no-dereference --date="$BUILD_DATE"
> > tar -cf archive.tar "$DIR"
> >
> >And with the `--clamp-mtime` option, we could replace the last lines by:
> >
> > tar -cf archive.tar --mtime="$BUILD_DATE" --clamp-mtime "$DIR"
> >
> >Bonus: actual file metadata are not altered.
> 
> OK, but it sounds like you have something working now, and here the bonus
> (actual file metadata not altered) is reasonably minor, so the argument for
> adding this new feature to tar is relatively weak.

Some figures: there's at least 150 packages that could be fixed with
such an option and a change in dpkg. Another batch of 25 (and maybe
more) using `tar` that would benefit from a nicer way to clamp mtimes to
a given value.

https://reproducible.debian.net/issues/unstable/not_using_dh_builddeb_issue.html
https://reproducible.debian.net/issues/unstable/timestamps_in_tarball_issue.html
(and we had some disagreement on adding the find+xargs+touch
construction to dh_builddeb which would be solved by fixing the issue
directly in dpkg; also because making it optional would become easier)

-- 
Lunar.''`. 
lu...@debian.org: :Ⓐ  :  # apt-get install anarchism
`. `'` 
  `-   


signature.asc
Description: Digital signature
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Re: [Reproducible-builds] [Help-tar] [PATCH] Add --clamp-mtime option

2015-06-04 Thread Jérémy Bobbio
Hi!

Paul, Thanks for your quick reply. :)

Paul Eggert:
> An option along these lines sounds like it would be useful, thanks.  But I
> have some confusions and/or problems with the suggestion.
> 
> First, the patch doesn't alter the documentation, which is typically the
> hardest part of any change like this.  The documentation should give an
> example of how the new option would be useful.

Indeed. I have only changed `--help` output so far:

--clamp-mtime only set time when the file is more recent
  than what was given with --mtime

If you feel it's a worthwile addition to `tar`, I shall update the rest
of the documentation.

> Second, I'm having trouble seeing how to use the option (and this is
> probably because of the first item...).  How does the maintainer keep track
> of a clamped mtime?  Isn't that a hassle to maintain?  Can't 'tar' do this
> for you, instead of your having to do it?

I am not sure who is the “maintainer” you are referring to.

To give a concrete example, to get reproducible mtimes in a tar file,
you can currently do the following:

BUILD_DATE="Mon, 01 Jun 2015 18:11:50 +0200"

tar -cf archive.tar --mtime="$BUILD_DATE" "$DIR"

You can get the same result by doing:

find "$DIR" -print0 | xargs -0r touch --no-dereference --date="$BUILD_DATE"
tar -cf archive.tar "$DIR"

But this makes every timestamps equal. Instead, to keep some
information about the original files, we currently do:

find "$DIR" -newermt "$BUILD_DATE' -print0 | \
xargs -0r touch --no-dereference --date="$BUILD_DATE"
tar -cf archive.tar "$DIR"

And with the `--clamp-mtime` option, we could replace the last lines by:

tar -cf archive.tar --mtime="$BUILD_DATE" --clamp-mtime "$DIR"

Bonus: actual file metadata are not altered.

(This leaves aside other issues I have previously mentioned, focusing
only on timestamps. This would already help us tackle the issue of
the mtimes of the tarballs inside .deb).

In the context of Debian packages, we can set BUILD_DATE to the value of
`dpkg-parsechangelog -S Date`. So no further changes would be required.

-- 
Lunar.''`. 
lu...@debian.org: :Ⓐ  :  # apt-get install anarchism
`. `'` 
  `-   


signature.asc
Description: Digital signature
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Re: [Reproducible-builds] [Help-tar] [PATCH] Add --clamp-mtime option

2015-06-04 Thread Paul Eggert
An option along these lines sounds like it would be useful, thanks.  But I have 
some confusions and/or problems with the suggestion.


First, the patch doesn't alter the documentation, which is typically the hardest 
part of any change like this.  The documentation should give an example of how 
the new option would be useful.


Second, I'm having trouble seeing how to use the option (and this is probably 
because of the first item...).  How does the maintainer keep track of a clamped 
mtime?  Isn't that a hassle to maintain?  Can't 'tar' do this for you, instead 
of your having to do it?


___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds