xbps-create(1): timestamps of metadata files are now set to epoch.

Thanks to @Gottox for finding the real issue.
This commit is contained in:
Juan RP 2015-09-03 11:12:49 +02:00
parent 2a6b14ae74
commit 782ec10111
3 changed files with 39 additions and 10 deletions

14
NEWS
View File

@ -1,5 +1,14 @@
xbps-0.48 (???): xbps-0.48 (???):
* xbps-create(1): it is now able to generate identical packages when its
content does not differ. This is the first part required to the
"100% reproducible builds" goal.
* xbps-create(1): do not add a build-date property to packages.
* xbps-rindex(1): use mtime of file instead of the build-date field in the
package to set build-date in the repo index.
* libxbps: when using verbose mode (-v) also print pkgs that are being * libxbps: when using verbose mode (-v) also print pkgs that are being
added to the transaction, this way we can know what pkg(s) are blocking added to the transaction, this way we can know what pkg(s) are blocking
a transaction when there are unresolved (reverse)dependencies. a transaction when there are unresolved (reverse)dependencies.
@ -27,11 +36,6 @@ xbps-0.48 (???):
extra alphanumeric characters in the `reverts' object. Added a new testcase extra alphanumeric characters in the `reverts' object. Added a new testcase
to verify its correctness. to verify its correctness.
* xbps-create(1): do not add a build-date property to packages.
* xbps-rindex(1): use mtime of file instead of the build-date field in the
package to set build-date in the repo index.
xbps-0.47 (2015-07-18): xbps-0.47 (2015-07-18):
* When executing pkg configuration, override the umask with sane defaults. * When executing pkg configuration, override the umask with sane defaults.

View File

@ -75,7 +75,6 @@ xbps_archive_append_buf(struct archive *ar, const void *buf, const size_t buflen
const char *fname, const mode_t mode, const char *uname, const char *gname) const char *fname, const mode_t mode, const char *uname, const char *gname)
{ {
struct archive_entry *entry; struct archive_entry *entry;
time_t tm;
assert(ar); assert(ar);
assert(buf); assert(buf);
@ -83,7 +82,6 @@ xbps_archive_append_buf(struct archive *ar, const void *buf, const size_t buflen
assert(uname); assert(uname);
assert(gname); assert(gname);
tm = time(NULL);
entry = archive_entry_new(); entry = archive_entry_new();
assert(entry); assert(entry);
@ -93,9 +91,6 @@ xbps_archive_append_buf(struct archive *ar, const void *buf, const size_t buflen
archive_entry_set_gname(entry, gname); archive_entry_set_gname(entry, gname);
archive_entry_set_pathname(entry, fname); archive_entry_set_pathname(entry, fname);
archive_entry_set_size(entry, buflen); archive_entry_set_size(entry, buflen);
archive_entry_set_atime(entry, tm, 0);
archive_entry_set_mtime(entry, tm, 0);
archive_entry_set_ctime(entry, tm, 0);
if (archive_write_header(ar, entry) != ARCHIVE_OK) { if (archive_write_header(ar, entry) != ARCHIVE_OK) {
archive_entry_free(entry); archive_entry_free(entry);

View File

@ -110,9 +110,39 @@ restore_mtime_body() {
atf_check_equal "$expected" "$result" atf_check_equal "$expected" "$result"
} }
atf_test_case reproducible_pkg
reproducible_pkg_head() {
atf_set "descr" "xbps-create(1): generate identical packages"
}
reproducible_pkg_body() {
mkdir -p repo pkg_A/usr/include/gsm
# identical content
echo QWERTY > pkg_A/usr/include/gsm/gsm.h
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" pkg_A
atf_check_equal $? 0
mv foo-1.0_1.noarch.xbps foo-1.0_1.noarch.xbps.orig
atf_check_equal $? 0
sleep 1
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" pkg_A
atf_check_equal $? 0
cmp -s foo-1.0_1.noarch.xbps foo-1.0_1.noarch.xbps.orig
atf_check_equal $? 0
# modified content
echo QWERTZ > pkg_A/usr/include/gsm/gsm.h
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" pkg_A
atf_check_equal $? 0
cmp -s foo-1.0_1.noarch.xbps foo-1.0_1.noarch.xbps.orig
atf_check_equal $? 1
}
atf_init_test_cases() { atf_init_test_cases() {
atf_add_test_case hardlinks_size atf_add_test_case hardlinks_size
atf_add_test_case symlink_relative_target atf_add_test_case symlink_relative_target
atf_add_test_case symlink_relative_target_cwd atf_add_test_case symlink_relative_target_cwd
atf_add_test_case restore_mtime atf_add_test_case restore_mtime
atf_add_test_case reproducible_pkg
} }