Mailinglist Archive: yast-commit (459 mails)

< Previous Next >
[yast-commit] r60851 - in /branches/SuSE-Code-11-Branch/wagon: package/yast2-wagon.changes src/clients/wagon.ycp src/clients/wagon_migration_products.ycp src/include/common_func.ycp
  • From: locilka@xxxxxxxxxxxxxxxx
  • Date: Thu, 18 Feb 2010 16:21:55 -0000
  • Message-id: <E1Ni98V-0007dy-9P@xxxxxxxxxxxxxxxx>
Author: locilka
Date: Thu Feb 18 17:21:54 2010
New Revision: 60851

URL: http://svn.opensuse.org/viewcvs/yast?rev=60851&view=rev
Log:
- Disabling also repositories that provide installed products (as
packages) but do not describe products in metadata (BNC #579905).


Modified:
branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes
branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp
branches/SuSE-Code-11-Branch/wagon/src/clients/wagon_migration_products.ycp
branches/SuSE-Code-11-Branch/wagon/src/include/common_func.ycp

Modified: branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes?rev=60851&r1=60850&r2=60851&view=diff
==============================================================================
--- branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes (original)
+++ branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes Thu Feb 18
17:21:54 2010
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Feb 18 17:18:03 CET 2010 - locilka@xxxxxxx
+
+- Disabling also repositories that provide installed products (as
+ packages) but do not describe products in metadata (BNC #579905).
+
+-------------------------------------------------------------------
Fri Feb 5 16:12:02 CET 2010 - locilka@xxxxxxx

- Adjusting default values for sending optional data during

Modified: branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp?rev=60851&r1=60850&r2=60851&view=diff
==============================================================================
--- branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp (original)
+++ branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp Thu Feb 18
17:21:54 2010
@@ -194,11 +194,6 @@

ResetPackager();

- // Full paths to product files
- list <string> removed_product_files = [];
- // Product packages
- list <string> removed_packages = [];
-
Wizard::SetContents (
_("Reverting Migration"),
`Label(_("Removing temporary migration products...")),
@@ -224,6 +219,9 @@
Pkg::SourceSaveAll();
Wagon::InitPkg();

+ // Packages removed by this run
+ list <string> removed_packages = [];
+
// Remove all the migration products using packages approach manually
// Removing via ResolvableRemove + PkgSolve usually produces errors,
// dependency loops etc.
@@ -233,28 +231,14 @@
foreach (map <string, any> remove_product,
Pkg::ResolvableProperties (migration_product, `product, ""), {
remove_product = Wagon::MinimizeProductMap (remove_product);

- string product_file = remove_product["product_file"]:"";
- if (product_file == nil || product_file == "") {
- y2error ("Cannot remove product: %1, no product file
defined", remove_product);
- Report::Error (sformat(_("Cannot remove product %1"),
remove_product["name"]:_("Unknown product")));
- return;
- }
+ string package_name = GetProductPackageName (remove_product);

- if (! regexpmatch (product_file, "^/etc/products\\.d/.+"))
- product_file = sformat ("/etc/products.d/%1", product_file);
-
- if (contains (removed_product_files, product_file)) {
- y2milestone ("Product file %1 has been already removed",
product_file);
+ if (package_name == "")
return;
- }
-
- string package_name = Wagon::GetFileOwner (product_file);

- if (package_name == nil || package_name == "") {
- y2error ("Cannot find out file owner %1", product_file);
- Report::Error (sformat(_("Cannot remove product %1"),
remove_product["name"]:_("Unknown product")));
+ // Package has been already removed
+ if (contains (removed_packages, package_name))
return;
- }

if (Pkg::TargetRemove (package_name) != true) {
y2error ("Cannot remove package %1", package_name);
@@ -264,7 +248,8 @@
}

y2milestone ("Product %1/%2 has been successfully removed",
remove_product, package_name);
- removed_product_files = add (removed_product_files,
product_file);
+
+ // Do not try to remove it again
removed_packages = add (removed_packages, package_name);
});
});

Modified:
branches/SuSE-Code-11-Branch/wagon/src/clients/wagon_migration_products.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/wagon/src/clients/wagon_migration_products.ycp?rev=60851&r1=60850&r2=60851&view=diff
==============================================================================
--- branches/SuSE-Code-11-Branch/wagon/src/clients/wagon_migration_products.ycp
(original)
+++ branches/SuSE-Code-11-Branch/wagon/src/clients/wagon_migration_products.ycp
Thu Feb 18 17:21:54 2010
@@ -150,17 +150,20 @@

list <map <string,any> > products = Pkg::ResolvableProperties ("",
`product, "");

- foreach (map<string, any> p, products, {
+ // all known products
+ products = filter (map<string, any> p, products, {
+ // skip those not installed ones
if (p["status"]:`unknown != `installed) {
y2milestone ("Product %1 (%2) is not installed, skipping...",
p["name"]:"not-defined",
p["short_name"]:p["display_name"]:"not-defined");
- return;
+ return false;
}

+ // skip those that do not provide 'upgrades' section
if (! haskey (p, "upgrades") || p["upgrades"]:[] == []) {
y2warning ("Product %1 (%2) does not contain 'upgrades'
section...",
p["name"]:"not-defined",
p["short_name"]:p["display_name"]:"not-defined");
- return;
+ return false;
}

y2milestone ("Going to disable repositories providing product %1
(%2)",
@@ -169,36 +172,69 @@
if (p["name"]:"" == nil || p["name"]:"" == "") {
y2error ("Product %1 doesn't have a name, reverting will be
impossible", p);
Report::Error (sformat(_("Product %1 does not have a
machine-readable 'name'.
-Cannot disable ."), p["short_name"]:p["display_name"]:"not-defined"));
+It cannot be disabled."), p["short_name"]:p["display_name"]:"not-defined"));
+ return false;
}

- // Find all available products
+ return true;
+ });
+
+ // all installed, those that provide 'upgrades' section, and have a name
+ foreach (map<string, any> p, products, {
+ // Find all available matching products
list <map <string, any> > matching_products =
Pkg::ResolvableProperties (p["name"]:"", `product, "");
matching_products = filter (map <string, any> one_product,
matching_products, {
return (one_product["status"]:`unknown == `available);
});

