47 static const std::string magic(
"43" );
55 std::list<std::string> dircontent;
59 for_( it, dircontent.begin(), dircontent.end() )
64 if ( pi.
mtime() > max_r )
72 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
75 {
return new Impl( *
this ); }
90 : _pimpl( new
Impl() )
94 : _pimpl( new
Impl() )
103 else if ( info.
isDir() )
105 time_t t = info.
mtime();
113 : _pimpl( new
Impl() )
124 std::ifstream file( path_r.
c_str() );
127 WAR <<
"No cookie file " << path_r << endl;
141 std::ofstream file(path_r.
c_str());
164 else if ( rhs.
empty() )
169 std::string lchk( lhs.
_pimpl->_checksum );
170 std::string rchk( rhs.
_pimpl->_checksum );
171 std::stringstream ss( lchk < rchk ? lchk+rchk : rchk+lchk );
174 result.
_pimpl->_timestamp = std::max( lhs.
_pimpl->_timestamp, rhs.
_pimpl->_timestamp );
180 {
return lhs.
_pimpl->_checksum == rhs.
_pimpl->_checksum; }
bool empty() const
Whether the status is empty (default constucted)
const Pathname & path() const
Return current Pathname.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
std::string sha1sum(const Pathname &file)
Compute a files sha1sum.
std::string checksum() const
const char * c_str() const
String representation.
String related utilities and Regular expression matching.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
bool operator==(const SetRelation::Enum &lhs, const SetCompare &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.
void saveToCookieFile(const Pathname &path_r) const
Save the status information to a cookie file.
Store and operate on date (time_t).
void assignFromCtor(std::string &&checksum_r, Date &×tamp_r)
std::ostream & operator<<(std::ostream &str, const Exception &obj)
const std::string & asString() const
String representation.
bool isExist() const
Return whether valid stat info exists.
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 numstring(char n, int w=0)
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.
Date timestamp() const
The time the data were changed the last time.
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
RWCOW_pointer< Impl > _pimpl
Implementation.
Impl * clone() const
clone for RWCOW_pointer
std::ostream & operator<<(std::ostream &str, const RepoStatus::Impl &obj)
Wrapper class for ::stat/::lstat.
static CheckSum sha1(const std::string &checksum)
Track changing files or directories.
RepoStatus operator &&(const RepoStatus &lhs, const RepoStatus &rhs)
Easy-to use interface to the ZYPP dependency resolver.
static CheckSum sha1FromString(const std::string &input_r)