feature #301904 Whole software management stack should warn about oudated update repo
TODO: repo2solv.sh should use repomdxml2solv to insert the expire attributes
Testcase for zypp::Repository new API.
Use it in any application
return _repo->name;
}
+ zypp::Date Repository::generatedTimestamp() const
+ {
+ ::Dataiterator di;
+ ::dataiterator_init(&di, get(), -1, 0, 0, SEARCH_EXTRA | SEARCH_NO_STORAGE_SOLVABLE);
+ if (::dataiterator_step(&di))
+ {
+ do
+ {
+ switch (di.key->name)
+ {
+ case REPOSITORY_TIMESTAMP:
+ {
+ return di.kv.num;
+ break;
+ }
+ }
+ }
+ while (::dataiterator_step(&di));
+ }
+ else
+ ERR << "the extra does not exist in the repo" << endl;
+ }
+
+
+ zypp::Date Repository::expirationTimestamp() const
+ {
+ ::Dataiterator di;
+ ::dataiterator_init(&di, get(), -1, 0, 0, SEARCH_EXTRA | SEARCH_NO_STORAGE_SOLVABLE);
+ if (::dataiterator_step(&di))
+ {
+ do
+ {
+ switch (di.key->name)
+ {
+ case REPOSITORY_EXPIRE:
+ {
+ return generatedTimestamp() + di.kv.num;
+ break;
+ }
+ }
+ }
+ while (::dataiterator_step(&di));
+ }
+ else
+ ERR << "the extra does not exist in the repo" << endl;
+ }
+
+
+ bool Repository::maybeOutdated() const
+ {
+ return expirationTimestamp() < Date::now();
+ }
+
bool Repository::solvablesEmpty() const
{
NO_REPOSITORY_RETURN( true );
#include "zypp/sat/detail/PoolMember.h"
#include "zypp/sat/Solvable.h"
#include "zypp/RepoInfo.h"
+#include "zypp/Date.h"
+extern "C"
+{
+#include "satsolver/repo.h"
+}
///////////////////////////////////////////////////////////////////
namespace zypp
ZYPP_DEPRECATED std::string name() const
{ return alias(); }
+ /**
+ * Timestamp when this repository was generated
+ */
+ zypp::Date generatedTimestamp() const;
+
+ /**
+ * Expiration date
+ */
+ zypp::Date expirationTimestamp() const;
+
+ /**
+ * The expiration date of this repository
+ * already passed
+ */
+ bool maybeOutdated() const;
/** Whether \ref Repository contains solvables. */
bool solvablesEmpty() const;
const SolvAttr SolvAttr::productOptionalurls ( PRODUCT_OPTIONALURLS );
const SolvAttr SolvAttr::productFlags ( PRODUCT_FLAGS );
+ // repository
+ const SolvAttr SolvAttr::repositoryTimestamp ( REPOSITORY_TIMESTAMP );
+ const SolvAttr SolvAttr::repositoryExpire ( REPOSITORY_EXPIRE );
+
+
} // namespace sat
/////////////////////////////////////////////////////////////////
} // namespace zypp
static const SolvAttr productFlags;
//@}
+ /** \name repository */
+ //@{
+ static const SolvAttr repositoryTimestamp;
+ static const SolvAttr repositoryExpire;
+ //@}
+
//@}
public:
/** Default ctor: \ref noAttr */