Mailinglist Archive: yast-commit (396 mails)

< Previous Next >
[yast-commit] r65224 - in /trunk/pkg-bindings: package/yast2-pkg-bindings.changes src/PkgFunctions.cc src/PkgFunctions.h
Author: lslezak
Date: Thu Aug 4 17:00:42 2011
New Revision: 65224

URL: http://svn.opensuse.org/viewcvs/yast?rev=65224&view=rev
Log:
- added Pkg::SetZConfig() to change some libzypp options at runtime
e.g. prefer CD/DVD to dowload during installation/update
(bnc#693230)

Modified:
trunk/pkg-bindings/package/yast2-pkg-bindings.changes
trunk/pkg-bindings/src/PkgFunctions.cc
trunk/pkg-bindings/src/PkgFunctions.h

Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=65224&r1=65223&r2=65224&view=diff
==============================================================================
--- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original)
+++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Thu Aug 4 17:00:42
2011
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Thu Aug 4 14:42:32 UTC 2011 - lslezak@xxxxxxx
+
+- added Pkg::SetZConfig() to change some libzypp options at runtime
+ e.g. prefer CD/DVD to dowload during installation/update
+ (bnc#693230)
+
+-------------------------------------------------------------------
Tue Aug 2 11:02:34 UTC 2011 - lslezak@xxxxxxx

- set ignoreAlreadyRecommended solver flag by default - make the

Modified: trunk/pkg-bindings/src/PkgFunctions.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgFunctions.cc?rev=65224&r1=65223&r2=65224&view=diff
==============================================================================
--- trunk/pkg-bindings/src/PkgFunctions.cc (original)
+++ trunk/pkg-bindings/src/PkgFunctions.cc Thu Aug 4 17:00:42 2011
@@ -285,6 +285,7 @@
/**
* @builtin ZConfig
* @short get the current libzypp configuration
+ * Return current libzypp configuration. See /etc/zypp/zypp.conf for more
details
* @return map<string,any> libzypp configuration map
*/
YCPValue PkgFunctions::ZConfig()
@@ -383,3 +384,71 @@

return ret;
}
+
+/**
+ * @builtin SetZConfig
+ * @short set the current libzypp configuration
+ * This is a set counterpart to Pkg::ZConfig(). Note that the set of options
which can be changed is very limited.
+ * Currently supported values: $[ "download_media_prefer_download" : boolean,
+ * "update_messages_notify" : string,
+ * "solver_upgrade_remove_dropped_packages" : boolean ]
+ * @return boolean true on success
+ */
+YCPValue PkgFunctions::SetZConfig(const YCPMap &cfg)
+{
+ zypp::ZConfig &zconfig = zypp::ZConfig::instance();
+
+ const char *key = "download_media_prefer_download";
+ if(!cfg->value(YCPString(key)).isNull())
+ {
+ const YCPValue val = cfg->value(YCPString(key));
+ if (val->isBoolean())
+ {
+ const bool prefer_download = val->asBoolean()->value();
+ y2milestone("new download_media_prefer_download value: %s",
prefer_download ? "true" : "false");
+ zconfig.set_download_media_prefer_download(prefer_download);
+ }
+ else
+ {
+ y2error("Expected boolean value for '%s' key, found %s", key,
val->toString().c_str());
+ return YCPBoolean(false);
+ }
+ }
+
+ key = "update_messages_notify";
+ if(!cfg->value(YCPString(key)).isNull())
+ {
+ const YCPValue val = cfg->value(YCPString(key));
+ if (val->isString())
+ {
+ const std::string notify(val->asString()->value());
+ y2milestone("new update_messages_notify value: %s", notify.c_str());
+ zconfig.setUpdateMessagesNotify(notify);
+ }
+ else
+ {
+ y2error("Expected string value for '%s' key, found %s", key,
val->toString().c_str());
+ return YCPBoolean(false);
+ }
+ }
+
+ key = "solver_upgrade_remove_dropped_packages";
+ if(!cfg->value(YCPString(key)).isNull())
+ {
+ const YCPValue val = cfg->value(YCPString(key));
+ if (val->isBoolean())
+ {
+ const bool drop_packages = val->asBoolean()->value();
+ y2milestone("new solver_upgrade_remove_dropped_packages value: %s",
drop_packages ? "true" : "false");
+ zconfig.setSolverUpgradeRemoveDroppedPackages(drop_packages);
+ }
+ else
+ {
+ y2error("Expected boolean value for '%s' key, found %s", key,
val->toString().c_str());
+ return YCPBoolean(false);
+ }
+ }
+
+ return YCPBoolean(true);
+}
+

Modified: trunk/pkg-bindings/src/PkgFunctions.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgFunctions.h?rev=65224&r1=65223&r2=65224&view=diff
==============================================================================
--- trunk/pkg-bindings/src/PkgFunctions.h (original)
+++ trunk/pkg-bindings/src/PkgFunctions.h Thu Aug 4 17:00:42 2011
@@ -844,6 +844,8 @@
// configuration related functions
/* TYPEINFO: map<string,any>()*/
YCPValue ZConfig();
+ /* TYPEINFO: boolean(map<string,any>)*/
+ YCPValue SetZConfig(const YCPMap &cfg);

YCPValue ResolvablePropertiesEx(const YCPString& name, const
YCPSymbol& kind_r, const YCPString& version, bool dependencies);
YCPValue ResolvableSetPatches(const YCPSymbol& kind_r, bool preselect);

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

< Previous Next >
This Thread
  • No further messages