Author: jsuchome Date: Mon Oct 29 15:19:22 2007 New Revision: 41617 URL: http://svn.opensuse.org/viewcvs/yast?rev=41617&view=rev Log: - gpg needs --batch parameter to run non-interactively (#336680) - ask for reentering password when gpg fails (#297168) - 2.16.1 Modified: trunk/add-on-creator/VERSION trunk/add-on-creator/package/yast2-add-on-creator.changes trunk/add-on-creator/src/AddOnCreator.ycp trunk/add-on-creator/src/complex.ycp Modified: trunk/add-on-creator/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/VERSION?rev=41617&r1=41616&r2=41617&view=diff ============================================================================== --- trunk/add-on-creator/VERSION (original) +++ trunk/add-on-creator/VERSION Mon Oct 29 15:19:22 2007 @@ -1 +1 @@ -2.16.0 +2.16.1 Modified: trunk/add-on-creator/package/yast2-add-on-creator.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/package/yast2-add-on-creator.changes?rev=41617&r1=41616&r2=41617&view=diff ============================================================================== --- trunk/add-on-creator/package/yast2-add-on-creator.changes (original) +++ trunk/add-on-creator/package/yast2-add-on-creator.changes Mon Oct 29 15:19:22 2007 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Oct 29 15:04:37 CET 2007 - jsuchome@suse.cz + +- gpg needs --batch parameter to run non-interactively (#336680) +- ask for reentering password when gpg fails (#297168) +- 2.16.1 + +------------------------------------------------------------------- Mon Oct 1 11:23:59 CEST 2007 - jsuchome@suse.cz - create patterns with correct key ordering (#328816) Modified: trunk/add-on-creator/src/AddOnCreator.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/AddOnCreator.ycp?rev=41617&r1=41616&r2=41617&view=diff ============================================================================== --- trunk/add-on-creator/src/AddOnCreator.ycp (original) +++ trunk/add-on-creator/src/AddOnCreator.ycp Mon Oct 29 15:19:22 2007 @@ -38,6 +38,7 @@ import "Arch"; import "Directory"; import "FileUtils"; +import "Label"; import "Mode"; import "Package"; import "PackageSystem"; @@ -1843,6 +1844,55 @@ } /** + * Report the error with failed gpg and ask for possible new + * entering of pw + * @string error message from gpg + */ +string AskForPassphrase (string error) { + + string pw = nil; + UI::OpenDialog (`opt(`decorated), `HBox (`HSpacing (0.5), + `VBox ( + `HSpacing (70), + // error label + `Label (_("Signing of the product failed.")), + error == "" ? `VSpacing (0) : `RichText (mergestring (splitstring ( + String::EscapeTags (error),"\n"),"<br>")), + `HBox ( + `CheckBox (`id (`again), `opt (`notify), + // checkbox label + _("Try again with different passphrase")), + `Password (`id (`pw1), "") + ), + `PushButton (`id(`ok),`opt(`key_F10), Label::OKButton()), + `VSpacing (0.5) + ), `HSpacing (0.5)) + ); + UI::ChangeWidget (`id (`pw1), `Enabled, false); + + any ret = `cancel; + repeat + { + ret = UI::UserInput (); + if (ret == `again) + { + boolean enabled = (boolean)UI::QueryWidget(`id(`pw1), `Enabled); + UI::ChangeWidget (`id (`pw1), `Enabled, !enabled); + } + if (ret == `ok) + { + if (UI::QueryWidget (`id(`pw1), `Enabled) == true) + { + pw = (string) UI::QueryWidget (`id(`pw1), `Value); + } + } + } until (ret == `ok || ret == `cancel); + + UI::CloseDialog (); + return pw; +} + +/** * Sign the add-on */ global boolean SignAddOn (string base_path, string key) { @@ -1882,6 +1932,36 @@ deletechars (out["stdout"]:"", "\n"), base_path); SCR::Execute (.target.bash, command, $["LANG" : "C"]); }); + while (true) + { + // sign the content file + SCR::Execute (.target.bash, sformat ("rm -f '%1/content.asc'", + base_path)); + out = (map) SCR::Execute (.target.bash_output, sformat("gpg --batch --no-tty --passphrase-fd 0 --detach-sign -u %1 -a '%2/content' < %3", + local_key, base_path, pw_path) + ); + if (out["exit"]:0 != 0) + { + if (Mode::commandline ()) + Report::Error (out["stderr"]:""); + else + { + passphrase = AskForPassphrase (out["stderr"]:""); + if (passphrase != nil) + { + SCR::Write (.target.string, pw_path, passphrase); + continue; + } + } + SCR::Execute (.target.remove, pw_path); + return false; + } + else break; + } + + SCR::Execute (.target.bash, + sformat("gpg --export -a %1 > '%2/content.key'",local_key, base_path)); + // sign the packages if (resign_packages) { @@ -1901,24 +1981,6 @@ SCR::Execute (.target.bash, sformat ("rm %1", expect)); } - // sign the content file - SCR::Execute (.target.bash, sformat ("rm -f '%1/content.asc'", base_path)); - out = (map) SCR::Execute (.target.bash_output, sformat(" - gpg --no-tty --passphrase-fd 0 --detach-sign -u %1 -a '%2/content' < %3", - local_key, base_path, pw_path) - ); - if (out["exit"]:0 != 0) - { - if (Mode::commandline ()) - Report::Error (out["stderr"]:""); - else - // error message - Popup::ErrorDetails (_("Signing of the product failed."), out["stderr"]:""); - return false; - } - - SCR::Execute (.target.bash, - sformat("gpg --export -a %1 > '%2/content.key'",local_key, base_path)); // sign products file string products_path = full_media_paths[0]:"" + "/products"; @@ -1926,7 +1988,7 @@ { SCR::Execute (.target.bash, sformat ("rm -f '%1.asc'", products_path)); SCR::Execute (.target.bash, - sformat("gpg --no-tty --passphrase-fd 0 --detach-sign -u %1 -a '%2' < %3", + sformat("gpg --batch --no-tty --passphrase-fd 0 --detach-sign -u %1 -a '%2' < %3", local_key, products_path, pw_path)); SCR::Execute (.target.bash, sformat("gpg --export -a %1 > '%2.key'", local_key,products_path)); @@ -1999,6 +2061,8 @@ _("Copy the packages"), // Progress stage _("Create MD5 sums"), + // Progress stage + _("Sign resulting product"), ]; list<string> steps = [ // Progress step @@ -2011,6 +2075,8 @@ _("Copying the packages..."), // Progress step _("Creating MD5 sums..."), + // Progress stage + _("Signing resulting product..."), ]; if (iso) @@ -2100,6 +2166,8 @@ CreateMD5SUMS (base_output_path); } + Progress::NextStage(); + if (!SignAddOn (base_output_path, gpg_key)) return false; Modified: trunk/add-on-creator/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/complex.ycp?rev=41617&r1=41616&r2=41617&view=diff ============================================================================== --- trunk/add-on-creator/src/complex.ycp (original) +++ trunk/add-on-creator/src/complex.ycp Mon Oct 29 15:19:22 2007 @@ -778,8 +778,13 @@ table_type == "content" ? entry["key"]:"" : entry["label"]:""); any value = entry["value"]:nil; - if (table_type == "content" && value == nil) - value = ""; + if (value == nil) + { + if (table_type == "content") + value = ""; + if (type == "package-list") + value = []; + } term cont = `TextEntry (`id (`main), label, sformat("%1", value)); symbol w_id = `main; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org