40 std::list<std::string> dircontent;
44 for_( it, dircontent.begin(), dircontent.end() )
46 PathInfo pi( dir_r + *it, PathInfo::LSTAT );
49 if ( pi.mtime() > max_r )
51 recursive_timestamp( pi.path(), max_r );
57 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
60 {
return new Impl( *
this ); }
74 RepoStatus::RepoStatus()
75 : _pimpl( new
Impl() )
79 : _pimpl( new
Impl() )
81 PathInfo info( path_r );
89 else if ( info.isDir() )
91 time_t t = info.mtime();
100 static const std::string magic(
"42" );
111 std::ifstream file( path_r.c_str() );
114 WAR <<
"No cookie file " << path_r << endl;
128 std::ofstream file(path_r.c_str());
143 {
return str << *obj.
_pimpl; }
151 else if ( rhs.
empty() )
156 std::string lchk( lhs.
_pimpl->_checksum );
157 std::string rchk( rhs.
_pimpl->_checksum );
158 stringstream ss( lchk < rchk ? lchk+rchk : rchk+lchk );
161 result.
_pimpl->_timestamp = std::max( lhs.
_pimpl->_timestamp, rhs.
_pimpl->_timestamp );
167 {
return lhs.
_pimpl->_checksum == rhs.
_pimpl->_checksum; }
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Date timestamp() const
The time the data were changed the last time.
std::string sha1sum(const Pathname &file)
Compute a files sha1sum.
bool empty() const
Whether the status is empty (default constucted)
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
RepoStatus operator&&(const RepoStatus &lhs, const RepoStatus &rhs)
RepoStatus()
Default ctor.
static RepoStatus fromCookieFile(const Pathname &path)
Reads the status from a cookie file.
static void recursive_timestamp(const Pathname &dir_r, time_t &max_r)
Recursive computation of max dir timestamp.
Store and operate on date (time_t).
std::ostream & operator<<(std::ostream &str, const Exception &obj)
std::string getline(std::istream &str, const Trim trim_r)
Return stream content up to (but not returning) the next newline.
std::string stripLastWord(std::string &line, const bool rtrim_first)
std::string checksum() const
std::string numstring(char n, int w=0)
Impl * clone() const
clone for RWCOW_pointer
RepoStatus implementation.
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
Base class for Exception.
RWCOW_pointer< Impl > _pimpl
Implementation.
std::ostream & operator<<(std::ostream &str, const RepoStatus::Impl &obj)
static CheckSum sha1(const std::string &checksum)
Track changing files or directories.
static CheckSum sha1FromString(const std::string &input_r)