[gentoo-dev] Re: Preserving mtimes for EAPI3
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Timothy Redaelli wrote: On Tuesday 31 March 2009 00:59:57 Ulrich Mueller wrote: cut [1] For find -newermt we will need =findutils-4.3.3 which shouldn't be a problem because 4.3.4 went stable in May 2007. No, BSD find does not support it and we don't want to use findutils. Neither busybox find supports it. Make it POSIX[1] please. [1] http://www.opengroup.org/onlinepubs/009695399/utilities/find.html Here is a solution that should work with find(1p) and touch(1p): Immediately preceding pkg_setup, `touch ${PORTAGE_BUILDDIR}/.pre_pkg_setup`; immediately following src_install, `touch ${PORTAGE_BUILDDIR}/.post_src_install`. Then, the following call to find(1p) should work: find ${D} -type f \ \( \! -newer ${PORTAGE_BUILDDIR}/.pre_pkg_setup -exec \ touch -c -r ${PORTAGE_BUILDDIR}/.pre_pkg_setup {} + \ -o -newer ${PORTAGE_BUILDDIR}/.post_src_install -exec \ touch -c -r ${PORTAGE_BUILDDIR}/.post_src_install {} + \) - -- ABCD -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknR9dwACgkQOypDUo0oQOrNqACgl6buNNyuQqaXLMSDfu2JzPU2 NuYAoNuaxtEmFcTq0jfIetjMTeT7X2Zn =8+lB -END PGP SIGNATURE-
[gentoo-dev] Re: Preserving mtimes for EAPI3
On Tue, 31 Mar 2009, ABCD wrote: Here is a solution that should work with find(1p) and touch(1p): Immediately preceding pkg_setup, `touch ${PORTAGE_BUILDDIR}/.pre_pkg_setup`; immediately following src_install, `touch ${PORTAGE_BUILDDIR}/.post_src_install`. Then, the following call to find(1p) should work: find ${D} -type f \ \( \! -newer ${PORTAGE_BUILDDIR}/.pre_pkg_setup -exec \ touch -c -r ${PORTAGE_BUILDDIR}/.pre_pkg_setup {} + \ -o -newer ${PORTAGE_BUILDDIR}/.post_src_install -exec \ touch -c -r ${PORTAGE_BUILDDIR}/.post_src_install {} + \) Tested and works well. Seems we cannot do without auxiliary files, since POSIX find doesn't support any reasonable time input format. Ulrich
[gentoo-dev] Re: Preserving mtimes for EAPI3
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ulrich Mueller wrote: But as far as I can see, something along the lines of the following two commands [1] should be all that is needed: find ${D} -type f \( -newermt @${stamp1} -o -print0 \) \ | ${XARGS} -0 touch -c -d @${stamp1} find ${D} -type f -newermt @${stamp2} -print0 \ | ${XARGS} -0 touch -c -d @${stamp2} Variables stamp1 and stamp2 would be assigned from $(date -u +%s) before pkg_setup and after src_install, respectively. The second find command is sort of redundant, since it shouldn't happen that ${D} contains files with timestamps from the future. Maybe it's better to emit a warning in this case. Ulrich [1] For find -newermt we will need =findutils-4.3.3 which shouldn't be a problem because 4.3.4 went stable in May 2007. Personally, I would use find ${D} -type f \! -newermt @${stamp1} -exec \ touch -c -d @${stamp1} {} + and find ${D} -type f -newermt @${stamp2} -exec \ touch -c -d @${stamp2} {} + to avoid an unneeded call to xargs. Just my USD0.02, - -- ABCD (and the bikeshed shall be BLUE) -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknRXQIACgkQOypDUo0oQOo9DwCeJ3O/cnVo2HIc2J88jSj/C1Tc 50kAoI+slGgo2M+ghs2j+awOrrCXyuEl =c5R7 -END PGP SIGNATURE-
[gentoo-dev] Re: Preserving mtimes for EAPI3
On Mon, 30 Mar 2009, ABCD wrote: Personally, I would use find ${D} -type f \! -newermt @${stamp1} -exec \ touch -c -d @${stamp1} {} + and find ${D} -type f -newermt @${stamp2} -exec \ touch -c -d @${stamp2} {} + to avoid an unneeded call to xargs. Right. And it can be done in one command: find ${D} -type f \ \( \! -newermt @${stamp1} -exec touch -c -d @${stamp1} {} + \ -o -newermt @${stamp2} -exec touch -c -d @${stamp2} {} + \) Ulrich
[gentoo-dev] Re: preserving mtimes
Zac Medico wrote: It's currently possible for ebuilds to call the insopts, diropts, exeopts, and libopts functions to modify these variables. If they add the -p option, then timestamps will be preserved. I suppose we can add -p to the default options if that's what everybody wants. Gets my vote (or new-fangled backport from pkgcore if it's more efficient.) -- gentoo-dev@lists.gentoo.org mailing list