- if (matching_products == nil || size (matching_products) == 0) {
- y2error ("Nothing provides product: '%1'", p["name"]:"");
- Report::Error (sformat(_("No repository provides product %1
(%2).
-Migration might not work."),
- p["name"]:"not-defined",
p["short_name"]:p["display_name"]:"not-defined"));
- }
-
+ list <integer> product_repos = [];
integer repo_id = nil;
map repo_details = nil;

- foreach (map <string, any> one_product, matching_products, {
- repo_id = one_product["source"]:-1;
+ // installed product is not available anymore
+ if (matching_products == nil || size (matching_products) == 0) {
+ matching_products = [];
+ y2warning ("Nothing provides `available product: '%1'",
p["name"]:"");
+ } else {
+ foreach (map <string, any> one_product, matching_products, {
+ repo_id = one_product["source"]:-1;
+
+ if (repo_id == nil || repo_id < 0) {
+ y2error ("Available product with wrong source id: %1",
Wagon::MinimizeProductMap (one_product));
+ } else {
+ y2milestone ("Repo %1 will be disabled, provides
product %2", repo_id, p["name"]:"");
+ product_repos = add (product_repos, repo_id);
+ }
+ });
+ }

- if (repo_id < 0) {
- y2error ("Available product with source<0: %1",
Wagon::MinimizeProductMap (one_product));
+ // BNC #579905: Some repositories provide packages with products
but these products
+ // are not mentioned in metadata. We have to disable also these
repositories.
+ string inst_product_package_name = GetProductPackageName (p);
+ list <map <string, any> > matching_packages =
Pkg::ResolvableProperties (inst_product_package_name, `package, "");
+
+ foreach (map <string, any> one_package, matching_packages, {
+ // operate with available packages only
+ if (one_package["status"]:`unknown != `available)
return;
+
+ repo_id = one_package["source"]:-1;
+
+ if (repo_id == nil || repo_id < 0) {
+ y2error ("Available package with wrong source id: %1",
Wagon::MinimizeProductMap (one_package));
+ } else {
+ y2milestone ("Repo %1 will be disabled, provides product
package %2", repo_id, inst_product_package_name);
+ product_repos = add (product_repos, repo_id);
}
+ });

+ // Check all
+ foreach (integer repo_id, product_repos, {
repo_details = Pkg::SourceGeneralData (repo_id);
Wagon::repositories_to_disable = add
(Wagon::repositories_to_disable, repo_details["alias"]:"");
});
+
+ Wagon::repositories_to_disable = toset
(Wagon::repositories_to_disable);
});

y2milestone ("Repositories to be disabled later: %1",
Wagon::repositories_to_disable);

Modified: branches/SuSE-Code-11-Branch/wagon/src/include/common_func.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/wagon/src/include/common_func.ycp?rev=60851&r1=60850&r2=60851&view=diff
==============================================================================
--- branches/SuSE-Code-11-Branch/wagon/src/include/common_func.ycp (original)
+++ branches/SuSE-Code-11-Branch/wagon/src/include/common_func.ycp Thu Feb 18
17:21:54 2010
@@ -24,6 +24,7 @@
import "Wagon";
import "Wizard";
import "GetInstArgs";
+ import "Report";

boolean SolverRunWithFeedback () {
UI::OpenDialog (`Label (_("Solving the package dependencies...")));
@@ -171,4 +172,52 @@
y2warning ("Undefined how to handled suse_register optional data");
}
}
+
+ // Full paths to product files
+ map <string, string> checked_product_files = $[];
+
+ /**
+ * Finds a package that provides the required product
+ * defined by parameter.
+ *
+ * @return string product_package
+ */
+ string GetProductPackageName (map <string, any> product) {
+ product = Wagon::MinimizeProductMap (product);
+ string product_file = product["product_file"]:"";
+
+ // undefined product file
+ if (product_file == nil || product_file == "") {
+ y2error ("Cannot remove product: %1, no product file defined",
product);
+ Report::Error (sformat(_("Cannot remove product %1"),
product["name"]:_("Unknown product")));
+ return "";
+ }
+
+ // unify the product file path
+ if (! regexpmatch (product_file, "^/etc/products\\.d/.+"))
+ product_file = sformat ("/etc/products.d/%1", product_file);
+
+ // use a cached value
+ if (haskey (checked_product_files, product_file)) {
+ if (checked_product_files[product_file]:"" == "") {
+ return "";
+ } else {
+ return checked_product_files[product_file]:"";
+ }
+ }
+
+ string package_name = Wagon::GetFileOwner (product_file);
+
+ // no package owns the file
+ if (package_name == nil || package_name == "") {
+ y2error ("Cannot find out file owner %1", product_file);
+ Report::Error (sformat(_("Cannot find out owner of product %1"),
product["name"]:_("Unknown product")));
+ return "";
+ }
+
+ // cache the value
+ checked_product_files[product_file] = package_name;
+
+ return package_name;
+ }
}

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

< Previous Next >
This Thread
  • No further messages