From: Jay Freeman (saurik) Date: Wed, 30 Nov 2016 06:55:57 +0000 (-0800) Subject: Most interfaces (Maemo) need a high-level name :/. X-Git-Tag: cydia_1.1.28%b1~7 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/ef1e4dfd2853abb2e8900c26c1c17bf053863e85?hp=a473295d01ed9c599926d9a8c212d4e1a404f78b Most interfaces (Maemo) need a high-level name :/. --- diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 45d23151c..3308f43dd 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -214,6 +214,7 @@ class pkgCache::VerIterator : public Iterator { // Accessors inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;} inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;} + inline const char *Display() const {return S->Display == 0?0:Owner->StrP + S->Display;} /** \brief source package name this version comes from Always contains the name, even if it is the same as the binary name */ inline const char *SourcePkgName() const {return Owner->StrP + S->SourcePkgName;} diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 878170d00..ec5787fb4 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -148,6 +148,15 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) const char *Start; const char *Stop; + if (Section.Find("Name",Start,Stop) == true) + { + Ver->Display = WriteString(Start, Stop - Start); + } + else if (Section.Find("Maemo-Display-Name",Start,Stop) == true) + { + Ver->Display = WriteString(Start, Stop - Start); + } + // Parse the section if (Section.Find(pkgTagSection::Key::Section,Start,Stop) == true) { diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index a132f34a6..6d642c7b8 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -74,6 +74,15 @@ string debRecordParserBase::Name() return Result; } /*}}}*/ +// RecordParserBase::Display - Return the package homepage /*{{{*/ +string debRecordParserBase::Display() +{ + string display(Section.FindS("Name")); + if (display.empty()) + display = Section.FindS("Maemo-Display-Name"); + return display; +} + /*}}}*/ // RecordParserBase::Homepage - Return the package homepage /*{{{*/ string debRecordParserBase::Homepage() { diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 7fc82a88d..8f443c9a3 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -44,6 +44,7 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser virtual std::string ShortDesc(std::string const &lang) APT_OVERRIDE; virtual std::string LongDesc(std::string const &lang) APT_OVERRIDE; virtual std::string Name() APT_OVERRIDE; + virtual std::string Display() APT_OVERRIDE; virtual std::string Homepage() APT_OVERRIDE; // An arbitrary custom field diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index b1be14bdd..83bf8961d 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -627,6 +627,8 @@ struct pkgCache::Version map_stringitem_t VerStr; /** \brief section this version is filled in */ map_stringitem_t Section; + /** \brief high-level name used to display package */ + map_stringitem_t Display; /** \brief source package name this version comes from Always contains the name, even if it is the same as the binary name */ map_stringitem_t SourcePkgName; diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index 8da3265c6..a151fa123 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -92,6 +92,7 @@ class pkgRecords::Parser /*{{{*/ std::string LongDesc() {return LongDesc("");}; virtual std::string Name() {return std::string();}; + virtual std::string Display() {return std::string();} virtual std::string Homepage() {return std::string();} // An arbitrary custom field