[zypp-devel] new: HistoryLogReader
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 FYI: zypp/parser/HistoryLogReader is now available in git. It reads specified history log into HistoryItem* structures and for each item read it calls a function provided in the constructor. It provides three methods so far: readAll() readFrom(Date) readFromTo(Date,Date) The callback function gets a HistoryItem::Ptr as argument. This can be cast into HistoryItemInstall and other subclasses. See zypp/HistoryLogData.h If you have a suggestion to change this or add new methods, let me know. Example usage: - --------8<-------------------------- struct HistoryItemCollector { std::vectorHistoryItem::Ptr items; bool operator()( const HistoryItem::Ptr & item_ptr ) { items.push_back(item_ptr); //cout << *item_ptr << endl; return true; } }; int main( int argc, const char * argv[] ) { HistoryItemCollector ic; parser::HistoryLogReader reader(argv[1], boost::ref(ic)); try { reader.readFromTo( Date("2009-01-01", "%Y-%m-%d"), Date("2009-01-02", "%Y-%m-%d")); } catch (const parser::ParseException & e) { cout << "error in " << argv[1] << ":" << endl; cout << e.asUserHistory() << endl; } cout << "got " << ic.items.size() << endl; return 0; } - --------8<-------------------------- - -- cheers, jano Ján Kupec YaST team - ---------------------------------------------------------(PGP)--- Key ID: 637EE901 Fingerprint: 93B9 C79B 2D20 51C3 800B E09B 8048 46A6 637E E901 - ---------------------------------------------------------(IRC)--- Server: irc.freenode.net Nick: jniq Channels: #zypp #yast #suse #susecz - ---------------------------------------------------------(EOF)--- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkmAYssACgkQgEhGpmN+6QHsnwCfYPvzvSQqzi4KNVq1mEzUUXCI c8YAniVuddWGkTUDqIMNX8RnEAHGnMTp =631N -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jan Kupec wrote:
FYI: zypp/parser/HistoryLogReader is now available in git. It reads specified history log into HistoryItem* structures and for each item read it calls a function provided in the constructor.
It provides three methods so far: readAll() readFrom(Date) readFromTo(Date,Date)
The callback function gets a HistoryItem::Ptr as argument. This can be cast into HistoryItemInstall and other subclasses. See zypp/HistoryLogData.h
If you have a suggestion to change this or add new methods, let me know.
Actually, i have some comments regarding the history myself. 1) it would be nice to have an API that would (given a history log) be able to tell whether a package install actually means an upgrade, downgrade, or just plain install (the log only contains install/remove). 2) similar thing is with the repos - they can change over time, so the repo alias contained in the 'install' log entry may not tell much without looking at the history of that repo - again an API giving a history of that repo would be nice. 3) function to compute rollback to some date (remove this, install that)? 4) We need to log installs/removes done by non-zypp tools (comparing cached @System.solv and the current state). 5) function to extract "requested by" info for the upcoming sat solver auto-remove feature. - -- cheers, jano Ján Kupec YaST team - ---------------------------------------------------------(PGP)--- Key ID: 637EE901 Fingerprint: 93B9 C79B 2D20 51C3 800B E09B 8048 46A6 637E E901 - ---------------------------------------------------------(IRC)--- Server: irc.freenode.net Nick: jniq Channels: #zypp #yast #suse #susecz - ---------------------------------------------------------(EOF)--- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkmAa8MACgkQgEhGpmN+6QHRVgCfd3qpx0Ffmh1WGinzl3zZOi7Q 0PQAn1eJTCx2ZWquMG+2DHG9oIurgKhb =M7wf -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
participants (1)
-
Jan Kupec