Skip to content

Commit

Permalink
refresh and load repositories added by a service
Browse files Browse the repository at this point in the history
- 3.1.4
  • Loading branch information
Ladislav Slezak committed Feb 13, 2014
1 parent 4566b3e commit 4d277d9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings-devel-doc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-pkg-bindings-devel-doc
Version: 3.1.3
Version: 3.1.4
Release: 0
License: GPL-2.0
Group: Documentation/HTML
Expand Down
7 changes: 7 additions & 0 deletions package/yast2-pkg-bindings.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Feb 13 16:35:53 UTC 2014 - lslezak@suse.cz

- Pkg::ServiceRefresh() - add, refresh and load also the new added
repositories from the service
- 3.1.4

-------------------------------------------------------------------
Fri Jan 10 09:02:41 UTC 2014 - lslezak@suse.cz

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-pkg-bindings
Version: 3.1.3
Version: 3.1.4
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
30 changes: 29 additions & 1 deletion src/Service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include "PkgFunctions.h"
#include "PkgProgress.h"
#include "log.h"

#include <ycp/YCPValue.h>
Expand Down Expand Up @@ -372,9 +373,11 @@ YCPValue PkgFunctions::ServiceRefresh(const YCPString &alias)
return YCPBoolean(false);
}

const std::string alias_str(alias->value());

zypp::RepoManager* repomanager = CreateRepoManager();

if (!service_manager.RefreshService(alias->value(), *repomanager))
if (!service_manager.RefreshService(alias_str, *repomanager))
{
return YCPBoolean(false);
}
Expand Down Expand Up @@ -403,6 +406,31 @@ YCPValue PkgFunctions::ServiceRefresh(const YCPString &alias)
}
}

// check whether there are new added repositories and load them
std::list<zypp::RepoInfo> reps = repomanager->knownRepositories();
for (std::list<zypp::RepoInfo>::iterator it = reps.begin();
it != reps.end(); ++it)
{
if (it->service() == alias_str && !logFindAlias(it->alias()))
continue;

y2milestone("Service added a new repository: %s", it->alias().c_str());
YRepo_Ptr new_repo = new YRepo(*it);
repos.push_back(new_repo);

if (it->enabled())
{
y2milestone("Refreshing service: %s", it->alias().c_str());
// refresh and load resolvables
PkgProgress pkgprogress(_callbackHandler);
zypp::ProgressData progress(100);
progress.sendTo(pkgprogress.Receiver());
zypp::CombinedProgressData subprogrcv_ref(progress, 20);

LoadResolvablesFrom(new_repo, subprogrcv_ref);
}
}

return YCPBoolean(true);
}
catch (const zypp::Exception& excpt)
Expand Down

0 comments on commit 4d277d9

Please sign in to comment.