Author: lslezak
Date: Fri Jan 8 18:11:04 2010
New Revision: 60300
URL: http://svn.opensuse.org/viewcvs/yast?rev=60300&view=rev
Log:
- Pkg::ResolvableProperties() - return product file and it's
upgrades section for `product resolvables (bnc#559554)
- 2.17.39.1
Modified:
branches/SuSE-Code-11-Branch/pkg-bindings/VERSION
branches/SuSE-Code-11-Branch/pkg-bindings/package/yast2-pkg-bindings.changes
branches/SuSE-Code-11-Branch/pkg-bindings/src/Resolvable_Properties.cc
branches/SuSE-Code-11-Branch/pkg-bindings/yast2-pkg-bindings.spec.in
Modified: branches/SuSE-Code-11-Branch/pkg-bindings/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/pkg-bindings/VERSION?rev=60300&r1=60299&r2=60300&view=diff
==============================================================================
--- branches/SuSE-Code-11-Branch/pkg-bindings/VERSION (original)
+++ branches/SuSE-Code-11-Branch/pkg-bindings/VERSION Fri Jan 8 18:11:04 2010
@@ -1 +1 @@
-2.17.39
+2.17.39.1
Modified: branches/SuSE-Code-11-Branch/pkg-bindings/package/yast2-pkg-bindings.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/pkg-bindings/package/yast2-pkg-bindings.changes?rev=60300&r1=60299&r2=60300&view=diff
==============================================================================
--- branches/SuSE-Code-11-Branch/pkg-bindings/package/yast2-pkg-bindings.changes (original)
+++ branches/SuSE-Code-11-Branch/pkg-bindings/package/yast2-pkg-bindings.changes Fri Jan 8 18:11:04 2010
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Jan 8 13:00:43 UTC 2010 - lslezak@suse.cz
+
+- Pkg::ResolvableProperties() - return product file and it's
+ upgrades section for `product resolvables (bnc#559554)
+- 2.17.39.1
+
+-------------------------------------------------------------------
Fri Jul 10 11:18:04 CEST 2009 - lslezak@suse.cz
- clean existing cache for added repositories, do not reuse
Modified: branches/SuSE-Code-11-Branch/pkg-bindings/src/Resolvable_Properties.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/pkg-bindings/src/Resolvable_Properties.cc?rev=60300&r1=60299&r2=60300&view=diff
==============================================================================
--- branches/SuSE-Code-11-Branch/pkg-bindings/src/Resolvable_Properties.cc (original)
+++ branches/SuSE-Code-11-Branch/pkg-bindings/src/Resolvable_Properties.cc Fri Jan 8 18:11:04 2010
@@ -45,6 +45,8 @@
#include
#include
+#include
+#include
/**
@builtin ResolvableProperties
@@ -89,6 +91,13 @@
+ "description"
+ "display_name"
+ "short_name"
+ + "product_file" -> string : product file (full file name with target root prefix)
+ + "upgrades" -> list<map> : parsed data from the product file (upgrades section)
+ + "name" -> string
+ + "summary" -> string
+ + "repository" -> string : URL path
+ + "notify" -> boolean
+ + "status" -> string
`patch keys:
+ "interactive"
+ "reboot_needed"
@@ -370,6 +379,75 @@
info->add(YCPString("replaces"), rep_prods);
}
+
+ std::string product_file;
+
+ // add reference file in /etc/products.d
+ if (status.isInstalled())
+ {
+ product_file = (_target_root + "/etc/products.d/" + product->referenceFilename()).asString();
+ y2milestone("Parsing product file %s", product_file.c_str());
+ const zypp::parser::ProductFileData productFileData = zypp::parser::ProductFileReader::scanFile(product_file);
+
+ YCPList upgrade_list;
+
+ for_( upit, productFileData.upgrades().begin(), productFileData.upgrades().end() )
+ {
+ const zypp::parser::ProductFileData::Upgrade & upgrade( *upit );
+
+ YCPMap upgrades;
+ upgrades->add(YCPString("name"), YCPString(upgrade.name()));
+ upgrades->add(YCPString("summary"), YCPString(upgrade.summary()));
+ upgrades->add(YCPString("repository"), YCPString(upgrade.repository()));
+ upgrades->add(YCPString("notify"), YCPBoolean(upgrade.notify()));
+ upgrades->add(YCPString("status"), YCPString(upgrade.status()));
+
+ upgrade_list->add(upgrades);
+ }
+
+ info->add(YCPString("upgrades"), upgrade_list);
+ }
+ else
+ {
+ // get the package
+ zypp::sat::Solvable refsolvable = product->referencePackage();
+
+ if (refsolvable != zypp::sat::Solvable::noSolvable)
+ {
+ // create a package pointer from the SAT solvable
+ zypp::Package::Ptr refpkg(zypp::makezypp::Package(refsolvable));
+
+ if (refpkg)
+ {
+ // get the package files
+ zypp::Package::FileList files( refpkg->filelist() );
+ y2milestone("The reference package has %d files", files.size());
+
+ zypp::str::smatch what;
+ const zypp::str::regex product_file_regex("^/etc/products\\.d/(.*\\.prod)$");
+
+ // find the product file
+ for_(iter, files.begin(), files.end())
+ {
+ if (zypp::str::regex_match(*iter, what, product_file_regex))
+ {
+ product_file = what[1];
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (product_file.empty())
+ {
+ y2warning("The product file has not been found");
+ }
+ else
+ {
+ y2milestone("Found product file %s", product_file.c_str());
+ info->add(YCPString("product_file"), YCPString(product_file));
+ }
}
// pattern specific info
else if ( req_kind == "pattern" ) {
Modified: branches/SuSE-Code-11-Branch/pkg-bindings/yast2-pkg-bindings.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/pkg-bindings/yast2-pkg-bindings.spec.in?rev=60300&r1=60299&r2=60300&view=diff
==============================================================================
--- branches/SuSE-Code-11-Branch/pkg-bindings/yast2-pkg-bindings.spec.in (original)
+++ branches/SuSE-Code-11-Branch/pkg-bindings/yast2-pkg-bindings.spec.in Fri Jan 8 18:11:04 2010
@@ -2,10 +2,10 @@
@HEADER@
BuildRequires: blocxx-devel docbook-xsl-stylesheets doxygen gcc-c++ libgcrypt-devel libxcrypt-devel libxslt perl-XML-Writer sgml-skel yast2-core-devel yast2-devtools
-BuildRequires: libzypp-devel >= 5.24.7
+# <upgrades> section support (bnc#559554)
+BuildRequires: libzypp-devel >= 5.30.21
-# new GPG callbacks
-Requires: libzypp >= 5.24.7
+Requires: libzypp >= 5.30.21
Summary: -
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org