Access to changelogs via record parser interface

Add RecordParser::Changelog() and SrcRecordParser::Changelog() functions
that returns raw changelog text.

libapt-pkg SONAME changed according to libtool versioning rules.

Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
This commit is contained in:
Alexey I. Froloff 2009-11-22 04:30:30 +03:00
parent 01ac47bcaf
commit 1843a505d9
10 changed files with 56 additions and 1 deletions

View File

@ -2,7 +2,7 @@
lib_LTLIBRARIES = libapt-pkg.la
libapt_pkg_la_LIBADD = @RPMLIBS@
libapt_pkg_la_LDFLAGS = -version-info 2:0:0 -release @GLIBC_VER@-@LIBSTDCPP_VER@
libapt_pkg_la_LDFLAGS = -version-info 3:0:1 -release @GLIBC_VER@-@LIBSTDCPP_VER@
AM_CPPFLAGS = -DLIBDIR=\"$(libdir)\"

View File

@ -92,6 +92,14 @@ string debRecordParser::LongDesc()
return Section.FindS("Description");
}
/*}}}*/
// RecordParser::Changelog - Return package changelog if any /*{{{*/
// ---------------------------------------------------------------------
/* */
string debRecordParser::Changelog()
{
return string("");
}
/*}}}*/
// RecordParser::SourcePkg - Return the source package name if any /*{{{*/
// ---------------------------------------------------------------------
/* */

View File

@ -44,6 +44,7 @@ class debRecordParser : public pkgRecords::Parser
virtual string ShortDesc();
virtual string LongDesc();
virtual string Name();
virtual string Changelog();
virtual void GetRec(const char *&Start,const char *&Stop);

View File

@ -38,6 +38,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
virtual string Version() const {return Sect.FindS("Version");};
virtual string Maintainer() const {return Sect.FindS("Maintainer");};
virtual string Section() const {return Sect.FindS("Section");};
virtual string Changelog() const {return string("");};
virtual const char **Binaries();
virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool ArchOnly);
virtual unsigned long Offset() {return iOffset;};

View File

@ -67,6 +67,7 @@ class pkgRecords::Parser
virtual string ShortDesc() {return string();};
virtual string LongDesc() {return string();};
virtual string Name() {return string();};
virtual string Changelog() {return string();};
// The record in binary form
virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};

View File

@ -170,6 +170,27 @@ string rpmRecordParser::LongDesc()
return Ret;
}
/*}}}*/
// RecordParser::Changelog - Return package changelog if any /*{{{*/
// -----------------------------------------------
string rpmRecordParser::Changelog()
{
char *str;
string rval("");
str = headerSprintf(HeaderP,
"[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]",
rpmTagTable, rpmHeaderFormats, NULL);
if (str && *str) {
rval = (const char *)str;
}
if (str)
str = (char *)_free(str);
return rval;
}
/*}}}*/
// RecordParser::SourcePkg - Return the source package name if any /*{{{*/
// ---------------------------------------------------------------------

View File

@ -59,6 +59,7 @@ class rpmRecordParser : public pkgRecords::Parser
virtual string ShortDesc();
virtual string LongDesc();
virtual string Name();
virtual string Changelog();
inline Header GetRecord() { return HeaderP; };

View File

@ -191,6 +191,26 @@ string rpmSrcRecordParser::Section() const
return string(rc?str:"");
}
// SrcRecordParser::Changelog - Package changelog
// ----------------------------------------------
string rpmSrcRecordParser::Changelog() const
{
char *str;
string rval("");
str = headerSprintf(HeaderP,
"[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]",
rpmTagTable, rpmHeaderFormats, NULL);
if (str && *str) {
rval = (const char *)str;
}
if (str)
str = (char *)_free(str);
return rval;
}
unsigned long rpmSrcRecordParser::Offset()
{
return Handler->Offset();

View File

@ -48,6 +48,7 @@ public:
virtual string Version() const;
virtual string Maintainer() const;
virtual string Section() const;
virtual string Changelog() const;
virtual const char **Binaries();
virtual unsigned long Offset();
virtual string AsStr();

View File

@ -70,6 +70,7 @@ class pkgSrcRecords
virtual string Version() const = 0;
virtual string Maintainer() const = 0;
virtual string Section() const = 0;
virtual string Changelog() const = 0;
virtual const char **Binaries() = 0; // Ownership does not transfer
virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool ArchOnly) = 0;