[sisyphus] [PATCH] Access to changelogs via record parser interface
Alexey I. Froloff
raorn на altlinux.org
Вс Ноя 22 01:58:25 UTC 2009
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>
---
apt/apt-pkg/Makefile.am | 2 +-
apt/apt-pkg/deb/debrecords.cc | 8 ++++++++
apt/apt-pkg/deb/debrecords.h | 1 +
apt/apt-pkg/deb/debsrcrecords.h | 1 +
apt/apt-pkg/pkgrecords.h | 1 +
apt/apt-pkg/rpm/rpmrecords.cc | 14 ++++++++++++++
apt/apt-pkg/rpm/rpmrecords.h | 1 +
apt/apt-pkg/rpm/rpmsrcrecords.cc | 13 +++++++++++++
apt/apt-pkg/rpm/rpmsrcrecords.h | 1 +
apt/apt-pkg/srcrecords.h | 1 +
10 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/apt/apt-pkg/Makefile.am b/apt/apt-pkg/Makefile.am
index ebf0398..ca563d7 100644
--- a/apt/apt-pkg/Makefile.am
+++ b/apt/apt-pkg/Makefile.am
@@ -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)\"
diff --git a/apt/apt-pkg/deb/debrecords.cc b/apt/apt-pkg/deb/debrecords.cc
index aa6253a..7b31626 100644
--- a/apt/apt-pkg/deb/debrecords.cc
+++ b/apt/apt-pkg/deb/debrecords.cc
@@ -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 /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt/apt-pkg/deb/debrecords.h b/apt/apt-pkg/deb/debrecords.h
index 8760c38..a71e9bd 100644
--- a/apt/apt-pkg/deb/debrecords.h
+++ b/apt/apt-pkg/deb/debrecords.h
@@ -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);
diff --git a/apt/apt-pkg/deb/debsrcrecords.h b/apt/apt-pkg/deb/debsrcrecords.h
index ff14045..18a9339 100644
--- a/apt/apt-pkg/deb/debsrcrecords.h
+++ b/apt/apt-pkg/deb/debsrcrecords.h
@@ -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;};
diff --git a/apt/apt-pkg/pkgrecords.h b/apt/apt-pkg/pkgrecords.h
index 1bf1f9e..9f831a3 100644
--- a/apt/apt-pkg/pkgrecords.h
+++ b/apt/apt-pkg/pkgrecords.h
@@ -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;};
diff --git a/apt/apt-pkg/rpm/rpmrecords.cc b/apt/apt-pkg/rpm/rpmrecords.cc
index eb64fe9..e3f6852 100644
--- a/apt/apt-pkg/rpm/rpmrecords.cc
+++ b/apt/apt-pkg/rpm/rpmrecords.cc
@@ -171,6 +171,20 @@ string rpmRecordParser::LongDesc()
return Ret;
}
/*}}}*/
+// RecordParser::Changelog - Return package changelog if any /*{{{*/
+// -----------------------------------------------
+string rpmRecordParser::Changelog()
+{
+ char *str;
+
+ str = headerSprintf(HeaderP,
+ "[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]",
+ rpmTagTable, rpmHeaderFormats, NULL);
+
+ return string(str?str:"");
+}
+
+ /*}}}*/
// RecordParser::SourcePkg - Return the source package name if any /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt/apt-pkg/rpm/rpmrecords.h b/apt/apt-pkg/rpm/rpmrecords.h
index 71e3325..d8a72d5 100644
--- a/apt/apt-pkg/rpm/rpmrecords.h
+++ b/apt/apt-pkg/rpm/rpmrecords.h
@@ -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; };
diff --git a/apt/apt-pkg/rpm/rpmsrcrecords.cc b/apt/apt-pkg/rpm/rpmsrcrecords.cc
index 43b25fa..3429309 100644
--- a/apt/apt-pkg/rpm/rpmsrcrecords.cc
+++ b/apt/apt-pkg/rpm/rpmsrcrecords.cc
@@ -191,6 +191,19 @@ string rpmSrcRecordParser::Section() const
return string(rc?str:"");
}
+// SrcRecordParser::Changelog - Package changelog
+// ----------------------------------------------
+string rpmSrcRecordParser::Changelog() const
+{
+ char *str;
+
+ str = headerSprintf(HeaderP,
+ "[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]",
+ rpmTagTable, rpmHeaderFormats, NULL);
+
+ return string(str?str:"");
+}
+
unsigned long rpmSrcRecordParser::Offset()
{
return Handler->Offset();
diff --git a/apt/apt-pkg/rpm/rpmsrcrecords.h b/apt/apt-pkg/rpm/rpmsrcrecords.h
index 6c96a40..41505ae 100644
--- a/apt/apt-pkg/rpm/rpmsrcrecords.h
+++ b/apt/apt-pkg/rpm/rpmsrcrecords.h
@@ -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();
diff --git a/apt/apt-pkg/srcrecords.h b/apt/apt-pkg/srcrecords.h
index 006c9d3..8bc013f 100644
--- a/apt/apt-pkg/srcrecords.h
+++ b/apt/apt-pkg/srcrecords.h
@@ -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;
--
1.6.5.3
Подробная информация о списке рассылки Sisyphus