Mailinglist Archive: opensuse-commit (1187 mails)

< Previous Next >
commit yast2-packager
  • From: root@xxxxxxx (h_root)
  • Date: Wed, 5 Apr 2006 18:47:23 +0200 (CEST)
  • Message-id: <20060405164723.C79758AEB8@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package yast2-packager
checked in at Wed Apr 5 18:47:23 CEST 2006.

--------
--- yast2-packager/yast2-packager.changes 2006-04-05 09:54:09.000000000 +0200
+++ yast2-packager/yast2-packager.changes 2006-04-05 18:09:05.000000000 +0200
@@ -1,0 +2,31 @@
+Wed Apr 5 18:08:46 CEST 2006 - mvidner@xxxxxxx
+
+- Call SourceManager::SyncYaSTInstSourceWithZMD () in
+ inst_rpmcopy(continue) because inst_suse_register does not run
+ without a network connection (#156030#c30).
+- Do not sync if rug not present.
+- Report rug errors to the user.
+- Delete sources only after we do not need their data for syncing.
+- 2.13.63
+
+-------------------------------------------------------------------
+Wed Apr 5 16:29:09 CEST 2006 - mvidner@xxxxxxx
+
+- Added SourceManager::SyncAddedAndDeleted and calling it from
+ inst_source (#156030#c29).
+- 2.13.62
+
+-------------------------------------------------------------------
+Wed Apr 5 15:49:09 CEST 2006 - locilka@xxxxxxx
+
+- Some new texts and dialogs for SignatureCheckDialogs
+- New functions for Pkg:: callbacks:
+ - CallbackAcceptUnsignedFile
+ - CallbackAcceptUnknownGpgKey
+ - CallbackImportGpgKey
+ - CallbackAcceptVerificationFailed
+ - CallbackTrustedKeyAdded
+ - CallbackTrustedKeyRemoved
+- 2.13.61
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.AU8MOn/_old 2006-04-05 18:46:41.000000000 +0200
+++ /var/tmp/diff_new_pack.AU8MOn/_new 2006-04-05 18:46:41.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-packager (Version 2.13.60)
+# spec file for package yast2-packager (Version 2.13.63)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild

Name: yast2-packager
-Version: 2.13.60
+Version: 2.13.63
Release: 1
License: GPL
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-packager-2.13.60.tar.bz2
+Source0: yast2-packager-2.13.63.tar.bz2
prefix: /usr
BuildRequires: docbook-xsl-stylesheets doxygen gcc-c++ libxcrypt-devel libxslt perl-XML-Writer sgml-skel update-desktop-files yast2 yast2-country yast2-devtools yast2-installation yast2-testsuite yast2-xml
Requires: yast2 yast2-installation checkmedia yast2-country
@@ -41,7 +41,7 @@
Arvin Schnell <arvin@xxxxxxx>

%prep
-%setup -n yast2-packager-2.13.60
+%setup -n yast2-packager-2.13.63

%build
%{prefix}/bin/y2tool y2autoconf
@@ -78,6 +78,28 @@
%doc %{prefix}/share/doc/packages/yast2-packager

%changelog -n yast2-packager
+* Wed Apr 05 2006 - mvidner@xxxxxxx
+- Call SourceManager::SyncYaSTInstSourceWithZMD () in
+ inst_rpmcopy(continue) because inst_suse_register does not run
+ without a network connection (#156030#c30).
+- Do not sync if rug not present.
+- Report rug errors to the user.
+- Delete sources only after we do not need their data for syncing.
+- 2.13.63
+* Wed Apr 05 2006 - mvidner@xxxxxxx
+- Added SourceManager::SyncAddedAndDeleted and calling it from
+ inst_source (#156030#c29).
+- 2.13.62
+* Wed Apr 05 2006 - locilka@xxxxxxx
+- Some new texts and dialogs for SignatureCheckDialogs
+- New functions for Pkg:: callbacks:
+- CallbackAcceptUnsignedFile
+- CallbackAcceptUnknownGpgKey
+- CallbackImportGpgKey
+- CallbackAcceptVerificationFailed
+- CallbackTrustedKeyAdded
+- CallbackTrustedKeyRemoved
+- 2.13.61
* Wed Apr 05 2006 - visnov@xxxxxxx
- Show the type of the source in installation sources module if needed
- 2.13.60

++++++ yast2-packager-2.13.60.tar.bz2 -> yast2-packager-2.13.63.tar.bz2 ++++++
++++ 4888 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-packager-2.13.60/Makefile.am new/yast2-packager-2.13.63/Makefile.am
--- old/yast2-packager-2.13.60/Makefile.am 2006-03-13 14:18:11.000000000 +0100
+++ new/yast2-packager-2.13.63/Makefile.am 2006-04-05 18:09:40.000000000 +0200
@@ -154,7 +154,7 @@
$(PREFIX)/bin/y2tool create-spec < $$i > $$here/package/$${newname} ; \
done

-package: check-up-to-date check-tagversion check-all-packages package-local
+package: check-up-to-date check-tagversion check-all-packages check-textdomain package-local

TAGVERSION = $(PREFIX)/bin/y2tool tagversion

@@ -199,6 +199,9 @@
false; \
fi

+check-textdomain:
+ $(PREFIX)/bin/y2tool check-textdomain $(srcdir)
+
stable: checkin-stable

checkin-stable: package
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-packager-2.13.60/VERSION new/yast2-packager-2.13.63/VERSION
--- old/yast2-packager-2.13.60/VERSION 2006-04-05 09:49:53.000000000 +0200
+++ new/yast2-packager-2.13.63/VERSION 2006-04-05 18:03:31.000000000 +0200
@@ -1 +1 @@
-2.13.60
+2.13.63
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-packager-2.13.60/configure.in new/yast2-packager-2.13.63/configure.in
--- old/yast2-packager-2.13.60/configure.in 2006-03-13 14:18:11.000000000 +0100
+++ new/yast2-packager-2.13.63/configure.in 2006-04-05 18:09:40.000000000 +0200
@@ -1,9 +1,9 @@
dnl configure.in for yast2-packager
dnl
-dnl -- This file is generated by y2autoconf - DO NOT EDIT! --
+dnl -- This file is generated by y2autoconf 2.13.16 - DO NOT EDIT! --
dnl (edit configure.in.in instead)

-AC_INIT(yast2-packager, 2.13.41, http://www.suse.de/feedback, yast2-packager)
+AC_INIT(yast2-packager, 2.13.63, http://www.suse.de/feedback, 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.13.41"
+VERSION="2.13.63"
RPMNAME="yast2-packager"
MAINTAINER="Jiri Srain <jsrain@xxxxxxx>"

diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-packager-2.13.60/src/clients/inst_rpmcopy.ycp new/yast2-packager-2.13.63/src/clients/inst_rpmcopy.ycp
--- old/yast2-packager-2.13.60/src/clients/inst_rpmcopy.ycp 2006-03-28 14:10:21.000000000 +0200
+++ new/yast2-packager-2.13.63/src/clients/inst_rpmcopy.ycp 2006-04-05 18:09:12.000000000 +0200
@@ -13,7 +13,7 @@
* Packages module :
* "installed"
*
- * $Id: inst_rpmcopy.ycp 29461 2006-03-28 11:42:01Z locilka $
+ * $Id: inst_rpmcopy.ycp 29756 2006-04-05 16:09:06Z mvidner $
*/

{
@@ -34,6 +34,7 @@
import "Report";
import "Kernel";
import "Service";
+ import "SourceManager";

// variables related to installation source caching

@@ -776,7 +777,8 @@
}
else if (Stage::cont ())
{
- CleanupDiskCache ();
+ SourceManager::SyncYaSTInstSourceWithZMD (); // #156030
+ CleanupDiskCache ();
}
}

diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-packager-2.13.60/src/clients/inst_source.ycp new/yast2-packager-2.13.63/src/clients/inst_source.ycp
--- old/yast2-packager-2.13.60/src/clients/inst_source.ycp 2006-04-05 09:48:34.000000000 +0200
+++ new/yast2-packager-2.13.63/src/clients/inst_source.ycp 2006-04-05 17:46:04.000000000 +0200
@@ -17,6 +17,9 @@
import "PackageCallbacksInit";
import "PackageLock";
import "SLP";
+ // SourceManager overlaps quite a bit with inst_source,
+ // so far we only use it for ZMD sync, TODO refactor better
+ import "SourceManager";
import "Wizard";

import "Label";
@@ -161,6 +164,27 @@
}
}

+ /**
+ * @param statesOld sourceStates{In or Out}
+ * @param statesNew sourceStates{In or Out}
+ * @return the list of SrcId's that are in statesNew but not statesOld
+ */
+ list<integer> newSources (list<map<string,any> > statesOld,
+ list<map<string,any> > statesNew) {
+ y2milestone ("From %1 To %2", statesOld, statesNew);
+ list<integer> ret = [];
+ map<integer, boolean> seen = listmap (
+ map<string, any> src, statesOld,
+ ``( $[(src["SrcId"]:-1) : true ] ));
+ foreach (map<string, any> src, statesNew, {
+ integer newid = src["SrcId"]:-1;
+ if (! seen[newid]:false)
+ ret = add (ret, newid);
+ });
+ y2milestone ("Difference %1", ret);
+ return ret;
+ }
+
define void deleteSource( integer index ) ``{
integer srcid = sourceStatesOut[index, "SrcId"]:-1;

@@ -173,6 +197,18 @@
boolean Write() {
boolean success = Pkg::SourceEditSet( sourceStatesOut );

+ // we must sync before the sources are deleted from zypp
+ // otherwise we will not get their details
+ list<integer> added = newSources (sourceStatesIn, sourceStatesOut);
+ list<integer> deleted = newSources (sourceStatesOut, sourceStatesIn);
+ boolean have_rug = (integer)SCR::Read (.target.size, "/usr/bin/rug") >= 0;
+ if (have_rug) {
+ success = success && SourceManager::SyncAddedAndDeleted (added, deleted);
+ }
+ else {
+ y2milestone ("No rug, not syncing");
+ }
+
foreach( integer id, sourcesToDelete, ``{
success = success && Pkg::SourceDelete(id);
});
@@ -492,7 +528,6 @@
All changes will be lost.");
if ( Popup::YesNoHeadline( headline, msg ) ) {
exit = true;
- Pkg::SourceEditSet( sourceStatesIn );
}
}
else
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-packager-2.13.60/src/modules/SignatureCheckCallbacks.ycp new/yast2-packager-2.13.63/src/modules/SignatureCheckCallbacks.ycp
--- old/yast2-packager-2.13.60/src/modules/SignatureCheckCallbacks.ycp 2006-04-05 09:48:54.000000000 +0200
+++ new/yast2-packager-2.13.63/src/modules/SignatureCheckCallbacks.ycp 2006-04-05 16:18:14.000000000 +0200
@@ -13,63 +13,79 @@
module "SignatureCheckCallbacks";

import "SignatureCheckDialogs";
-
- // Name of the callback handler function. Required callback prototype is
- // boolean(string keyid, string keyname). The callback function should ask
- // user whether the unknown key can be accepted, returned true value means to
- // accept the file.
- boolean AcceptUnknownGpgKey (string keyid, string keyname) {
- // FIXME: one of these two dialogs should be used
-
- string filename = "FIXME: 'filename' is undefined variable!";
- return SignatureCheckDialogs::ItemSignedWithUnknownSignature(`file, filename, keyid);

- // This function would need more complex handling
- // it also offers to import the signature into the keyring
- SignatureCheckDialogs::ItemSignedWithPublicSignature(`file, filename, keyid, keyname);
- return nil;
- }
+
+ /* ============================ < Callbacks for Sources > ============================ */

// Name of the callback handler function. Required callback prototype is
// boolean(string filename). The callback function should ask user whether the
// unsigned file can be accepted, returned true value means to accept the
// file.
- boolean AcceptUnsignedFile (string filename) {
+ //
+ // zypp: askUserToAcceptUnsignedFile
+ //
+ /* function for CallbackAcceptUnsignedFile() */
+ global boolean AcceptUnsignedFile (string filename) {
return SignatureCheckDialogs::UseUnsignedItem(`file, filename);
}

+
+ // Name of the callback handler function. Required callback prototype is
+ // boolean(string filename, string keyid, string keyname). The callback
+ // function should ask user whether the unknown key can be accepted, returned
+ // true value means to accept the file.
+ //
+ // zypp: askUserToAcceptUnknownKey
+ //
+ /* function for CallbackAcceptUnknownGpgKey() */
+ global boolean AcceptUnknownGpgKey (string filename, string keyid, string keyname) {
+ // Unknown keyname == "Unknown Key"
+ return SignatureCheckDialogs::ItemSignedWithUnknownSignature(`file, filename, keyid);
+ }
+
+ // Name of the callback handler function. Required callback prototype is
+ // boolean(string keyid, string keyname, string keydetails). The callback
+ // function should ask user whether the key is trusted, returned true value
+ // means the key is trusted.
+ //
+ // zypp: askUserToTrustKey
+ //
+ /* function for CallbackImportGpgKey() */
+ global boolean ImportGpgKey (string keyid, string keyname, string keydetails) {
+ return SignatureCheckDialogs::ImportUntrustedGPGKeyIntoTrustedDialog(keyid, keyname, keydetails);
+ }
+
// Name of the callback handler function. Required callback prototype is
// boolean(string filename, string keyid, string keyname). The callback
// function should ask user whether the unsigned file can be accepted,
// returned true value means to accept the file.
- boolean AcceptVerificationFailed (string filename, string keyid, string keyname) {
- // FIXME: the description doesn't match the function name
- // see also AcceptUnsignedFile() function
- return SignatureCheckDialogs::UseCorruptedItem(`file, filename);
+ //
+ // zypp: askUserToAcceptVerificationFailed
+ //
+ /* function for CallbackAcceptVerificationFailed() */
+ global boolean AcceptVerificationFailed (string filename, string keyid, string keyname) {
+ return SignatureCheckDialogs::UseCorruptedItem(`file, filename, keyid, keyname);
}

+ /* ============================ < Callbacks for Sources > ============================ */
+
// Name of the callback handler function. Required callback prototype is void
// (string keyid, string keyname). The callback function should inform user
// that a trusted key has been added.
+ //
+ /* function for CallbackTrustedKeyAdded() */
void TrustedKeyAdded (string keyid, string keyname) {
- // FIXME: we have no dialog for this message
+ y2milestone("Trusted key has been added: %1 (%2)", keyid, keyname);
return nil;
}

// Name of the callback handler function. Required callback prototype is void
// (string keyid, string keyname). The callback function should inform user
// that a trusted key has been removed.
+ //
+ /* function for CallbackTrustedKeyRemoved() */
void TrustedKeyRemoved (string keyid, string keyname) {
- // FIXME: we have no dialog for this message
- return nil;
- }
-
- // Name of the callback handler function. Required callback prototype is
- // boolean(string keyid, string keyname). The callback function should ask
- // user whether the key is trusted, returned true value means the key is
- // trusted.
- boolean ImportGpgKey (string keyid, string keyname) {
- // FIXME: description of the function doesn't match the function name!!!
+ y2milestone("Trusted key has been removed: %1 (%2)", keyid, keyname);
return nil;
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-packager-2.13.60/src/modules/SignatureCheckDialogs.ycp new/yast2-packager-2.13.63/src/modules/SignatureCheckDialogs.ycp
--- old/yast2-packager-2.13.60/src/modules/SignatureCheckDialogs.ycp 2006-04-05 09:48:54.000000000 +0200
+++ new/yast2-packager-2.13.63/src/modules/SignatureCheckDialogs.ycp 2006-04-05 18:09:38.000000000 +0200
@@ -151,9 +151,9 @@
Install it anyway?")
:
// popup question, %1 stands for the filename
- _("The file %1 is not digitally signed. This means that the origin
-and integrity of the file cannot be verified. Using the file may put
-the integrity of your system at risk.
+ _("The file %1 is not digitally signed.
+This means that the origin and integrity of the file cannot be verified.
+Using the file may put the integrity of your system at risk.

Use it anyway?")
), item_name);
@@ -188,24 +188,30 @@
* @param string item_name file name or package name
* @return boolean use or don't use ('true' if 'yes')
*/
- global boolean UseCorruptedItem (symbol item_type, string item_name) {
+ global boolean UseCorruptedItem (symbol item_type, string item_name, string key_id, string key_name) {
string description_text = sformat((item_type == `package ?
- // popup question, %1 stands for the package name
- _("The integrity check for package %1 failed. This means that
-the package has been changed by accident or by an attacker
-since the repository creator signed it. Installing it
-is a big risk for the integrity and security of your system.
+ // popup question, %1 stands for the package name, %2 for the key ID, %3 for the key name
+ _("Package %1 is signed with
+GnuPG key '%2 (%3)'
+but the integrity check failed.
+
+This means that the package has been changed by accident or by an attacker
+since the repository creator signed it. Installing it is a big risk
+for the integrity and security of your system.

Install it anyway?")
:
// popup question, %1 stands for the filename
- _("The integrity check for file %1 failed. This means that
-the file has been changed by accident or by an attacker
-since the repository creator signed it. Installing it
-is a big risk for the integrity and security of your system.
+ _("File %1 is signed with
+GnuPG key '%2 (%3)'
+but the integrity check failed.
+
+This means that the file has been changed by accident or by an attacker
+since the repository creator signed it. Installing it is a big risk
+for the integrity and security of your system.

-Use it anyway?")
- ), item_name);
+Install it anyway?")
+ ), item_name, key_id, key_name);

UI::OpenDialog(
`opt(`decorated),
@@ -240,8 +246,9 @@
global boolean ItemSignedWithUnknownSignature (symbol item_type, string item_name, string key_id) {
string description_text = sformat((item_type == `package ?
// popup question, %1 stands for the package name, %2 for the key ID
- _("The package %1 is digitally signed with an unknown
-GnuPG key '%2'.
+ _("The package %1 is digitally signed
+with the unknown GnuPG key '%2'.
+
This means that a trust relationship to the creator of the package
cannot be established. Installing the package may put the integrity
of your system at risk.
@@ -249,8 +256,9 @@
Install it anyway?")
:
// popup question, %1 stands for the filename, %2 for the key ID
- _("The file %1 is digitally signed with an unknown
-GnuPG key '%2'.
+ _("The file %1 is digitally signed
+with the unknown GnuPG key '%2'.
+
This means that a trust relationship to the creator of the file
cannot be established. Using the file may put the integrity
of your system at risk.
@@ -372,7 +380,7 @@

<p>Only trust a key if you are confident that the key really belongs to the owner
and that the owner can be trusted. With <b>Details</b>, get
-more information on the key, such as a fingerprint and signatures
+more information about the key, such as a fingerprint and signatures
that can help you determine the trustworthiness of the key.</p>

<p>A warning dialog opens for every package that
@@ -445,4 +453,97 @@
UI::CloseDialog();
return ret;
}
+
+ /**
+ * ImportUntrustedGPGKeyIntoTrustedDialog
+ *
+ * @param string key_id
+ * @param string key_name
+ * @param string key_detailed_description
+ * @return boolean whether zypp should import the key into the keyring of trusted keys
+ */
+ global boolean ImportUntrustedGPGKeyIntoTrustedDialog (string key_id, string key_name, string key_detailed_description) {
+ // additional Richtext (HTML) warning text (kind of help), %1 stands for the key ID
+ string warning_text = sformat(_("<p>The owner of the key may distribute updates,
+packages, and package repositories that your system will trust and offer
+for installation and update without any further warning. In this way,
+importing the key into your keyring of trusted keys allows the key owner
+to have a certain amount of control over the software on your system.</p>
+
+<p>Only trust a key if you are confident that the key really belongs to the owner
+and that the owner can be trusted. With <b>Details</b>, get
+more information about the key, such as a fingerprint and signatures
+that can help you determine the trustworthiness of the key.</p>
+
+<p>A warning dialog opens for every package that
+is not signed by a trusted (imported) key. If you do not import the key,
+packages created by the owner of key <tt>%1</tt> show this warning.</p>"), key_id);
+
+ // popup message, %1 stands for GPG key ID, %2 for key name
+ string dialog_text = sformat(_("The GnuPG key '%1 (%2)'
+has been found.
+
+You can choose to import it into your keyring of trusted
+public keys, meaning that you trust the owner of the key.
+You should be sure that you can trust the owner and that
+the key really belongs to that owner before importing it."),
+ key_id, key_name);
+
+ UI::OpenDialog(
+ `opt(`decorated),
+ `HBox (
+ `VSpacing(19),
+ // left-side help
+ `HWeight(3,
+ `VBox (
+ `RichText(warning_text)
+ )
+ ),
+ `HSpacing(1.5),
+ // dialog
+ `HWeight(5,
+ `VBox(
+ `Top (
+ `VBox (
+ `HBox (
+ `VCenter(MessageIcon("question")),
+ // popup heading
+ `VCenter(`Heading(_("Import Untrusted GnuPG Key"))),
+ `HStretch()
+ ),
+ // dialog message
+ `MarginBox(0.5, 0.5, `Label(dialog_text))
+ )
+ ),
+ // dialog buttons
+ `Bottom(
+ `HBox (
+ // push button
+ `PushButton(`id(`import), _("&Import")),
+ `HSpacing(1),
+ // push button
+ `PushButton(`id(`details), _("&Details...")),
+ `HSpacing(1),
+ // push button
+ `PushButton(`id(`dont_import), _("Do &Not Import"))
+ )
+ )
+ )
+ )
+ )
+ );
+ UI::SetFocus(`dont_import);
+
+ symbol ret = nil;
+ while (ret == nil || ret == `details) {
+ // wait for one of listed ID's, return the default value in case of `cancel
+ ret = WaitForSymbolUserInput([`import, `details, `dont_import], `dont_import);
+ if (contains([`import, `dont_import], ret)) break;
+ else if (ret == `details) Popup::LongMessage(key_detailed_description);
+ }
+
+ UI::CloseDialog();
+
+ return ret == `import;
+ }
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-packager-2.13.60/src/modules/SourceManager.ycp new/yast2-packager-2.13.63/src/modules/SourceManager.ycp
--- old/yast2-packager-2.13.60/src/modules/SourceManager.ycp 2006-04-05 09:48:54.000000000 +0200
+++ new/yast2-packager-2.13.63/src/modules/SourceManager.ycp 2006-04-05 17:59:45.000000000 +0200
@@ -5,7 +5,7 @@
* Authors: Anas Nashif <nashif@xxxxxxx>
* Status: Work in Progress
*
- * $Id: SourceManager.ycp 29665 2006-04-04 14:33:10Z mvidner $
+ * $Id: SourceManager.ycp 29753 2006-04-05 15:59:42Z mvidner $
*
* Representation of the configuration of source-manager.
* Input and output routines.
@@ -743,6 +743,28 @@
}

/**
+ * Run
+ * - with a timeout
+ * - on dumb terminal to disable colors etc
+ * - using 'exit $?' because of buggy behavior '.background vs. ZMD'
+ */
+ map RunDumb60 (string command) {
+ map ret = RunCommandWithTimeout ("TERM=dumb; " + command + "; exit $?", 60);
+ if (ret == nil) ret = $[];
+ return ret;
+ }
+
+ /**
+ * Detect whether ZMD is running
+ */
+ boolean CheckZMDStatus () {
+ string rug_command = "/usr/bin/rug";
+ map zmd_status = RunDumb60 (rug_command + " ping >/dev/null");
+ y2milestone("ZMD status: %1, err: %2", zmd_status["exit"]:nil, zmd_status["stderr"]:[]);
+ return zmd_status["exit"]:nil == 0;
+ }
+
+ /**
* Returns count of services matching the pattern. Returns 'nil'
* if something fails.
*
@@ -750,11 +772,8 @@
* @return integer count of matching lines
*/
integer CountOfZMDServicesMatching (string grep_pattern) {
- map ret = RunCommandWithTimeout(
- sformat("TERM=dumb /usr/bin/rug service-list; exit $?"),
- 60
- );
- if (ret != nil && ret["stdout"]:nil != nil) {
+ map ret = RunDumb60 ("/usr/bin/rug service-list");
+ if (ret["stdout"]:nil != nil) {
list <string> matching = filter (string one_line, (list <string>) ret["stdout"]:[], {
return regexpmatch(one_line, grep_pattern);
});
@@ -770,7 +789,7 @@
* @param src_id installation source id
* @return success
*/
- boolean AddZYPPServiceIntoZMD (integer src_id) {
+ boolean AddOrDeleteZYPPServiceIntoZMD (integer src_id, boolean adding) {
map gendata = Pkg::SourceGeneralData (src_id);
string url = gendata["url"]:"";
// ZMD must have unique URIs, so we append the alias
@@ -796,17 +815,25 @@

string name = alias;

- map ret = RunCommandWithTimeout(
- sformat (
- "TERM=dumb /usr/bin/rug service-add --type=zypp '%1' '%2' && /usr/bin/rug subscribe '%1'; exit $?",
+ string command = nil;
+ if (adding) {
+ command = sformat (
+ "/usr/bin/rug service-add --type=zypp '%1' '%2' && /usr/bin/rug subscribe '%1'",
url, name
- ),
- 60
- );
- if (ret != nil && ret["exit"]:nil == 0) {
+ );
+ }
+ else {
+ command = sformat ("/usr/bin/rug service-delete '%1'", url);
+ }
+ map ret = RunDumb60 (command);
+ if (ret["exit"]:nil == 0) {
return true;
} else {
- y2error("Adding ZYPP service failed, returned %1", ret);
+ string message = adding?
+ // rug is a command name
+ _("rug failed to add a ZYPP service"):
+ _("rug failed to delete a ZYPP service");
+ Report::LongError (sformat ("%1: %2", message, ret));
return false;
}
}
@@ -815,26 +842,57 @@
string zmd_service_name = "/etc/init.d/novell-zmd";

/**
- * Stops zmd when it 'was not running'.
- * It's expected that ZMD is running.
- *
- * @param boolean was_running
- * @return boolean true if successful
+ * Start ZMD if it was not running
+ * Report::Error on failure
+ * @return an opaque handle
*/
- boolean StopZMDIfItWasNotRunning (boolean was_running) {
+ map ZMDStart () {
+ map zmd_handle = $[];
+ boolean running = CheckZMDStatus ();
+ zmd_handle ["was_running"] = running;
+ if (! running) {
+ // Starting the service
+ map zmd_start = RunDumb60 (zmd_service_name + " start");
+ y2milestone("ZMD start: %1", zmd_start);
+ }
+ // Checking the status after start
+ running = CheckZMDStatus ();
+ zmd_handle ["is_running"] = running;
+ if (! running) {
+ Report::Error(Message::CannotStartService(zmd_service_name));
+ }
+ return zmd_handle;
+ }
+
+
+ /**
+ * @param zmd_handle what ZMDStart returned
+ * @return can we work with ZMD now
+ */
+ boolean ZMDWorking (map zmd_handle) {
+ return zmd_handle["is_running"]:false;
+ }
+
+ /**
+ * Restore the status before ZMDStart
+ * Report::Error on failure
+ * @param zmd_handle what ZMDStart returned
+ */
+ void ZMDRestore (map zmd_handle) {
// It was running, nothing to change
- if (was_running) return true;
+ if (zmd_handle["was_running"]:false)
+ return;

- y2milestone("Stopping service ZMD %1", zmd_service_name);
- map zmd_stop = RunCommandWithTimeout(sformat("TERM=dumb %1 stop; exit $?", zmd_service_name), 60);
- y2milestone("ZMD stop: %1", zmd_stop);
- if (zmd_stop == nil || zmd_stop["exit"]:nil != 0) {
- y2error("Cannot stop service %1", zmd_service_name);
- Report::Error(Message::CannotStopService(zmd_service_name));
+ if (zmd_handle["is_running"]:false)
+ {
+ y2milestone("Stopping service ZMD %1", zmd_service_name);
+ map zmd_stop = RunDumb60 (zmd_service_name + " stop");
+ y2milestone("ZMD stop: %1", zmd_stop);
+ if (zmd_stop["exit"]:nil != 0) {
+ Report::Error(Message::CannotStopService(zmd_service_name));
+ }
}
-
y2milestone("ZMD stopped");
- return true;
}

/**
@@ -857,65 +915,68 @@
// otherwise the ZMD will block itself!

y2milestone("--- Syncing YaST inst source with ZMD ---");
- string rug_command = "/usr/bin/rug";

- // Check the ZMD status and start if not running, using 'exit $?' because of buggy behavior '.background vs. ZMD'
- map zmd_status = RunCommandWithTimeout(sformat("TERM=dumb %1 ping 1>/dev/null; exit $?", rug_command), 60);
- y2milestone("ZMD status: %1, err: %2", zmd_status["exit"]:nil, zmd_status["stderr"]:[]);
- // If the ZMD wasn't running, we will try to start it and then we will have to stop it at the end
- boolean zmd_was_running = ((integer)zmd_status["exit"]:nil==0 ? true:false);
+ boolean ret = false;
+ // Check the ZMD status and start if not running
+ // If the ZMD wasn't running, we will try to start it
+ // and then we will have to stop it at the end
+ map zmd_handle = ZMDStart ();
+ if (ZMDWorking (zmd_handle)) {
+ // now we can work

- if (zmd_status == nil || zmd_status["exit"]:nil != 0) {
- // Starting the service
- map zmd_start = RunCommandWithTimeout(sformat("TERM=dumb %1 start; exit $?", zmd_service_name), 60);
- y2milestone("ZMD start: %1", zmd_start);
- // Checking the status after start
- map zmd_status = RunCommandWithTimeout(sformat("TERM=dumb %1 ping 1>/dev/null; exit $?", rug_command), 60);
- y2milestone("ZMD status: %1, err: %2", zmd_status["exit"]:nil, zmd_status["stderr"]:[]);
- if (zmd_status == nil || zmd_status["exit"]:nil != 0) {
- y2error("Cannot start service %1, returned %2", zmd_service_name, zmd_status);
- Report::Error(Message::CannotStartService(zmd_service_name));
-
- // In case of timeout
- if (zmd_status == nil) StopZMDIfItWasNotRunning(zmd_was_running);
- y2milestone("--- Syncing finished ---");
- return false;
+ if (true) {
+ ret = true;
+ }
+ // this will not work, /installation is gone
+ else {
+ // Check whether the ZYPP service is already in zmd db or not
+ integer count_of_services = CountOfZMDServicesMatching(".*ZYPP.*/installation.*");
+ if (count_of_services == nil) {
+ y2warning("Cannot get list of services...");
+ } else if (count_of_services > 0) {
+ y2milestone("ZYPP service already presented (%1)", count_of_services);
+ ret = true;
+ }
}
- }

- // this will not work, /installation is gone
- if (false) {
- // Check whether the ZYPP service is already in zmd db or not
- integer count_of_services = CountOfZMDServicesMatching(".*ZYPP.*/installation.*");
- if (count_of_services == nil) {
- y2warning("Cannot get list of services...");
- } else if (count_of_services > 0) {
- y2milestone("ZYPP service already presented (%1)", count_of_services);
-
- // Stop ZMD if needed
- StopZMDIfItWasNotRunning(zmd_was_running);
- y2milestone("--- Syncing finished ---");
- return true;
- }
- }
-
- // Count of services were 'nil' or '0'
- list<integer> src_ids = Pkg::SourceGetCurrent (true /*enabled only?*/);
- boolean added_ok = true;
- foreach (integer src_id, src_ids, {
- added_ok = AddZYPPServiceIntoZMD (src_id) && added_ok;
- });
- if (added_ok) {
- y2milestone("Adding ZYPP service succeeded");
- } else {
- Report::Error(Message::CannotWriteSettingsTo("ZMD"));
- y2error("Adding ZYPP service failed");
+ // ret now indicates whether there's anything left to do
+ if (ret) {
+ list<integer> src_ids = Pkg::SourceGetCurrent (true /*enabled only?*/);
+ boolean added_ok = true;
+ foreach (integer src_id, src_ids, {
+ added_ok = AddOrDeleteZYPPServiceIntoZMD (src_id, true /*add*/) && added_ok;
+ });
+ if (added_ok) {
+ y2milestone("Adding ZYPP service succeeded");
+ } else {
+ Report::Error(Message::CannotWriteSettingsTo("ZMD"));
+ y2error("Adding ZYPP service failed");
+ }
+ }
+ ret = true;
}
+ ZMDRestore (zmd_handle);

- // Stop ZMD if needed
- StopZMDIfItWasNotRunning(zmd_was_running);
y2milestone("--- Syncing finished ---");
- return true;
+ return ret;
+ }
+
+ global boolean SyncAddedAndDeleted (list<integer> added_src_ids,
+ list<integer> deleted_src_ids) {
+ boolean ret = false;
+ map zmd_handle = ZMDStart ();
+ if (ZMDWorking (zmd_handle)) {
+ ret = true;
+
+ foreach (integer id, added_src_ids, {
+ ret = AddOrDeleteZYPPServiceIntoZMD (id, true) && ret;
+ });
+ foreach (integer id, deleted_src_ids, {
+ ret = AddOrDeleteZYPPServiceIntoZMD (id, false) && ret;
+ });
+ }
+ ZMDRestore (zmd_handle);
+ return ret;
}

// adding YaST installation source into the ZMD


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



Remember to have fun...


< Previous Next >