Re: Adding sha256 support into jigdo tools (jigdo and jigit)
Arg, and our mails have just crossed I see! :-)
On Tue, Nov 12, 2019 at 07:24:16PM +0100, Thomas Schmitt wrote:
>Hi,
>
>after finding
> https://git.einval.com/cgi-bin/gitweb.cgi?p=jigit.git;a=log;h=refs/heads/sha256
> https://git.einval.com/cgi-bin/gitweb.cgi?p=jigit.git;a=blob;f=libjte/libjte.h;hb=refs/heads/sha256
>i now believe to understand that the new API call
>
> int libjte_set_checksum_algorithm(struct libjte_env *jte_handle,
> char *algorithm, int *size);
>
>became necessary because in API call write_jt_header() the static function
>parse_checksum_list() is called only conditionally. So you cannot rely on
>it as detector of checksum type.
ACK. I'd not thought that through fully myself here, but yes.
>I ponder whether i should let xorriso detect or check the type in the
>-md5-list file, depending on whether the checksum type was already
>explicitely chosen.
Maybe, that's up to you I guess.
>Guessing that you added a new "aspect" case to Xorriso_jigdo_interpreter(),
>i wonder what name you have chosen.
>Obvious but also quite long would be "-checksum_algorithm_jigdo" or
>"-checksum_algorithm_list" ("checksum_jigdo" or "checksum_list" in
>native xorrisian).
>
>Development by cliffhanger ... i need more popcorn.
*grin* I'm open to changing things like option names here, obviously -
it's your code exposing them at the top level.
Rather than keep you waiting, here's a quick and dirty diff for the
changes I've made so far. I based on 1.4.7 as that was the latest
release I had handy for the merged tree. I even started on some
trivial doc updates, but they're clearly not complete... :-)
--
Steve McIntyre, Cambridge, UK. steve@einval.com
"... the premise [is] that privacy is about hiding a wrong. It's not.
Privacy is an inherent human right, and a requirement for maintaining
the human condition with dignity and respect."
-- Bruce Schneier
--- ./xorriso/lib_mgt.c~ 2017-06-29 22:32:23.000000000 +0100
+++ ./xorriso/lib_mgt.c 2019-11-10 16:16:41.938305902 +0000
@@ -765,8 +765,11 @@
goto jte_failed;
xorriso->libjte_params_given|= 8;
} else if(strcmp(aspect, "md5_path") == 0 ||
- strcmp(aspect, "-md5-list") == 0) {
- ret= libjte_set_md5_path(jte, arg);
+ strcmp(aspect, "-md5-list") == 0 ||
+ strcmp(aspect, "checksum_path") == 0 ||
+ strcmp(aspect, "-checksum-list") == 0)
+ {
+ ret= libjte_set_checksum_path(jte, arg);
if(ret <= 0)
goto jte_failed;
xorriso->libjte_params_given|= 16;
@@ -813,6 +816,21 @@
if(ret <= 0)
goto jte_failed;
xorriso->libjte_params_given|= 2048;
+ } else if(strcmp(aspect, "checksum_algorithm") == 0 ||
+ strcmp(aspect, "-jigdo-checksum-algorithm") == 0) {
+ int ck_size;
+ ret= libjte_set_checksum_algorithm(jte, arg, &ck_size);
+ if(ret <= 0)
+ {
+ msg= libjte_get_next_message(jte);
+ if (msg != NULL)
+ {
+ sprintf(xorriso->info_text, "%s", msg);
+ Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
+ }
+ goto jte_failed;
+ }
+ xorriso->libjte_params_given|= 4096;
} else {
sprintf(xorriso->info_text, "-jigdo: unknown aspect '%s'", aspect);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
--- ./xorriso/xorriso.texi~ 2017-06-29 22:32:23.000000000 +0100
+++ ./xorriso/xorriso.texi 2019-11-10 16:27:37.565512192 +0000
@@ -4311,7 +4311,11 @@
@*
@strong{md5_path} sets the disk_path where to find the .md5 input file.
@*
-Alias: -md5-list
+Alias: -checksum-list
+@*
+@strong{checksums_path} sets the disk_path where to find the checksums input file.
+@*
+Alias: -checksum-list
@*
@strong{min_size} sets the minimum size for a data file to be listed
in the .jigdo file and being a hole in the .template file.
--- ./xorriso/emulators.c~ 2017-06-29 22:32:23.000000000 +0100
+++ ./xorriso/emulators.c 2019-11-10 16:24:08.860491692 +0000
@@ -2091,7 +2091,8 @@
strcmp(argpt, "-jigdo-template-compress") == 0 ||
strcmp(argpt, "-checksum_algorithm_iso") == 0 ||
strcmp(argpt, "-checksum_algorithm_template") == 0 ||
- strcmp(argpt, "-md5-list") == 0) {
+ strcmp(argpt, "-md5-list") == 0 ||
+ strcmp(argpt, "-checksum-list") == 0) {
i++;
ret= Xorriso_option_jigdo(xorriso, argpt, argv[i], 0);
if(ret <= 0)
--- ./xorriso/xorrisofs.texi~ 2017-06-29 22:32:23.000000000 +0100
+++ ./xorriso/xorrisofs.texi 2019-11-10 16:26:09.153079902 +0000
@@ -2035,6 +2035,11 @@
@cindex Jigdo Template Extraction, -md5-list
Set the disk_path where to find the .md5 input file.
@c man .TP
+@item -checksum-list disk_path
+@kindex -checksum-list set path of readable checksums
+@cindex Jigdo Template Extraction, -checksum-list
+Set the disk_path where to find the checksums input file.
+@c man .TP
@item -jigdo-template-compress "gzip"|"bzip2"
@kindex -jigdo-template-compress choose compression algorithm
@cindex Jigdo Template Extraction, -jigdo-template-compress
Reply to: