All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 10/12] cdrkit: add patch allowing to set creation date
Date: Tue, 14 Jun 2016 17:32:15 +0200	[thread overview]
Message-ID: <1465918337-30732-1-git-send-email-gilles.chanteperdrix@xenomai.org> (raw)
In-Reply-To: <20160614152928.GH3060@hermes.click-hack.org>

The patch was posted here:
https://lists.gnu.org/archive/html/bug-cpio/2014-08/msg00000.html

And allows generating reproducible iso images with genisoimage.

Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
---
 ...-reproducible-allow-setting-creation-date.patch | 140 +++++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100644 package/cdrkit/0003-reproducible-allow-setting-creation-date.patch

diff --git a/package/cdrkit/0003-reproducible-allow-setting-creation-date.patch b/package/cdrkit/0003-reproducible-allow-setting-creation-date.patch
new file mode 100644
index 0000000..f5ed465
--- /dev/null
+++ b/package/cdrkit/0003-reproducible-allow-setting-creation-date.patch
@@ -0,0 +1,140 @@
+diff --git a/genisoimage/.eltorito.c.swp b/genisoimage/.eltorito.c.swp
+new file mode 100644
+index 0000000..a49fcbd
+Binary files /dev/null and b/genisoimage/.eltorito.c.swp differ
+diff --git a/genisoimage/genisoimage.1 b/genisoimage/genisoimage.1
+index d05b24a..d69a1d4 100644
+--- a/genisoimage/genisoimage.1
++++ b/genisoimage/genisoimage.1
+@@ -976,6 +976,12 @@ in the
+ .I .genisoimagerc
+ file.
+ .TP
++.BI \-creation-date " epoch"
++Specifies the date to be used as creation, modification and effective
++date in the volume descriptor and for files and relocations created
++on the fly. Specified as a number of second since
++1970-01-01 00:00:00 +0000 (UTC); if 0, the current time is used.
++.TP
+ .B \-print\-size
+ Print estimated filesystem size in multiples of the sector size (2048 bytes)
+ and exit. This option is needed for
+diff --git a/genisoimage/genisoimage.c b/genisoimage/genisoimage.c
+index cfd079a..58397e9 100644
+--- a/genisoimage/genisoimage.c
++++ b/genisoimage/genisoimage.c
+@@ -169,6 +169,7 @@ char	*abstract = ABSTRACT_DEFAULT;
+ char	*volset_id = VOLSET_ID_DEFAULT;
+ char	*volume_id = VOLUME_ID_DEFAULT;
+ char	*system_id = SYSTEM_ID_DEFAULT;
++time_t  creation_date = 0;
+ char	*boot_catalog = BOOT_CATALOG_DEFAULT;
+ char	*boot_image = BOOT_IMAGE_DEFAULT;
+ char	*genboot_image = BOOT_IMAGE_DEFAULT;
+@@ -405,6 +406,8 @@ struct ld_option {
+ #define	OPTION_ALLOW_LEADING_DOTS	1070
+ #define	OPTION_PUBLISHER		1071
+ 
++#define OPTION_CREATION_DATE            1072
++
+ #ifdef		JIGDO_TEMPLATE
+ #define	OPTION_JTT_OUTPUT		1101
+ #define	OPTION_JTJ_OUTPUT		1102
+@@ -522,6 +525,8 @@ static const struct ld_option ld_options[] =
+ 	'\0', "FILE", "Check all ISO9660 names from previous session", ONE_DASH},
+ 	{{"copyright", required_argument, NULL, OPTION_COPYRIGHT},
+ 	'\0', "FILE", "Set Copyright filename", ONE_DASH},
++	{{"creation-date", required_argument, NULL, OPTION_CREATION_DATE},
++	'\0', NULL, "Set volume creation date", ONE_DASH},
+ 	{{"debug", no_argument, NULL, OPTION_DEBUG},
+ 	'\0', NULL, "Set debug flag", ONE_DASH},
+ 	{{"eltorito-boot", required_argument, NULL, 'b'},
+@@ -1721,6 +1726,22 @@ int main(int argc, char *argv[])
+ #endif
+ 			}
+ 			break;
++		case OPTION_CREATION_DATE:
++		{
++			char	*end = 0;
++
++			creation_date = strtol(optarg, &end, 10);
++			if (!end || *end != 0) {
++#ifdef	USE_LIBSCHILY
++				comerrno(EX_BAD, "Bad epoch for -creation-date\n");
++#else
++				fprintf(stderr, "Bad epoch for -creation-date\n");
++				exit(1);
++#endif
++			}
++			break;
++		}
++
+ 		case OPTION_DEBUG:
+ 			debug++;
+ 			break;
+diff --git a/genisoimage/genisoimage.h b/genisoimage/genisoimage.h
+index bbedfb0..c49576c 100644
+--- a/genisoimage/genisoimage.h
++++ b/genisoimage/genisoimage.h
+@@ -650,6 +650,7 @@ extern char	*appid;
+ extern char	*volset_id;
+ extern char	*system_id;
+ extern char	*volume_id;
++extern time_t	creation_date;
+ extern char	*boot_catalog;
+ extern char	*boot_image;
+ extern char	*genboot_image;
+diff --git a/genisoimage/tree.c b/genisoimage/tree.c
+index 7805888..f17a662 100644
+--- a/genisoimage/tree.c
++++ b/genisoimage/tree.c
+@@ -783,7 +783,11 @@ generate_reloc_directory()
+ 	struct directory_entry *s_entry;
+ 
+ 	/* Create an  entry for our internal tree */
+-	time(&current_time);
++	if (creation_date == 0) {
++		time(&current_time);
++	} else {
++		current_time = creation_date;
++	}
+ 	reloc_dir = (struct directory *)
+ 		e_malloc(sizeof (struct directory));
+ 	memset(reloc_dir, 0, sizeof (struct directory));
+@@ -2680,7 +2684,11 @@ init_fstatbuf()
+ 	time_t	current_time;
+ 
+ 	if (fstatbuf.st_ctime == 0) {
+-		time(&current_time);
++		if (creation_date == 0) {
++			time(&current_time);
++		} else {
++			current_time = creation_date;
++		}
+ 		if (rationalize_uid)
+ 			fstatbuf.st_uid = uid_to_use;
+ 		else
+diff --git a/genisoimage/write.c b/genisoimage/write.c
+index a423ab1..f63507c 100644
+--- a/genisoimage/write.c
++++ b/genisoimage/write.c
+@@ -1885,12 +1885,17 @@ pvd_write(FILE *outfile)
+ 	int		should_write;
+ 	struct tm	local;
+ 	struct tm	gmt;
++	time_t		pvd_date;
+ 
+ 
+ 	time(&begun);
+ 
+-	local = *localtime(&begun);
+-	gmt = *gmtime(&begun);
++	if (creation_date == 0) {
++		creation_date = begun;
++	}
++
++	local = *localtime(&creation_date);
++	gmt = *gmtime(&creation_date);
+ 
+ 	/*
+ 	 * There was a comment here about breaking in the year 2000.
-- 
2.8.2

  parent reply	other threads:[~2016-06-14 15:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 15:29 [Buildroot] Reproducible build v2 Gilles Chanteperdrix
2016-06-14 15:31 ` [Buildroot] [PATCH 01/12] reproducibility: introduce config knob Gilles Chanteperdrix
2016-06-14 15:31   ` [Buildroot] [PATCH 02/12] reproducibility: override locale and timezone Gilles Chanteperdrix
2016-07-02  9:01     ` Yann E. MORIN
2016-07-02  9:58     ` Peter Korsgaard
2016-06-14 15:31   ` [Buildroot] [PATCH 03/12] reproducibility: generate SOURCE_DATE_EPOCH Gilles Chanteperdrix
2016-07-02  9:20     ` Yann E. MORIN
2016-06-14 15:31   ` [Buildroot] [PATCH 04/12] reproducibility/linux: override build timestamp Gilles Chanteperdrix
2016-07-02  9:34     ` Yann E. MORIN
2016-06-14 15:31   ` [Buildroot] [PATCH 05/12] reproducibility/busybox: disable build timestamps Gilles Chanteperdrix
2016-07-02  9:51     ` Yann E. MORIN
2016-06-14 15:31   ` [Buildroot] [PATCH 06/12] reproducibility/libgcrypt: override timestamps Gilles Chanteperdrix
2016-07-02  9:52     ` Yann E. MORIN
2016-06-14 15:31   ` [Buildroot] [PATCH 07/12] reproducibility/libgpg-error: " Gilles Chanteperdrix
2016-07-02  9:54     ` Yann E. MORIN
2016-06-14 15:31   ` [Buildroot] [PATCH 08/12] package/cpio: allow generating host-cpio Gilles Chanteperdrix
2016-07-02 10:16     ` Yann E. MORIN
2016-06-14 15:31   ` [Buildroot] [PATCH 09/12] reproducibility/fs/cpio: generate archive with host-cpio Gilles Chanteperdrix
2016-07-02 10:18     ` Yann E. MORIN
2016-07-02 11:11     ` Arnout Vandecappelle
2016-07-02  9:00   ` [Buildroot] [PATCH 01/12] reproducibility: introduce config knob Yann E. MORIN
2016-07-02  9:26   ` Peter Korsgaard
2016-06-14 15:32 ` Gilles Chanteperdrix [this message]
2016-06-14 15:32   ` [Buildroot] [PATCH 11/12] reproducibility/fs/iso9660: reproducible iso images Gilles Chanteperdrix
2016-07-17 19:29     ` Yann E. MORIN
2016-06-14 15:32   ` [Buildroot] [PATCH 12/12] reproducible/syslinux: make syslinux build reproducible Gilles Chanteperdrix
2016-07-17 19:44     ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465918337-30732-1-git-send-email-gilles.chanteperdrix@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.