{
static char buf[256];
string result;
- char * tmp = ::cuserid(buf);
+ char * tmp = ::cuserid(buf);
if (tmp)
{
result = string(tmp);
}
/////////////////////////////////////////////////////////////////////////
-
+
void HistoryLog::install( const PoolItem & pi )
{
const Package::constPtr p = asKind<Package>(pi.resolvable());
<< _sep << p->repoInfo().alias() // 7 repo alias
<< _sep << p->checksum().checksum(); // 8 checksum
- _log << endl;
+ _log << endl;
//_log << pi << endl;
}
// we don't have checksum in rpm db
// << _sep << p->checksum().checksum(); // x checksum
- _log << endl;
+ _log << endl;
//_log << pi << endl;
}
{
_log
<< timestamp() // 1 timestamp
- << _sep << HistoryActionID::REPO_ADD.asString(true) // 2 action
+ << _sep << HistoryActionID::REPO_ADD.asString(true) // 2 action
<< _sep << str::escape(repo.alias(), _sep) // 3 alias
// what about the rest of the URLs??
<< _sep << *repo.baseUrlsBegin() // 4 primary URL
{
_log
<< timestamp() // 1 timestamp
- << _sep << HistoryActionID::REPO_REMOVE.asString(true) // 2 action
+ << _sep << HistoryActionID::REPO_REMOVE.asString(true) // 2 action
<< _sep << str::escape(repo.alias(), _sep) // 3 alias
<< endl;
}
<< _sep << str::escape(oldrepo.alias(), _sep) // 3 old alias
<< _sep << str::escape(newrepo.alias(), _sep); // 4 new alias
}
-
+
if (*oldrepo.baseUrlsBegin() != *newrepo.baseUrlsBegin())
{
_log
{
class PoolItem;
class RepoInfo;
-
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : HistoryLog
//
/**
* Enumeration of known history actions.
- *
+ *
* \ingroup g_EnumerationClass
*/
struct HistoryActionID
ID toEnum() const { return _id; }
- HistoryActionID::ID parse(const std::string & strval_r);
+ static HistoryActionID::ID parse(const std::string & strval_r);
const std::string & asString(bool pad = false) const;
+ private:
ID _id;
};
* HistoryLog().comment(someMessage);
* }
* </code>
- *
+ *
* \note Take care to set proper target root dir if needed. Either pass
* it via the constructor, or set it via setRoot(Pathname) method.
* The default location of the file is determined by
* \ref ZConfig::historyLogPath() which defaults to
* /var/log/zypp/history.
- *
+ *
* \see http://en.opensuse.org/Libzypp/Package_History
+ *
+ * \todo Static private stuff does not need to be mentioned here in the
+ * header (use an annon. namespace in the .cc). Appart from that the
+ * implementation as signleton is questionable. Use shared_ptr instead of
+ * handcrafted ref/unref. Manage multiple logs at different locations.
*/
class HistoryLog
{
/**
* Set new root directory to the default history log file path.
- *
+ *
* This path will be prepended to the default log file path. This should
* be done where there is a potential that the target root has changed.
- *
+ *
* \param root new root directory.
*/
static void setRoot( const Pathname & root );
/**
* Log a comment (even multiline).
- *
+ *
* \param comment the comment
* \param timestamp whether to include a timestamp at the start of the comment
*/
void comment( const std::string & comment, bool timestamp = false );
-
+
/**
* Log installation (or update) of a package.
*/
void install( const PoolItem & pi );
-
+
/**
* Log removal of a package
*/
/**
* Log a newly added repository.
- *
+ *
* \param repo info about the added repository
*/
void addRepository( const RepoInfo & repo );
-
+
/**
* Log recently removed repository.
- *
+ *
* \param repo info about the removed repository
*/
void removeRepository( const RepoInfo & repo );
-
+
/**
* Log certain modifications to a repository.
- *
+ *
* \param oldrepo info about the old repository
* \param newrepo info about the new repository
- */
+ */
void modifyRepository( const RepoInfo & oldrepo, const RepoInfo & newrepo );
};
///////////////////////////////////////////////////////////////////