Skip to content

Commit

Permalink
merging
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Apr 7, 2016
2 parents 4b9c063 + 762e4e0 commit 328f77f
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Rakefile
@@ -1,5 +1,7 @@
require "yast/rake"

Yast::Tasks.submit_to :sle12sp1

Yast::Tasks.configuration do |conf|
#lets ignore license check for now
conf.skip_license_check << /.*/
Expand Down
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings-devel-doc.spec
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-pkg-bindings-devel-doc
Version: 3.1.33
Version: 3.1.34
Release: 0
License: GPL-2.0
Group: Documentation/HTML
Expand Down
7 changes: 7 additions & 0 deletions package/yast2-pkg-bindings.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Apr 6 15:51:40 CEST 2016 - schubi@suse.de

- Added new call: ServiceForceRefresh
(bnc#967828)
- 3.1.34

-------------------------------------------------------------------
Tue Mar 29 12:32:18 UTC 2016 - igonzalezsosa@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-pkg-bindings
Version: 3.1.33
Version: 3.1.34
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
3 changes: 3 additions & 0 deletions src/PkgFunctions.h
Expand Up @@ -130,6 +130,7 @@ class PkgFunctions
int last_reported_mediumnr;

YCPValue SourceRefreshHelper(const YCPInteger &id, bool forced = false);
YCPValue ServiceRefreshHelper(const YCPString &alias, bool forced = false);

// helper for updating repository manager after changing the target root
// return true if the target root has been changed
Expand Down Expand Up @@ -794,6 +795,8 @@ class PkgFunctions
YCPValue ServiceSet(const YCPString&, const YCPMap&);
/* TYPEINFO: boolean(string)*/
YCPValue ServiceRefresh(const YCPString&);
/* TYPEINFO: boolean(string)*/
YCPValue ServiceForceRefresh(const YCPString&);
/* TYPEINFO: string(string)*/
YCPValue ServiceURL(const YCPString &alias);
/* TYPEINFO: string(string)*/
Expand Down
32 changes: 28 additions & 4 deletions src/Service.cc
Expand Up @@ -359,12 +359,14 @@ YCPValue PkgFunctions::ServiceSet(const YCPString &old_alias, const YCPMap &serv
}

/**
@builtin ServiceRefresh
@short Refresh the service, the service must already be saved on the system!
@builtin ServiceRefreshHelper
@short Helper call for refreshing services
@param alias alias of the service to refresh
@param force force refresh even if TTL is not reached
@return boolean false if failed
*/
YCPValue PkgFunctions::ServiceRefresh(const YCPString &alias)
YCPValue PkgFunctions::ServiceRefreshHelper(const YCPString &alias, bool force)
{
try
{
Expand All @@ -378,7 +380,7 @@ YCPValue PkgFunctions::ServiceRefresh(const YCPString &alias)

zypp::RepoManager* repomanager = CreateRepoManager();

if (!service_manager.RefreshService(alias_str, *repomanager))
if (!service_manager.RefreshService(alias_str, *repomanager, force))
{
return YCPBoolean(false);
}
Expand Down Expand Up @@ -448,6 +450,28 @@ YCPValue PkgFunctions::ServiceRefresh(const YCPString &alias)
return YCPBoolean(false);
}

/**
@builtin ServiceRefresh
@short Refresh the service, the service must already be saved on the system!
@param alias alias of the service to refresh
@return boolean false if failed
*/
YCPValue PkgFunctions::ServiceRefresh(const YCPString &alias)
{
return ServiceRefreshHelper(alias, false);
}

/**
@builtin ServiceForceRefresh
@short Service forced refresh, the service must already be saved on the system!
@param alias alias of the service to refresh
@return boolean false if failed
*/
YCPValue PkgFunctions::ServiceForceRefresh(const YCPString &alias)
{
return ServiceRefreshHelper(alias, true);
}

/**
@builtin ServiceProbe
@short Probe service type at a URL
Expand Down
11 changes: 9 additions & 2 deletions src/ServiceManager.cc
Expand Up @@ -107,7 +107,7 @@ bool ServiceManager::SaveService(const std::string &alias, zypp::RepoManager &re
return true;
}

bool ServiceManager::RefreshService(const std::string &alias, zypp::RepoManager &repomgr)
bool ServiceManager::RefreshService(const std::string &alias, zypp::RepoManager &repomgr, bool force)
{
PkgServices::iterator serv_it = _known_services.find(alias);

Expand All @@ -117,7 +117,14 @@ bool ServiceManager::RefreshService(const std::string &alias, zypp::RepoManager
return false;
}

repomgr.refreshService(serv_it->second);
if (force)
{
repomgr.refreshService(serv_it->second, zypp::RepoManager::RefreshService_forceRefresh);
}
else
{
repomgr.refreshService(serv_it->second);
}

// load the service from disk
PkgService new_service(repomgr.getService(alias), alias);
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceManager.h
Expand Up @@ -54,7 +54,7 @@ class ServiceManager

bool SetService(const std::string &old_alias, const zypp::ServiceInfo &srv);

bool RefreshService(const std::string &alias, zypp::RepoManager &repomgr);
bool RefreshService(const std::string &alias, zypp::RepoManager &repomgr, bool force = false);

std::string Probe(const zypp::Url &url, const zypp::RepoManager &repomgr) const;

Expand Down

0 comments on commit 328f77f

Please sign in to comment.