#include "zypp/base/PtrTypes.h"
#include "zypp/Pathname.h"
#include "zypp/ZConfig.h"
-#include "zypp/Repository.h"
#include "zypp/RepoInfo.h"
#include "zypp/repo/RepoException.h"
#include "zypp/repo/RepoType.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ class Service; //predef
/**
* Parses \a repo_file and returns a list of \ref RepoInfo objects
*/
struct RepoManagerOptions
{
- RepoManagerOptions();
+ /** Default ctor following \ref ZConfig global settings.
+ * If an optional \c root_r directory is given, all paths will
+ * be prefixed accordingly.
+ * \code
+ * root_r\repoCachePath
+ * \repoRawCachePath
+ * \repoSolvCachePath
+ * \repoPackagesCachePath
+ * \knownReposPath
+ * \endcode
+ */
+ RepoManagerOptions( const Pathname & root_r = Pathname() );
+
+ /** Test setup adjusting all paths to be located below one \c root_r directory.
+ * \code
+ * root_r\ - repoCachePath
+ * \raw - repoRawCachePath
+ * \solv - repoSolvCachePath
+ * \packages - repoPackagesCachePath
+ * \repos.d - knownReposPath
+ * \endcode
+ */
+ static RepoManagerOptions makeTestSetup( const Pathname & root_r );
Pathname repoCachePath;
Pathname repoRawCachePath;
+ Pathname repoSolvCachePath;
Pathname repoPackagesCachePath;
Pathname knownReposPath;
+ Pathname knownServicesPath;
+ bool probe;
};
+
+
/**
* \short creates and provides information about known sources.
*
/** Implementation */
class Impl;
+ /** service typedefs */
+ typedef std::set<Service> ServiceSet;
+ typedef ServiceSet::const_iterator ServiceConstIterator;
+ typedef ServiceSet::size_type ServiceSizeType;
+
public:
RepoManager( const RepoManagerOptions &options = RepoManagerOptions() );
/** Dtor */
enum RawMetadataRefreshPolicy
{
RefreshIfNeeded,
- RefreshForced
+ RefreshForced,
+ RefreshIfNeededIgnoreDelay
};
enum CacheBuildPolicy
RepoStatus metadataStatus( const RepoInfo &info ) const;
/**
+ * Possibly return state of checkIfRefreshMEtadata function
+ */
+ enum RefreshCheckStatus {
+ REFRESH_NEEDED, /**< refresh is needed */
+ REPO_UP_TO_DATE, /**< repository not changed */
+ REPO_CHECK_DELAYED /**< refresh is delayed due to settings */
+ };
+
+ /**
* Checks whether to refresh metadata for specified repository and url.
* <p>
* The need for refresh is evaluated according to the following conditions,
* {
* // check whether to refresh metadata
* // if the check fails for this url, it throws, so another url will be checked
- * if (!checkIfToRefreshMetadata(info, *it, policy))
+ * if (checkIfToRefreshMetadata(info, *it, policy)!=RepoInfo::REFRESH_NEEDED)
* return;
*
* // do the actual refresh
* \param info
* \param url
* \param policy
+ * \return state of repository
+ * \see RefreshCheckStatus
* \throws RepoUnknownTypeException
* \throws repo::RepoNoAliasException if can't figure an alias
* \throws Exception on unknown error
*
*/
- bool checkIfToRefreshMetadata( const RepoInfo &info,
+ RefreshCheckStatus checkIfToRefreshMetadata( const RepoInfo &info,
const Url &url,
RawMetadataRefreshPolicy policy = RefreshIfNeeded);
*/
Pathname metadataPath( const RepoInfo &info ) const;
+
+ /**
+ * \short Path where the rpm packages are downloaded and kept
+ *
+ * Given a repoinfo, tells where \ref RepoProvidePackage will download
+ * and keep the .rpm files.
+ *
+ * \param info Repository information
+ *
+ * \throws repo::RepoNoAliasException if can't figure an alias
+ */
+ Pathname packagesPath( const RepoInfo &info ) const;
+
+
/**
* \short Refresh local raw cache
*
const url::ViewOption & urlview = url::ViewOption::DEFAULTS,
const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+ void addService( const std::string& name, const Url& url );
+
+ void removeService( const std::string& name );
+
+ bool serviceEmpty() const;
+
+ ServiceSizeType serviceSize() const;
+
+ ServiceConstIterator serviceBegin() const;
+
+ ServiceConstIterator serviceEnd() const;
+
+ const Service& getService( const std::string& name ) const;
+
+ void refreshServices();
+
+ /**
+ * modify service, except name change
+ * ( you need remove and add if you want change name )
+ */
+ void modifyService(const Service& service) const;
+
protected:
RepoStatus rawMetadataStatus( const RepoInfo &info );
- void setCacheStatus( const std::string &alias, const RepoStatus &status );
+ void setCacheStatus( const RepoInfo &info, const RepoStatus &status );
/**
* Update timestamp of repository index file for the specified repository \a info.