Mailinglist Archive: opensuse-commit (1059 mails)

< Previous Next >
commit yast2-packager
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Tue, 15 Jan 2008 08:52:04 +0100
  • Message-id: <20080115075204.76BF96781B8@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package yast2-packager
checked in at Tue Jan 15 08:52:04 CET 2008.

--------
--- yast2-packager/yast2-packager.changes 2008-01-04 13:09:07.000000000
+0100
+++ /mounts/work_src_done/STABLE/yast2-packager/yast2-packager.changes
2008-01-14 17:32:38.293172000 +0100
@@ -1,0 +2,12 @@
+Mon Jan 14 17:25:07 CET 2008 - lslezak@xxxxxxx
+
+- display details about the GPG key selected for import, UI fully
+ works, importing/removing a key works in Write()
+- 2.16.14
+
+-------------------------------------------------------------------
+Thu Jan 10 13:20:04 CET 2008 - lslezak@xxxxxxx
+
+- added preliminary support for GPG key management (FATE #300754)
+
+-------------------------------------------------------------------

Old:
----
yast2-packager-2.16.13.tar.bz2

New:
----
yast2-packager-2.16.14.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.g13304/_old 2008-01-15 08:50:58.000000000 +0100
+++ /var/tmp/diff_new_pack.g13304/_new 2008-01-15 08:50:58.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-packager (Version 2.16.13)
+# spec file for package yast2-packager (Version 2.16.14)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,23 +11,25 @@
# norootforbuild

Name: yast2-packager
-Version: 2.16.13
+Version: 2.16.14
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-packager-2.16.13.tar.bz2
+Source0: yast2-packager-2.16.14.tar.bz2
Prefix: /usr
BuildRequires: gcc-c++ libxcrypt-devel perl-XML-Writer update-desktop-files
yast2-country-data yast2-devtools yast2-slp yast2-testsuite yast2-xml
# Progress::Subprogress*()
BuildRequires: yast2 >= 2.16.17
+# New functions: GPG key management
+BuildRequires: yast2-pkg-bindings >= 2.16.10
# Module: OneClickInstallStandard
Requires: perl-XML-Bare yast2-perl-bindings
# Newly added RPM
Requires: yast2-country-data >= 2.16.3
Requires: yast2-installation >= 2.15.12
-# New function: Pkg::SourceProvideDirectory
-Requires: yast2-pkg-bindings >= 2.15.38
+# New functions: GPG key management
+Requires: yast2-pkg-bindings >= 2.16.10
# Progress::Subprogress*()
Requires: yast2 >= 2.16.17
# unzipping license file
@@ -63,7 +65,7 @@
Arvin Schnell <arvin@xxxxxxx>

%prep
-%setup -n yast2-packager-2.16.13
+%setup -n yast2-packager-2.16.14

%build
%{prefix}/bin/y2tool y2autoconf
@@ -99,6 +101,12 @@
%{prefix}/lib/YaST2/servers_non_y2/ag_*
%doc %{prefix}/share/doc/packages/yast2-packager
%changelog
+* Mon Jan 14 2008 - lslezak@xxxxxxx
+- display details about the GPG key selected for import, UI fully
+ works, importing/removing a key works in Write()
+- 2.16.14
+* Thu Jan 10 2008 - lslezak@xxxxxxx
+- added preliminary support for GPG key management (FATE #300754)
* Fri Jan 04 2008 - lslezak@xxxxxxx
- PackageCallbacks: do not remove the subprogress widget, try to
reuse it later if possible (#350584)

++++++ yast2-packager-2.16.13.tar.bz2 -> yast2-packager-2.16.14.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/configure
new/yast2-packager-2.16.14/configure
--- old/yast2-packager-2.16.13/configure 2008-01-04 13:08:29.000000000
+0100
+++ new/yast2-packager-2.16.14/configure 2008-01-14 17:30:30.000000000
+0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for yast2-packager 2.16.13.
+# Generated by GNU Autoconf 2.61 for yast2-packager 2.16.14.
#
# Report bugs to <http://bugs.opensuse.org/>.
#
@@ -574,8 +574,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-packager'
PACKAGE_TARNAME='yast2-packager'
-PACKAGE_VERSION='2.16.13'
-PACKAGE_STRING='yast2-packager 2.16.13'
+PACKAGE_VERSION='2.16.14'
+PACKAGE_STRING='yast2-packager 2.16.14'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'

ac_unique_file="RPMNAME"
@@ -1197,7 +1197,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures yast2-packager 2.16.13 to adapt to many kinds of
systems.
+\`configure' configures yast2-packager 2.16.14 to adapt to many kinds of
systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

@@ -1268,7 +1268,7 @@

if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-packager 2.16.13:";;
+ short | recursive ) echo "Configuration of yast2-packager 2.16.14:";;
esac
cat <<\_ACEOF

@@ -1346,7 +1346,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-yast2-packager configure 2.16.13
+yast2-packager configure 2.16.14
generated by GNU Autoconf 2.61

Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1360,7 +1360,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

-It was created by yast2-packager $as_me 2.16.13, which was
+It was created by yast2-packager $as_me 2.16.14, which was
generated by GNU Autoconf 2.61. Invocation command line was

$ $0 $@
@@ -2181,7 +2181,7 @@

# Define the identity of the package.
PACKAGE='yast2-packager'
- VERSION='2.16.13'
+ VERSION='2.16.14'


cat >>confdefs.h <<_ACEOF
@@ -2408,7 +2408,7 @@



-VERSION="2.16.13"
+VERSION="2.16.14"
RPMNAME="yast2-packager"
MAINTAINER="Ladislav Slezak <lslezak@xxxxxxx>"

@@ -3303,7 +3303,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by yast2-packager $as_me 2.16.13, which was
+This file was extended by yast2-packager $as_me 2.16.14, which was
generated by GNU Autoconf 2.61. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
@@ -3346,7 +3346,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-packager config.status 2.16.13
+yast2-packager config.status 2.16.14
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //;
s/[\\""\`\$]/\\\\&/g'`\\"

diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/configure.in
new/yast2-packager-2.16.14/configure.in
--- old/yast2-packager-2.16.13/configure.in 2008-01-04 13:08:24.000000000
+0100
+++ new/yast2-packager-2.16.14/configure.in 2008-01-14 17:30:26.000000000
+0100
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.15.9 - DO NOT EDIT! --
dnl (edit configure.in.in instead)

-AC_INIT(yast2-packager, 2.16.13, http://bugs.opensuse.org/, yast2-packager)
+AC_INIT(yast2-packager, 2.16.14, http://bugs.opensuse.org/, yast2-packager)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])

@@ -17,7 +17,7 @@
AM_INIT_AUTOMAKE(tar-ustar) dnl searches for some needed programs

dnl Important YaST2 variables
-VERSION="2.16.13"
+VERSION="2.16.14"
RPMNAME="yast2-packager"
MAINTAINER="Ladislav Slezak <lslezak@xxxxxxx>"

diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/src/clients/key_manager.ycp
new/yast2-packager-2.16.14/src/clients/key_manager.ycp
--- old/yast2-packager-2.16.13/src/clients/key_manager.ycp 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-packager-2.16.14/src/clients/key_manager.ycp 2008-01-10
13:18:19.000000000 +0100
@@ -0,0 +1,102 @@
+/**
+ * File: key_manager.ycp
+ *
+ * Author: Ladislav Slezak <lslezak@xxxxxxxxxx>
+ *
+ * Purpose: Manages GPG keys in the package manager
+ *
+ * $Id$
+ */
+
+{
+textdomain "packager";
+
+import "PackageCallbacks";
+import "Wizard";
+import "Label";
+import "Report";
+import "CommandLine";
+import "Popup";
+import "PackageLock";
+import "KeyManager";
+import "Installation";
+import "Sequencer";
+
+include "packager/key_manager_dialogs.ycp";
+
+symbol Read()
+{
+ // TODO: the check dialog contains only [Continue] [Retry] buttons
+ // there is no [Abort] (#293356)
+ if (!PackageLock::Check())
+ {
+ // error message - SW management is already in use, access denied
+ // the yast module cannot be started
+ Report::Error(_("The GPG key management module cannot work
+without access to the software management system."));
+ Wizard::CloseDialog ();
+ return `abort;
+ }
+
+ // init the target - read the keys
+ if (!Pkg::TargetInitialize(Installation::destdir))
+ {
+ y2error("The target cannot be initialized, aborting...");
+ return `abort;
+ }
+
+ // read the current keys
+ if (!KeyManager::Read())
+ {
+ y2error("The key configuration cannot be read, aborting...");
+ return `abort;
+ }
+
+ return `next;
+}
+
+// main function - start the workflow
+symbol Main()
+{
+ Wizard::CreateDialog();
+ Wizard::SetDesktopIcon("sw_source");
+ // dialog caption
+ Wizard::SetContents(_("Initializing..."), `Empty (), "", false, true);
+
+ map<string,any> aliases = $[
+ "read" : ``(Read()),
+ "edit" : ``(RunGPGKeyMgmt(true)),
+// TODO "write" : Write()
+ ];
+
+ map sequence = $[
+ "ws_start" : "read",
+ "read" : $[
+ `next : "edit"
+ ],
+ "edit" : $[
+ `abort : `abort,
+ `next : `next,
+ ],
+// "write" : $[
+// `next : "summary",
+// `abort : `abort,
+// ],
+ ];
+
+ y2milestone ("Starting the key management sequence");
+ symbol ret = Sequencer::Run (aliases, sequence);
+
+ Wizard::CloseDialog ();
+ return ret;
+}
+
+map cmdline_description = $[
+ "id" : "key_mgmgt",
+ "guihandler" : Main
+];
+
+return CommandLine::Run(cmdline_description);
+
+}
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/src/clients/repositories.ycp
new/yast2-packager-2.16.14/src/clients/repositories.ycp
--- old/yast2-packager-2.16.13/src/clients/repositories.ycp 2007-11-28
16:11:57.000000000 +0100
+++ new/yast2-packager-2.16.14/src/clients/repositories.ycp 2008-01-10
15:51:56.000000000 +0100
@@ -7,7 +7,7 @@
* Purpose:
* Adding, removing and prioritizing of repositories for packagemanager.
*
- * $Id: repositories.ycp 42435 2007-11-27 12:53:11Z locilka $
+ * $Id: repositories.ycp 43535 2008-01-10 14:51:56Z lslezak $
*
*/

@@ -39,6 +39,7 @@
import "Product";

include "packager/inst_source_dialogs.ycp";
+ include "packager/key_manager_dialogs.ycp";

integer numSources = 0;

@@ -517,6 +518,8 @@
// store in the persistent libzypp storage
success = success && Pkg::SourceSaveAll(); // #176013

+ success = success && KeyManager::Write();
+
return success;
}

@@ -570,9 +573,9 @@
// label
`Left (`Label (_("Properties"))),
// check box
- `Left (`CheckBox (`id (`enable),
`opt (`notify), _("Enabled"))),
+ `Left (`CheckBox (`id (`enable),
`opt (`notify), _("&Enabled"))),
// check box
- `Left (`CheckBox (`id
(`autorefresh), `opt (`notify), _("Automatically Refresh"))),
+ `Left (`CheckBox (`id
(`autorefresh), `opt (`notify), _("Automatically &Refresh"))),
`VSpacing (0.4),
(have_rug) ?
`Left (`CheckBox (`id (`zmdsync),
@@ -604,6 +607,7 @@
`item(`id(`set_alias), setAliasButtonLabel)
])
*/
+ `PushButton (`id (`key_mgr), _("&GPG Keys...")),
`PushButton (`id (`refresh), refreshButtonLabel )
),
`VSpacing( 0.5 )
@@ -749,6 +753,13 @@
}
}
}
+ else if (input == `key_mgr)
+ {
+ exit = true;
+ //return `key_mgr;
+ // start the GPG key manager
+ //RunGPGKeyMgmt();
+ }
else
{
current = (integer) UI::QueryWidget( `id( `table ), `CurrentItem );
@@ -1028,6 +1039,9 @@
}
}

+ // read known GPG keys
+ KeyManager::Read();
+
sourceStatesIn = Pkg::SourceEditGet();
y2milestone( "Found repositories: %1", sourceStatesIn);
sourceStatesOut = sourceStatesIn;
@@ -1036,7 +1050,8 @@
"summary" : ``(SummaryDialog ()),
"type" : ``(TypeDialog()),
"edit" : ``(EditDialog ()),
- "store" : ``(StoreSource ())
+ "store" : ``(StoreSource ()),
+ "keymgr" : [``(RunGPGKeyMgmt(false)), true]
];

map sequence = $[
@@ -1044,9 +1059,14 @@
"summary" : $[
`add : "type",
`edit : "edit",
+ `key_mgr : "keymgr",
`abort : `abort,
`next : `next,
],
+ "keymgr" : $[
+ `next : "summary",
+ `abort : "summary"
+ ],
"type" : $[
`next : "edit",
`finish : "store",
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore
old/yast2-packager-2.16.13/src/include/key_manager_dialogs.ycp
new/yast2-packager-2.16.14/src/include/key_manager_dialogs.ycp
--- old/yast2-packager-2.16.13/src/include/key_manager_dialogs.ycp
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-packager-2.16.14/src/include/key_manager_dialogs.ycp
2008-01-14 16:20:15.000000000 +0100
@@ -0,0 +1,410 @@
+/**
+ * File: key_manager.ycp
+ *
+ * Author: Ladislav Slezak <lslezak@xxxxxxxxxx>
+ *
+ * Purpose: Manages GPG keys in the package manager
+ *
+ * $Id$
+ */
+
+{
+
+textdomain "packager";
+
+import "Wizard";
+import "WizardHW";
+import "Label";
+import "Popup";
+import "KeyManager";
+import "String";
+import "FileUtils";
+
+boolean gpg_mgr_standalone_mode = false;
+
+/**
+ * Creates a summary table with GPG key configuration
+ * @return list table contents
+ */
+list<map<string,any> > createHWTable()
+{
+ list<map<string,any> > ret = [];
+
+ foreach(map<string,any> key, KeyManager::GetKeys(),
+ {
+ list<string> descr = [];
+
+ // escape <> characters in the key name
+ // translators: %1 is GPG key name (e.g. 'SuSE Package Signing Key
<build@xxxxxxx>')
+ descr = add(descr, sformat(_("Name: %1"),
String::EscapeTags(key["name"]:"")));
+ // %1 is a GPG Key fingerprint (e.g.
'79C179B2E1C820C1890F9994A84EDAE89C800ACA')
+ descr = add(descr, sformat(_("Finger Print: %1"),
key["fingerprint"]:""));
+ // %1 is the date when the GPG key was generated (e.g. '9.10.2000')
+ descr = add(descr, sformat(_("Created: %1"), key["created"]:""));
+
+ integer expires = key["expires_raw"]:0;
+ string exp_str = (expires > 0 && time() > expires) ?
+ // %1 is the date when the GPG key expired (e.g. '10.6.2005'),
display the date in red
+ sformat(_("Expires: <font color = \"red\">%1</font> (The key is
expired.)"), key["expires"]:"")
+ // summary string - the GPG key never expires
+ : (expires == 0 ? _("The key never expires.")
+ // %1 is the date when the GPG key expires (e.g.
'21.3.2015') or "Never"
+ : sformat(_("Expires: %1"), key["expires"]:"")
+ );
+
+ descr = add(descr, exp_str);
+
+ map<string,any> r = $[
+ "id" : key["id"]:"",
+ "table_descr" : [ key["trusted"]:false ? UI::Glyph (`CheckMark)
: "",
+ key["id"]:"", key["name"]:"" ],
+ "rich_descr" :
WizardHW::CreateRichTextDescription(sformat(_("Key: %1"), key["id"]:""), descr)
+ ];
+
+ ret = add(ret, r);
+ }
+ );
+
+ y2debug("table content: %1", ret);
+
+ return ret;
+}
+
+/**
+ * Set/refresh the table content
+ */
+void SetItems(string selected_key)
+{
+ // create description for WizardHW
+ list<map<string,any> > items = createHWTable();
+ y2debug("items: %1", items);
+
+ WizardHW::SetContents(items);
+
+ if (selected_key != nil)
+ {
+ // set the previously selected key
+ WizardHW::SetSelectedItem(selected_key);
+ }
+}
+
+/**
+ * Display a dialog for editing the properties of the selected GPG key
+ */
+boolean EditKeyProperties(map<string,any> key)
+{
+ UI::OpenDialog(
+ `MarginBox(1, 0.3,
+ `VBox(
+ `Frame(_("GPG Key Properties"),
+ `VBox(
+ `Left(`Label(sformat(_("Key ID: %1"), key["id"]:""))),
+ `Left(`Label(sformat(_("Name: %1"), key["name"]:""))),
+ `VSpacing(0.3),
+ `Left(`CheckBox(`id(`trusted), _("&The Key is
Trusted"), key["trusted"]:false)),
+ `VSpacing(0.2)
+ )
+ ),
+ `VSpacing(0.2),
+ `HBox(
+ `PushButton(`id(`ok),`opt(`key_F10, `default),
Label::OKButton()),
+ `HSpacing(2),
+ `PushButton(`id(`cancel), `opt(`key_F9),
Label::CancelButton())
+ )
+ )
+ )
+ );
+
+ symbol ui = (symbol)UI::UserInput();
+ boolean ret = false;
+
+ if (ui == `ok)
+ {
+ boolean new_value = (boolean)UI::QueryWidget(`id(`trusted), `Value);
+ if (new_value != key["trusted"]:false)
+ {
+ key["trusted"] = new_value;
+ KeyManager::ModifyKey(key);
+ }
+
+ ret = true;
+ }
+
+ UI::CloseDialog();
+
+ return ret;
+}
+
+// remember the details about the added key from AddGPGKey(),
+// the details are displayed in NewKeySummary()
+map<string,any> added_key = $[];
+
+void refreshNewKeyDetails(string file)
+{
+ map<string,any> key = $[];
+
+ // at first check whether the file exists at all
+ if (FileUtils::Exists(file))
+ {
+ // check whether the file contains a valid GPG key
+ key = Pkg::CheckGPGKeyFile(file);
+ y2milestone("File content: %1", key);
+ }
+
+ UI::ChangeWidget(`id(`key_id), `Value, key["id"]:"");
+ UI::ChangeWidget(`id(`key_name), `Value, key["name"]:"");
+ UI::ChangeWidget(`id(`key_fp), `Value, key["fingerprint"]:"");
+ UI::ChangeWidget(`id(`key_creadted), `Value, key["created"]:"");
+ UI::ChangeWidget(`id(`key_expires), `Value, key["expires"]:"");
+}
+
+/**
+ * Display a dialog for adding a GPG key
+ */
+symbol AddGPGKey()
+{
+ term contents = `VBox(
+ `Frame(`id(`fr), _("Select a GPG Key"),
+ `MarginBox(1, 0.3,
+ `VBox(
+ `HBox(
+ `TextEntry(`id(`file), `opt(`notify,`immediate),
Label::FileName()),
+ `VBox(
+ `Label(""),
+ `PushButton(`id(`browse), Label::BrowseButton())
+ )
+ ),
+ `VSpacing(0.2),
+ `Left(`CheckBox(`id(`trusted), _("&The Key is Trusted"),
false)),
+ `VSpacing(0.3)
+ )
+ )
+ ),
+ `VSpacing(1),
+ `Frame(_("Properties of the GPG Key"),
+ `MarginBox(1, 0.3,
+ `HBox(
+ `HSquash(
+ `VBox(
+ `Left(`Label(_("Key ID: "))),
+ `Left(`Label(_("Name: "))),
+ `Left(`Label(_("Finger Print: "))),
+ `Left(`Label(_("Created: "))),
+ `Left(`Label(_("Expires: ")))
+ )
+ ),
+ `VBox(
+ `Label(`id(`key_id), `opt(`hstretch), ""),
+ `Label(`id(`key_name), `opt(`hstretch), ""),
+ `Label(`id(`key_fp), `opt(`hstretch), ""),
+ `Label(`id(`key_creadted), `opt(`hstretch), ""),
+ `Label(`id(`key_expires), `opt(`hstretch), "")
+ )
+ )
+ )
+ )
+ );
+
+ // dialog caption
+ string title = _("Adding a GPG Public Key");
+
+ // help
+ string help_text = _("<p>
+In this dialog, manage known GPG public keys.</p>");
+
+ help_text = help_text + _("<p>
+<b>Adding a New GPG Key</b><br>
+To add a new GPG key specify the path to the key file.
+Check the <B>Trusted</B> check box if the key is trusted.
+</p>");
+
+ Wizard::SetNextButton(`next, Label::OKButton());
+ Wizard::SetContents(title, contents, help_text, true, true);
+
+ symbol ret = nil;
+
+ do
+ {
+ ret = (symbol) UI::UserInput();
+
+ y2debug("UserInput: %1", ret);
+
+ if (ret == `browse)
+ {
+ string currentfile = (string) UI::QueryWidget(`id(`file), `Value);
+ // header in file selection popup
+ string newfile = (string) UI::AskForExistingFile(currentfile, "*",
_("Select a GPG Key To Import"));
+
+ if (newfile != nil)
+ {
+ UI::ChangeWidget(`id(`file), `Value, newfile);
+ refreshNewKeyDetails(newfile);
+ }
+ }
+ else if (ret == `file)
+ {
+ string keyfile = (string) UI::QueryWidget(`id(`file), `Value);
+
+ y2debug("The file has changed: %1", keyfile);
+
+ // refresh the information
+ refreshNewKeyDetails(keyfile);
+ }
+ else if (ret == `next)
+ {
+ // validate the entered file
+ string keyfile = (string) UI::QueryWidget(`id(`file), `Value);
+ y2milestone("Selected file: %1", keyfile);
+
+ if (keyfile == nil || keyfile == "")
+ {
+ Report::Error(_("Enter a filename"));
+ UI::SetFocus(`id(`file));
+ ret = `_dummy;
+ continue;
+ }
+
+ boolean trusted = (boolean) UI::QueryWidget(`id(`trusted), `Value);
+ added_key = KeyManager::ImportFromFile(keyfile, trusted);
+
+ if (added_key == nil || size(added_key) == 0)
+ {
+ ret = `_dummy;
+ }
+ }
+
+ }
+ while (!contains([`back, `abort, `next], ret));
+
+ Wizard::RestoreNextButton();
+
+ return ret;
+}
+
+/**
+ * Display the main dialog for GPG key management
+ */
+symbol KeySummary()
+{
+ y2milestone ("Running Summary dialog");
+
+ // dialog caption
+ string title = _("GPG Public Key Management");
+
+ // help
+ string help_text = _("<p>
+In this dialog, manage known GPG public keys.</p>");
+
+ help_text = help_text + _("<p>
+<b>Adding a New GPG Key</b><br>
+To add a new GPG key, use <b>Add</b> and specify the path to the key file.
+</p>");
+
+ // help, continued
+ help_text = help_text + _("<p>
+<b>Modifying a GPG Key Status</b>
+To modify the trusted flag, use <b>Edit</b>. To remove a GPG key, use
+<b>Delete</b>.
+</p>
+");
+
+ // table header
+ WizardHW::CreateHWDialog(title, help_text, [_("Trusted"), _("Key ID"),
_("Name")], []);
+
+ // set the navigation keys according to the current mode
+ if (gpg_mgr_standalone_mode)
+ {
+ Wizard::DisableBackButton();
+ Wizard::SetNextButton(`next, Label::FinishButton());
+ }
+ else
+ {
+ Wizard::EnableBackButton();
+ Wizard::SetNextButton(`next, Label::OKButton());
+ }
+
+ symbol ret = nil;
+
+ // set the table content
+ SetItems(nil);
+
+ do
+ {
+ map<string,any> ev = WizardHW::WaitForEvent();
+ y2milestone("WaitForEvent: %1", ev);
+
+ ret = (symbol)ev["event","ID"]:nil;
+
+ // the selected key
+ string key_id = ev["selected"]:"";
+
+ y2milestone("Selected key: %1, action: %2", key_id, ret);
+
+ // change key properties
+ if (ret == `edit)
+ {
+ map<string,any> key = KeyManager::SearchGPGKey(key_id);
+
+ if (key != nil && EditKeyProperties(key))
+ {
+ SetItems(key_id);
+ }
+ }
+ // remove the key
+ else if (ret == `delete)
+ {
+ map<string,any> key = KeyManager::SearchGPGKey(key_id);
+
+ if (Popup::YesNo(sformat(_("Really delete key '%1'
+'%2'?"), key_id, key["name"]:"")))
+ {
+ KeyManager::DeleteKey(key_id);
+ // refresh the table
+ SetItems(nil);
+
+ // hack - refresh (clear) the rich text part of the dialog
+ // TODO: fix a bug in WizardHW?
+ if (size(KeyManager::GetKeys()) == 0)
+ {
+ SetItems("");
+ }
+ }
+ }
+ }
+ while (!contains([`back, `abort, `next, `add], ret));
+
+ return ret;
+}
+
+/**
+ * Run the GPG key management workflow
+ */
+symbol RunGPGKeyMgmt(boolean standalone)
+{
+ gpg_mgr_standalone_mode = standalone;
+
+ map<string,any> aliases = $[
+ "summary" : ``(KeySummary()),
+ "add" : [``(AddGPGKey()), true ]
+ ];
+
+ map sequence = $[
+ "ws_start" : "summary",
+ "summary" : $[
+ `abort : `abort,
+ `next : `next,
+ `add : "add"
+ ],
+ "add" : $[
+ `next : "summary",
+ `abort : `abort
+ ]
+ ];
+
+ y2milestone ("Starting the key management sequence (standalone: %1)",
standalone);
+ symbol ret = Sequencer::Run (aliases, sequence);
+
+ return ret;
+}
+
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/src/include/Makefile.am
new/yast2-packager-2.16.14/src/include/Makefile.am
--- old/yast2-packager-2.16.13/src/include/Makefile.am 2007-11-19
14:04:38.000000000 +0100
+++ new/yast2-packager-2.16.14/src/include/Makefile.am 2008-01-09
15:33:18.000000000 +0100
@@ -8,7 +8,8 @@
ynclude_DATA = \
inst_source_dialogs.ycp \
storage_include.ycp \
- load_release_notes.ycp
+ load_release_notes.ycp \
+ key_manager_dialogs.ycp


EXTRA_DIST = $(ynclude_DATA)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/src/include/Makefile.in
new/yast2-packager-2.16.14/src/include/Makefile.in
--- old/yast2-packager-2.16.13/src/include/Makefile.in 2008-01-04
13:08:30.000000000 +0100
+++ new/yast2-packager-2.16.14/src/include/Makefile.in 2008-01-14
17:30:31.000000000 +0100
@@ -188,7 +188,8 @@
ynclude_DATA = \
inst_source_dialogs.ycp \
storage_include.ycp \
- load_release_notes.ycp
+ load_release_notes.ycp \
+ key_manager_dialogs.ycp

EXTRA_DIST = $(ynclude_DATA)
all: all-recursive
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/src/modules/KeyManager.ycp
new/yast2-packager-2.16.14/src/modules/KeyManager.ycp
--- old/yast2-packager-2.16.13/src/modules/KeyManager.ycp 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-packager-2.16.14/src/modules/KeyManager.ycp 2008-01-14
16:21:47.000000000 +0100
@@ -0,0 +1,335 @@
+/**
+ * File: modules/KeyManager.ycp
+ * Package: GPG Key Management
+ * Summary: Manages GPG keys in the package manager
+ * Authors: Ladislav Slezák <lslezak@xxxxxxxxxx>
+ *
+ * $Id$
+ *
+ */
+
+{
+
+textdomain "packager";
+module "KeyManager";
+
+import "Report";
+import "Directory";
+import "String";
+
+// the current state
+list<map<string,any> > known_keys = [];
+
+// keys to delete
+list<map<string,any> > deleted_keys = [];
+
+// keys to import from a file (file name => trusted flag)
+map<string,boolean> import_from_file = $[];
+
+boolean modified = false;
+
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Reset the internal state of the module. The current configuration and all
+ * changes are deleted.
+ */
+global void Reset()
+{
+ known_keys = [];
+ deleted_keys = [];
+ import_from_file = $[];
+ modified = false;
+}
+
+/**
+ * Read the current configuration from the package manager
+ * @return list the current configuration, nil when an error occurr
+ */
+list<map<string,any> > ReadCurrentKeys()
+{
+ // read known keys
+ list<map<string,any> > ret = Pkg::GPGKeys(false);
+
+ if (ret != nil)
+ {
+ // add trusted keys
+ ret = (list<map<string,any> >)merge(ret, Pkg::GPGKeys(true));
+ }
+
+ y2milestone("Read configuration: %1", ret);
+
+ return ret;
+}
+
+
+/**
+ * Read the current configuration from the package manager. The previous
changes are lost (@see Reset).
+ * The target system of the package manager must be initialized before reading
GPG keys!
+ * @return boolean true on success
+ */
+global boolean Read()
+{
+ if (size(known_keys) > 0)
+ {
+ y2warning("Rereading GPG keys from the package manager");
+ Reset();
+ }
+
+ known_keys = ReadCurrentKeys();
+
+ if (known_keys == nil)
+ {
+ known_keys = [];
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Search a GPG key in the known keys
+ * @param key_id ID of the key
+ * @return map Data about the key or nil if the key was not found
+ */
+global map<string,any> SearchGPGKey(string key_id)
+{
+ map<string,any> ret = nil;
+
+ // search the properties of the key
+ foreach(map<string,any> key, known_keys,
+ {
+ if (key["id"]:"" == key_id)
+ {
+ ret = key;
+ break;
+ }
+ }
+ );
+
+ return ret;
+}
+
+/**
+ * Apply the changes, update the current status
+ * @return boolean true on success
+ */
+global boolean Write()
+{
+ if (!modified)
+ {
+ y2milestone("No change, nothing to write");
+ return true;
+ }
+
+ y2milestone("Writing key management configuration");
+
+ boolean ret = true;
+
+ // delete the keys marked for removal
+ foreach(map<string,any> deleted_key, deleted_keys,
+ {
+ y2milestone("Deleting key %1 ('%2')", deleted_key["id"]:"",
deleted_key["name"]:"");
+ ret = Pkg::DeleteGPGKey(deleted_key["id"]:"",
deleted_key["trusted"]:false) && ret;
+ }
+ );
+
+ // import the new keys
+ foreach(string tmpfile, boolean trusted, import_from_file,
+ {
+ y2milestone("Importing key from '%1', trusted: %2", tmpfile,
trusted);
+
+ ret = Pkg::ImportGPGKey(tmpfile, trusted) && ret;
+ }
+ );
+
+ // modify keys (change the trusted flag)
+ // get the current settings
+ list<map<string,any> > current_keys = ReadCurrentKeys();
+ foreach(map<string,any> key, current_keys,
+ {
+ map<string,any> found_key = SearchGPGKey(key["id"]:"");
+ // is the trusted flag different?
+ if (found_key != nil && found_key["trusted"]:false !=
key["trusted"]:false)
+ {
+ y2milestone("Key %1 ('%2'): new trusted state: %3",
found_key["id"]:"",
+ found_key["name"]:"", found_key["trusted"]:false);
+
+ // the current state is trusted
+ if (found_key["trusted"]:false)
+ {
+ // TODO move to the trusted keyring
+ }
+ else
+ {
+ // TODO move from the trusted keyring
+ }
+ }
+ }
+ );
+
+
+ // all changes are saved, reset them
+ Reset();
+
+ // update the current status
+ Read();
+
+ return ret;
+}
+
+/**
+ * Has been something changed?
+ * @return boolean true if something has been changed
+ */
+global boolean Modified()
+{
+ return modified;
+}
+
+/**
+ * Return the current keys.
+ * @return list list of known GPG keys ($[ "id" : string, "name" : string,
"trusted" : boolean ])
+ */
+global list<map<string,any> > GetKeys()
+{
+ return known_keys;
+}
+
+/**
+ * Modify a key
+ * @param new_key A map with the key data, the key with the same Key ID is
modified. (Only "trusted" flag can be changed.)
+ * @return true on success
+ */
+global boolean ModifyKey(map<string,any> new_key)
+{
+ boolean ret = true;
+
+ if (new_key != nil)
+ {
+ // update the key
+ known_keys = maplist(map<string,any> k, known_keys,
+ {
+ if (k["id"]:"" == new_key["id"]:"")
+ {
+ k["trusted"] = new_key["trusted"]:false;
+ }
+
+ return k;
+ }
+ );
+ }
+
+ return ret;
+}
+
+/**
+ * Delete the key from the package manager
+ * @param key_id ID of the key to delete
+ * @return boolean true on success
+ */
+global boolean DeleteKey(string key_id)
+{
+ if (key_id == nil || key_id == "")
+ {
+ y2error("Invalid key ID: %1", key_id);
+ return false;
+ }
+
+ // index of the key
+ integer found = nil;
+ integer i = 0;
+
+ // copy the key from known keys to the deleted list
+ foreach(map<string,any> key, known_keys,
+ {
+ if (key["id"]:"" == key_id)
+ {
+ deleted_keys = add(deleted_keys, key);
+ found = i;
+ }
+
+ i = i + 1;
+ }
+ );
+
+ // remove from known keys when found
+ if (found != nil)
+ {
+ known_keys = remove(known_keys, found);
+ }
+
+ return (found != nil);
+}
+
+
+/**
+ * Import key from a file
+ * @param file path to the file
+ * @param trusted true if the key is trusted
+ * @return map map with the key, nil when import fails (invalid key, not
existing file, already imported key...)
+ */
+global map<string,any> ImportFromFile(string file, boolean trusted)
+{
+ // check whether the file is valid, copy the file to the tmpdir
+ map<string,any> key = Pkg::CheckGPGKeyFile(file);
+ y2internal("File content: %1", key);
+
+ if (key != nil && size(key) > 0)
+ {
+ // update the trusted flag
+ key["trusted"] = trusted;
+ }
+ else
+ {
+ Report::Error(sformat(_("File '%1'
+doesn't contain a valid GPG key."), file));
+ return nil;
+ }
+
+ boolean known = false;
+
+ // check whether the key is already known
+ foreach(map<string,any> k, known_keys,
+ {
+ if (k["id"]:"" == key["id"]:"")
+ {
+ known = true;
+ }
+ }
+ );
+
+ if (known)
+ {
+ // %1 is key ID (e.g. A84EDAE89C800ACA), %2 is key name (e.g. "SuSE
Package Signing Key <build@xxxxxxx>")
+ Report::Error(sformat(_("Key '%1'
+'%2'
+is already known, it cannot be added again."), key["id"]:"", key["name"]:""));
+ return nil;
+ }
+
+ // copy the key to the temporary directory (in fact the keys are imported
in Write())
+ string tmpfile = sformat("%1/tmp_gpg_key.%2", Directory::tmpdir,
size(known_keys));
+ string command = sformat("/bin/cp -- '%1' '%2'", String::Quote(file),
String::Quote(tmpfile));
+
+ y2internal("Copying the key: %1", command);
+
+ integer out = (integer)SCR::Execute(.target.bash, command);
+
+ if (out != 0)
+ {
+ Report::Error(_("Cannot copy the key to the temporary directory."));
+ return nil;
+ }
+
+ // store the import request
+ import_from_file = add(import_from_file, tmpfile, trusted);
+
+ // add the new key to the current config
+ known_keys = add(known_keys, key);
+
+ return key;
+}
+
+/* EOF */
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/src/modules/SourceManager.ycp
new/yast2-packager-2.16.14/src/modules/SourceManager.ycp
--- old/yast2-packager-2.16.13/src/modules/SourceManager.ycp 2007-12-10
15:48:06.000000000 +0100
+++ new/yast2-packager-2.16.14/src/modules/SourceManager.ycp 2008-01-10
13:23:18.000000000 +0100
@@ -7,7 +7,7 @@
* Martin Vidner <mvidner@xxxxxxx>
* Status: Work in Progress
*
- * $Id: SourceManager.ycp 42900 2007-12-10 14:48:05Z lslezak $
+ * $Id: SourceManager.ycp 43522 2008-01-10 12:23:17Z lslezak $
*
* Representation of the configuration of source-manager.
* Input and output routines.
@@ -33,6 +33,7 @@
import "String";
import "SuSEFirewall";
import "Linuxrc";
+import "FileUtils";


global list<integer> newSources = [];
@@ -135,6 +136,11 @@
*/
global boolean ReadSyncFlag()
{
+ if (!FileUtils::Exists(source_config_file))
+ {
+ return false;
+ }
+
map<string, any> inst_config = (map<string, any>)SCR::Read(.target.ycp,
source_config_file);
zmd_sync = (boolean)inst_config["zmd_sync"]:nil;
y2milestone("Read ZMD sync status: %1", zmd_sync);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/yast2-packager-2.16.13/VERSION
new/yast2-packager-2.16.14/VERSION
--- old/yast2-packager-2.16.13/VERSION 2008-01-04 13:07:05.000000000 +0100
+++ new/yast2-packager-2.16.14/VERSION 2008-01-14 17:29:07.000000000 +0100
@@ -1 +1 @@
-2.16.13
+2.16.14


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >