Author: jdsn
Date: Mon Oct 13 19:02:03 2008
New Revision: 52156
URL: http://svn.opensuse.org/viewcvs/yast?rev=52156&view=rev
Log:
- support repository changes in catalogs (bnc#430896)
- added mandatory source refreshes
- 2.17.2
Modified:
trunk/registration/VERSION
trunk/registration/package/yast2-registration.changes
trunk/registration/src/clients/inst_suse_register.ycp
trunk/registration/src/modules/Register.ycp
Modified: trunk/registration/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/VERSION?rev=52156&r1=52155&r2=52156&view=diff
==============================================================================
--- trunk/registration/VERSION (original)
+++ trunk/registration/VERSION Mon Oct 13 19:02:03 2008
@@ -1 +1 @@
-2.17.1
+2.17.2
Modified: trunk/registration/package/yast2-registration.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/package/yast2-registration.changes?rev=52156&r1=52155&r2=52156&view=diff
==============================================================================
--- trunk/registration/package/yast2-registration.changes (original)
+++ trunk/registration/package/yast2-registration.changes Mon Oct 13 19:02:03 2008
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Mon Oct 13 18:38:31 CEST 2008 - jdsn@suse.de
+
+- support repository changes in catalogs (bnc#430896)
+- added mandatory source refreshes
+- 2.17.2
+
+-------------------------------------------------------------------
Wed Oct 8 23:39:11 CEST 2008 - jdsn@suse.de
- use new suse_register backend (bnc#430896)
Modified: trunk/registration/src/clients/inst_suse_register.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/clients/inst_suse_register.ycp?rev=52156&r1=52155&r2=52156&view=diff
==============================================================================
--- trunk/registration/src/clients/inst_suse_register.ycp (original)
+++ trunk/registration/src/clients/inst_suse_register.ycp Mon Oct 13 19:02:03 2008
@@ -141,6 +141,8 @@
string nccc_success_msg = _("Your configuration was successful.");
string nccc_success_server_added = _("An update server has been added to your configuration.");
string nccc_error_no_server_added = _("No update server could be added to your configuration.");
+ string nccc_no_source_changes0 = _("No software repository needed to be changed.");
+ string nccc_no_source_changes = _("Software repositories did not need to be changed.");
/* caption for details view */
string success_detail_label =_("New Update Server");
@@ -884,6 +886,13 @@
// (#261239) show success popup only on success else error message
if (repoSummary != nil && size(repoSummary) != 0)
{
+ // on successful registration and only if there were changes, we need to refresh all sources
+ list<integer> currentSources = Pkg::SourceGetCurrent( true );
+ foreach (integer srcID, currentSources, {
+ y2milestone("Refreshing source with ID: %1", srcID);
+ Pkg::SourceForceRefreshNow(srcID);
+ });
+
UI::OpenDialog( nccc_success );
repeat
{
@@ -905,7 +914,8 @@
}
else
{
- Popup::Error(nccc_error_no_server_added);
+ //Popup::Error(nccc_error_no_server_added);
+ Popup::Notify(nccc_no_source_changes);
}
}
Modified: trunk/registration/src/modules/Register.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/modules/Register.ycp?rev=52156&r1=52155&r2=52156&view=diff
==============================================================================
--- trunk/registration/src/modules/Register.ycp (original)
+++ trunk/registration/src/modules/Register.ycp Mon Oct 13 19:02:03 2008
@@ -793,6 +793,8 @@
{
read_config();
iamroot = amIroot();
+
+ // FIXME: need to test for xen-hypervisor status and install xen-packages
}
@@ -830,6 +832,107 @@
}
+
+/*
+ * checkCatalogs
+ *
+ * takes a sub-"taskList"-map (catalogs-map) from SuseRegister and updates listed repositories
+ * @return a list with a small summary (added/deleted/enabled/disabled repos)
+ */
+global list<string> checkCatalogs(map taskList, string service)
+{
+ list<string> cSummary = [];
+ map catalogToEnable = $[];
+ map catalogToDisable = $[];
+
+ foreach (string catalog, any pAny, taskList, {
+ if ( ! is(pAny, map) )
+ {
+ y2error("A catalog returned by SuseRegister did not contain any details: %1", catalog);
+ }
+ else if ( catalog == nil || catalog == "" )
+ {
+ y2error("A catalog returned by SuseRegister has no or an invalid name.");
+ }
+ else
+ {
+ map catDetail = (map) pAny;
+
+ if ( catDetail["ALIAS"]:"" == nil || catDetail["ALIAS"]:"" == "" )
+ {
+ y2error("A catalog returned by SuseRegister has no or an invalid alias name.");
+ }
+ else
+ {
+ if ( catDetail["TASK"]:"" == nil || catDetail["TASK"]:"" == "" )
+ {
+ y2error("A catalog returned by SuseRegister has an invalid task: %1", catalog);
+ }
+ else if ( catDetail["TASK"]:"" == "le" || catDetail["TASK"]:"" == "le" )
+ {
+ y2milestone("According to SuseRegister a catalog does not need to be changed: %1 (%2)", catalog, service);
+ }
+ else if ( catDetail["TASK"]:"" == "a" )
+ {
+ y2milestone("According to SuseRegister a catalog has to be enabled: %1 (%2)", catalog, service);
+ catalogToEnable[service] = add(catalogToEnable[service]:[], catalog);
+ cSummary = add(cSummary, sformat(_("Enabled catalog: %1 (%2)"), catalog, service) );
+ }
+ else if ( catDetail["TASK"]:"" == "d" )
+ {
+ y2milestone("According to SuseRegister a service has to be disabled: %1 (%2)", catalog, service);
+ catalogToDisable[service] = add(catalogToDisable[service]:[], catalog);
+ cSummary = add(cSummary, sformat(_("Disabled catalog: %1 (%2)"), catalog, service) );
+ }
+ else
+ {
+ y2error("A catalog returned by SuseRegister has an unsupported task: %1 (%2)", catalog, service);
+ }
+ }
+ }
+ });
+
+
+ foreach (string fService, list<string> fCatalogs, catalogToDisable, {
+ string toDisableString = "\"" + mergestring(fCatalogs, "\" \"") + "\"";
+ integer retval = (integer) SCR::Execute(.target.bash, sformat(" [ -f /etc/zypp/services.d/%1.service ] && cat >> /etc/zypp/services.d/%2.service <> /etc/zypp/services.d/%1.service <>>>> FIXME check catalogs!!!!!!!!
- // --> just iterate over catalogs
- // TODO
-
+ any catalogsMap = ((map) pAny)["CATALOGS"]:$[];
+ if ( is( catalogsMap , map) && catalogsMap != $[] )
+ {
+ y2milestone("A service returned by SuseRegister has catalogs that will be checked now.");
+ list<string> cSummary = checkCatalogs( (map) catalogsMap, pService );
+ summary = (list<string>) merge(summary, cSummary);
+ }
+ else
+ {
+ y2error("A service returned by SuseRegister did not contain any catalogs.");
+ }
}
else if ( ((map) pAny)["TASK"]:"" == "a" )
{
@@ -968,11 +1078,15 @@
{
y2milestone("Successfully added a new service: %1", pService);
y2milestone("Now checking the catalogs of the service: %1", pService);
- summary = add(summary, sformat(_("Added Service: %1"), pService ));
+ summary = add(summary, sformat(_("Added Service: %1"), pService ));
-// ------------------->>>>> FIXME check catalogs!!!!!!!!
- // need to save service to the system first -- is this be done with Pkg::SourceSaveAll() ?? service != source ??
+// ------------------->>>>> FIXME
+ // need to save service to the system first??
+ // documentation of Pkg::ServiceRefresh says : "Refresh the service, the service must already be saved on the system!"
+ // is this done with Pkg::SourceSaveAll() ??
+ // service != source ??
+/*
if ( Pkg::SourceSaveAll() )
{
y2milestone("Successfully saved all sources.");
@@ -981,10 +1095,11 @@
{
y2error("Could not save all sources.");
}
+*/
- // then need to call Pkg::ServiceRefresh()
-/*
- if ( Pkg::ServiceRefresh(pService) )
+ // then need to call Pkg::ServiceRefresh()
+ //if ( Pkg::ServiceRefresh(pService) )
+ if (true)
{
y2milestone("Successfully refreshed service: %1", pService);
}
@@ -992,9 +1107,19 @@
{
y2error("Could not refresh service: %1", pService);
}
-*/
- // then iterate over catalogs
- // TODO
+
+ // then iterate over catalogs
+ any catalogsMap = ((map) pAny)["CATALOGS"]:$[];
+ if ( is( catalogsMap , map) && catalogsMap != $[] )
+ {
+ y2milestone("A new service returned by SuseRegister has catalogs that will be checked now.");
+ list<string> cSummary = checkCatalogs( (map) catalogsMap, pService );
+ summary = (list<string>) merge(summary, cSummary);
+ }
+ else
+ {
+ y2error("A new service returned by SuseRegister did not contain any catalogs.");
+ }
}
else
@@ -1011,7 +1136,7 @@
if ( Pkg::ServiceDelete(pService) )
{
y2milestone("Successfully deleted a service: %1", pService);
- summary = add(summary, sformat(_("Deleted Service: %1"), pService ));
+ summary = add(summary, sformat(_("Deleted Service: %1"), pService ));
}
else
{
@@ -1042,13 +1167,13 @@
*/
global integer suseRegister(symbol parameter)
{
- // FIXME -- THERE __MUST__ BE A SOURCE REFREH BEFORE INITIALIZING SUSEREGISTER
-
+ list<integer> allCurrentSources = [];
map contextData = $[
"debug" : 0,
"nooptional" : (submit_optional ? 0:1),
"nohwdata" : (submit_hwdata ? 0:1),
"forceregistration" : (force_registration ? 1:0),
+ "norefresh" : 1,
"yastcall" : 1,
"logfile" : "/root/.suse_register.log"
];
@@ -1069,6 +1194,16 @@
if (! isInitializedSR || contextData != contextDataSR )
{
+ if ( ! isInitializedSR )
+ {
+ // refresh all sources/services _once_ before interacting with SuseRegister
+ allCurrentSources = Pkg::SourceStartCache(true);
+ foreach ( integer srcID, allCurrentSources, {
+ y2milestone("Refreshing source with ID: %1", srcID);
+ Pkg::SourceForceRefreshNow(srcID);
+ });
+ }
+
// initialize SuseRegister
contextDataSR = contextData;
y2milestone("Initializing SuseRegister with this context data: %1", contextDataSR);
@@ -1090,10 +1225,8 @@
}
}
-
// ----==== handle modes for suseRegister ====----
-
// special mode for list-params
// only makes sure registration is initialized
if (parameter == `listparams)
@@ -1142,9 +1275,19 @@
if ( parameter == `autoyast )
{
- string foo="bar";
- // TODO
- // call the function to sync the sources from here or from the Write function
+ y2milestone("SuseRegister was called in autoYaST mode. The overall registration satus is: %1", initialSRstatus);
+ if ( initialSRstatus == 1 )
+ {
+ y2error("Manual interaction is required for proper registration which is not possible during autoYaST. Please register manually.");
+ }
+ y2milestone("All sources will be refreshed now.");
+
+ // refresh all sources/services
+ allCurrentSources = Pkg::SourceStartCache(true);
+ foreach ( integer srcID, allCurrentSources, {
+ y2milestone("Refreshing source with ID: %1", srcID);
+ Pkg::SourceForceRefreshNow(srcID);
+ });
}
y2milestone("SuseRegister status: %1", initialSRstatus);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org