From c35834e0c1f0aa75047079d2dd065af6e3bd3b56 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 29 Sep 2010 09:24:20 +0000 Subject: [PATCH] New -as mkisofs options -jigdo-* and -md5-list as of genisoimage --- libisoburn/trunk/ChangeLog | 3 +- libisoburn/trunk/configure.ac | 13 +- libisoburn/trunk/libisoburn/libisoburn.ver | 1 + libisoburn/trunk/xorriso/base_obj.c | 15 +++ libisoburn/trunk/xorriso/emulators.c | 43 ++++++- libisoburn/trunk/xorriso/lib_mgt.c | 118 +++++++++++++++++++ libisoburn/trunk/xorriso/opts_i_o.c | 11 ++ libisoburn/trunk/xorriso/parse_exec.c | 2 +- libisoburn/trunk/xorriso/write_run.c | 24 ++++ libisoburn/trunk/xorriso/xorriso.h | 4 + libisoburn/trunk/xorriso/xorriso_private.h | 5 + libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.h | 3 + 13 files changed, 239 insertions(+), 5 deletions(-) diff --git a/libisoburn/trunk/ChangeLog b/libisoburn/trunk/ChangeLog index 78d0f69e..7adfa725 100644 --- a/libisoburn/trunk/ChangeLog +++ b/libisoburn/trunk/ChangeLog @@ -1,6 +1,7 @@ -SVN trunk (to become libisoburn-0.6.r4pl00.tar.gz) +SVN trunk (to become libisoburn-0.6.4.pl00.tar.gz) =============================================================================== * New API calls isoburn_igopt_attach_jte() and isoburn_igopt_detach_jte() +* New -as mkisofs options -jigdo-* and -md5-list as of genisoimage libisoburn-0.6.2.pl00.tar.gz Sat Sep 18 2010 diff --git a/libisoburn/trunk/configure.ac b/libisoburn/trunk/configure.ac index 5b5450bb..29ced732 100644 --- a/libisoburn/trunk/configure.ac +++ b/libisoburn/trunk/configure.ac @@ -195,6 +195,17 @@ else fi AC_SUBST(ZLIB_DEF) +dnl ts B00928 +AC_ARG_ENABLE(libjte, +[ --enable-libjte Enable use of libjte by xorriso, default=yes], + , enable_libjte=yes) +if test "x$enable_libjte" = xyes; then + LIBJTE_DEF="-DXorriso_with_libjtE" + AC_CHECK_HEADER(libjte/libjte.h, AC_CHECK_LIB(jte, libjte_new, , LIBJTE_DEF= ), LIBJTE_DEF= ) +else + LIBJTE_DEF= +fi +AC_SUBST(LIBJTE_DEF) dnl ts B00107 dnl Just for the case that it is necessary to give link option -lcdio not only @@ -333,7 +344,7 @@ else CFLAGS="$CFLAGS -DDEBUG" fi -CFLAGS="$CFLAGS $READLINE_DEF $LIBACL_DEF $XATTR_DEF $EXTF_DEF $EXTF_SUID_DEF $ZLIB_DEF $XORRISO_DVD_OBS_64K" +CFLAGS="$CFLAGS $READLINE_DEF $LIBACL_DEF $XATTR_DEF $EXTF_DEF $EXTF_SUID_DEF $ZLIB_DEF $LIBJTE_DEF $XORRISO_DVD_OBS_64K" AC_CONFIG_FILES([ Makefile diff --git a/libisoburn/trunk/libisoburn/libisoburn.ver b/libisoburn/trunk/libisoburn/libisoburn.ver index 02bb1d60..d2723472 100644 --- a/libisoburn/trunk/libisoburn/libisoburn.ver +++ b/libisoburn/trunk/libisoburn/libisoburn.ver @@ -165,6 +165,7 @@ Xorriso_option_help; Xorriso_option_hide; Xorriso_option_history; Xorriso_option_iso_rr_pattern; +Xorriso_option_jigdo; Xorriso_option_joliet; Xorriso_option_list_delimiter; Xorriso_option_list_formats; diff --git a/libisoburn/trunk/xorriso/base_obj.c b/libisoburn/trunk/xorriso/base_obj.c index fa328ddd..8920c05f 100644 --- a/libisoburn/trunk/xorriso/base_obj.c +++ b/libisoburn/trunk/xorriso/base_obj.c @@ -25,6 +25,11 @@ #include #include #include +#include + +#ifdef Xorriso_with_libjtE +#include +#endif #include "xorriso.h" #include "xorriso_private.h" @@ -215,6 +220,11 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->vol_expiration_time= 0; m->vol_effective_time= 0; m->vol_uuid[0]= 0; + +#ifdef Xorriso_with_libjtE + m->libjte_handle= NULL; +#endif + m->loaded_boot_bin_lba= 0; m->loaded_boot_cat_path[0]= 0; m->allow_graft_points= 0; @@ -417,6 +427,11 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag) Xorriso_destroy_hln_array(m, 0); Xorriso_destroy_di_array(m, 0); +#ifdef Xorriso_with_libjtE + if(m->libjte_handle) + libjte_destroy(&(m->libjte_handle)); +#endif + Xorriso_detach_libraries(m, flag&1); free((char *) m); diff --git a/libisoburn/trunk/xorriso/emulators.c b/libisoburn/trunk/xorriso/emulators.c index 5144bc50..0545f174 100644 --- a/libisoburn/trunk/xorriso/emulators.c +++ b/libisoburn/trunk/xorriso/emulators.c @@ -712,6 +712,14 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag) " -biblio FILE Set Bibliographic filename", " -copyright FILE Set Copyright filename", " -p PREP, -preparer PREP Set Volume preparer", +" -jigdo-jigdo FILE Produce a jigdo .jigdo file as well as the .iso", +" -jigdo-template FILE Produce a jigdo .template file as well as the .iso", +" -jigdo-min-file-size SIZE Minimum size for a file to be listed in the jigdo file", +" -jigdo-force-md5 PATTERN Pattern(s) where files MUST match an externally-supplied MD5sum", +" -jigdo-exclude PATTERN Pattern(s) to exclude from the jigdo file", +" -jigdo-map PATTERN1=PATTERN2", +" Pattern(s) to map paths (e.g. Debian=/mirror/debian)", +" -md5-list FILE File containing MD5 sums of the files that should be checked", " -b FILE, -eltorito-boot FILE", " Set El Torito boot image name", " -eltorito-alt-boot Start specifying alternative El Torito boot parameters", @@ -853,7 +861,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, int *delay_opt_list= NULL, delay_opt_count= 0; char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL]; char *ept, *add_pt, eff_path[SfileadrL], indev[SfileadrL+8], msc[80], *cpt; - char *boot_path; + char *boot_path, *jkey; static char *sort_weight_args[4]= {"", "-exec", "sort_weight", ""}; strcpy(ra_text, xorriso->report_about_text); @@ -1310,7 +1318,40 @@ not_enough_args:; if(ret<=0) goto problem_handler_2; file_mode= mode_or; + } else if(strncmp(argv[i], "-jigdo-", 7) == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + cpt= argv[i - 1] + 7; + if(strcmp(cpt, "jigdo") == 0) + jkey= "jigdo_path"; + else if(strcmp(cpt, "template") == 0) + jkey= "template_path"; + else if(strcmp(cpt, "min-file-size") == 0) + jkey= "min_size"; + else if(strcmp(cpt, "force-md5") == 0) + jkey= "demand_md5"; + else if(strcmp(cpt, "exclude") == 0) + jkey= "exclude"; + else if(strcmp(cpt, "map") == 0) + jkey= "mapping"; + else { + i--; + goto is_unknown_option_2; + } + ret= Xorriso_jigdo_interpreter(xorriso, jkey, argv[i], 0); + if(ret <= 0) + goto problem_handler_2; + } else if(strncmp(argv[i], "-md5-list", 7) == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Xorriso_jigdo_interpreter(xorriso, "md5_path", argv[i], 0); + if(ret <= 0) + goto problem_handler_2; + } else if(argv[i][0]=='-' && argv[i][1]!=0) { +is_unknown_option_2:; ret= Xorriso_genisofs_count_args(xorriso, argc - i, argv + i, &count, 1); if(ret > 0) { sprintf(xorriso->info_text, "-as %s: Unsupported option %s", diff --git a/libisoburn/trunk/xorriso/lib_mgt.c b/libisoburn/trunk/xorriso/lib_mgt.c index 30825170..9efe041d 100644 --- a/libisoburn/trunk/xorriso/lib_mgt.c +++ b/libisoburn/trunk/xorriso/lib_mgt.c @@ -23,11 +23,15 @@ #include #include #include +#include /* for -charset */ #include #include +#ifdef Xorriso_with_libjtE +#include +#endif #include "xorriso.h" #include "xorriso_private.h" @@ -521,3 +525,117 @@ int Xorriso_preparer_string(struct XorrisO *xorriso, char xorriso_id[129], return(1); } + +#ifdef Xorriso_with_libjtE + +int Xorriso_assert_jte_handle(struct XorrisO *xorriso, int flag) +{ + int ret; + + if(xorriso->libjte_handle == NULL) { + ret= libjte_new(&(xorriso->libjte_handle), 0); + if(ret <= 0 || xorriso->libjte_handle == NULL) + return(0); + } + return(1); +} + +#endif /* Xorriso_with_libjtE */ + + +int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg, + int flag) +{ + +#ifdef Xorriso_with_libjtE + + int ret, num; + struct libjte_env *jte; + + if(strcmp(aspect, "clear") == 0) { + if(xorriso->libjte_handle != NULL) + libjte_destroy(&(xorriso->libjte_handle)); + return(1); + } + ret= Xorriso_assert_jte_handle(xorriso, 0); + if(ret <= 0) + return(ret); + jte= xorriso->libjte_handle; + + if(strcmp(aspect, "verbose") == 0) { + if(strcmp(arg, "on") == 0) + libjte_set_verbose(jte, 1); + else if(strcmp(arg, "off") == 0) + libjte_set_verbose(jte, 0); + else + goto bad_arg; + } else if(strcmp(aspect, "template_path") == 0) { + ret= libjte_set_template_out(jte, arg); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "jigdo_path") == 0) { + ret= libjte_set_jjigdo_out(jte, arg); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "md5_path") == 0) { + ret= libjte_set_jmd5_list(jte, arg); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "min_size") == 0) { + num= Scanf_io_size(arg, 0); + ret= libjte_set_jte_min_size(jte, num); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "checksum_iso") == 0) { + ret= libjte_set_checksum_algo_iso(jte, arg); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "checksum_template") == 0) { + ret= libjte_set_checksum_algo_tmpl(jte, arg); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "compression") == 0) { + ret= libjte_set_jte_template_compression(jte, arg); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "exclude") == 0) { + ret= libjte_add_exclude(jte, arg); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "demand_md5") == 0) { + ret= libjte_add_include(jte, arg); + if(ret <= 0) + goto jte_failed; + } else if(strcmp(aspect, "mapping") == 0) { + ret= libjte_add_mapping(jte, arg); + if(ret <= 0) + goto jte_failed; + } else { + sprintf(xorriso->info_text, "-jigdo: unknown aspect '%s'", aspect); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); + +bad_arg: + sprintf(xorriso->info_text, "-jigdo %s : unknown argument '%s'", aspect, arg); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + +jte_failed: + sprintf(xorriso->info_text, "Experienced libjte failure with: -jigdo %s %s", + aspect, arg); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + +#else /* Xorriso_with_libjtE */ + + sprintf(xorriso->info_text, + "Jigdo Template Extraction was not enabled at compile time"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + +#endif /* ! Xorriso_with_libjtE */ + +} + diff --git a/libisoburn/trunk/xorriso/opts_i_o.c b/libisoburn/trunk/xorriso/opts_i_o.c index 9ab745c5..a0833b33 100644 --- a/libisoburn/trunk/xorriso/opts_i_o.c +++ b/libisoburn/trunk/xorriso/opts_i_o.c @@ -47,6 +47,17 @@ int Xorriso_option_iso_rr_pattern(struct XorrisO *xorriso, char *mode,int flag) } +/* Option -jigdo aspect argument */ +int Xorriso_option_jigdo(struct XorrisO *xorriso, char *aspect, char *arg, + int flag) +{ + int ret; + + ret= Xorriso_jigdo_interpreter(xorriso, aspect, arg, 0); + return(ret); +} + + /* Option -joliet "on"|"off" */ int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag) { diff --git a/libisoburn/trunk/xorriso/parse_exec.c b/libisoburn/trunk/xorriso/parse_exec.c index 9d13cb50..eca7f074 100644 --- a/libisoburn/trunk/xorriso/parse_exec.c +++ b/libisoburn/trunk/xorriso/parse_exec.c @@ -478,7 +478,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, static char arg2_commands[][40]= { "assert_volid","boot_image","compare","compare_r","drive_class", "errfile_log","error_behavior","extract","extract_single", - "load","logfile", + "jigdo","load","logfile", "map","map_single","page","return_with", "scdbackup_tag","update","update_r","volume_date", "" diff --git a/libisoburn/trunk/xorriso/write_run.c b/libisoburn/trunk/xorriso/write_run.c index f163a0b2..45ece519 100644 --- a/libisoburn/trunk/xorriso/write_run.c +++ b/libisoburn/trunk/xorriso/write_run.c @@ -25,6 +25,11 @@ #include #include +#include + +#ifdef Xorriso_with_libjtE +#include +#endif #include "xorriso.h" #include "xorriso_private.h" @@ -138,6 +143,12 @@ no_track:; } else if(padding < xorriso->alignment) padding= xorriso->alignment; } + +#ifdef Xorriso_with_libjtE + if(xorriso->libjte_handle != NULL) + padding= 0; /* JTE : no multi-session, no_emul_toc, and no padding */ +#endif /* ! Xorriso_with_libjtE */ + burn_track_define_data(tracks[0], 0, padding * 2048, 0, BURN_MODE1); Xorriso_process_msg_queues(xorriso,0); @@ -733,6 +744,19 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) xorriso->vol_expiration_time, xorriso->vol_effective_time, xorriso->vol_uuid); +#ifdef Xorriso_with_libjtE + if(xorriso->libjte_handle) { + ret= libjte_set_outfile(xorriso->libjte_handle, xorriso->outdev); + if(ret <= 0) + goto ex; + + /* >>> Check whether the mandatory parameters are set */; + + isoburn_igopt_attach_jte(sopts, xorriso->libjte_handle); + } +#endif /* Xorriso_with_libjtE */ + + /* Make final abort check before starting expensive activities */ ret= Xorriso_eval_problem_status(xorriso, 1, 0); if(ret<0) diff --git a/libisoburn/trunk/xorriso/xorriso.h b/libisoburn/trunk/xorriso/xorriso.h index 6cbb9c71..e5d40e48 100644 --- a/libisoburn/trunk/xorriso/xorriso.h +++ b/libisoburn/trunk/xorriso/xorriso.h @@ -854,6 +854,10 @@ int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag); int Xorriso_option_iso_rr_pattern(struct XorrisO *xorriso, char *mode, int flag); +/* Option -jigdo aspect argument */ +int Xorriso_option_jigdo(struct XorrisO *xorriso, char *aspect, char *arg, + int flag); + /* Option -joliet "on"|"off" */ int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag); diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index 4cb73fb9..4a68a4d6 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -326,6 +326,11 @@ struct XorrisO { /* the global context of xorriso */ and timezone 0 */ char vol_uuid[17]; +#ifdef Xorriso_with_libjtE + /* Parameters and state of Jigdo Template Export environment */ + struct libjte_env *libjte_handle; +#endif + /* LBA of boot image after image loading */ int loaded_boot_bin_lba; /* Path of the catalog node after image loading */ diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index b42fe8d6..bd8074ab 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.09.29.091541" +#define Xorriso_timestamP "2010.09.29.092348" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.h b/libisoburn/trunk/xorriso/xorrisoburn.h index f1aedc36..f19bb10a 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.h +++ b/libisoburn/trunk/xorriso/xorrisoburn.h @@ -540,5 +540,8 @@ int Xorriso_set_hidden(struct XorrisO *xorriso, void *in_node, char *path, int Xorriso_preparer_string(struct XorrisO *xorriso, char xorriso_id[129], int flag); +int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg, + int flag); + #endif /* Xorrisoburn_includeD */