summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/CMakeLists.txt2
-rw-r--r--apt-pkg/cacheiterators.h8
-rw-r--r--apt-pkg/cacheset.cc27
-rw-r--r--apt-pkg/cacheset.h156
-rw-r--r--apt-pkg/contrib/arfile.cc160
-rw-r--r--apt-pkg/contrib/arfile.h69
-rw-r--r--apt-pkg/contrib/extracttar.cc306
-rw-r--r--apt-pkg/contrib/extracttar.h60
-rw-r--r--apt-pkg/contrib/hashsum_template.h15
-rw-r--r--apt-pkg/contrib/macros.h4
-rw-r--r--apt-pkg/contrib/string_view.h6
-rw-r--r--apt-pkg/contrib/strutl.cc5
-rw-r--r--apt-pkg/contrib/strutl.h7
-rw-r--r--apt-pkg/deb/debfile.cc250
-rw-r--r--apt-pkg/deb/debfile.h95
-rw-r--r--apt-pkg/deb/debindexfile.cc43
-rw-r--r--apt-pkg/deb/deblistparser.cc40
-rw-r--r--apt-pkg/deb/deblistparser.h57
-rw-r--r--apt-pkg/deb/debmetaindex.cc2
-rw-r--r--apt-pkg/deb/debsystem.cc2
-rw-r--r--apt-pkg/deb/dpkgpm.cc2
-rw-r--r--apt-pkg/depcache.h6
-rw-r--r--apt-pkg/dirstream.cc118
-rw-r--r--apt-pkg/dirstream.h57
-rw-r--r--apt-pkg/pkgcache.cc33
-rw-r--r--apt-pkg/pkgcache.h29
-rw-r--r--apt-pkg/pkgcachegen.h20
-rw-r--r--apt-pkg/tagfile-compat.cc75
-rw-r--r--apt-pkg/tagfile.h44
29 files changed, 1185 insertions, 513 deletions
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt
index efa680f6b..db23a30f7 100644
--- a/apt-pkg/CMakeLists.txt
+++ b/apt-pkg/CMakeLists.txt
@@ -1,8 +1,6 @@
# Include apt-pkg directly, as some files have #include <system.h>
include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg)
-add_definitions("-DAPT_PKG_EXPOSE_STRING_VIEW")
-
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/apt-pkg/)
execute_process(COMMAND ${TRIEHASH_EXECUTABLE}
--ignore-case
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 27daf4c43..fbd4bcb8d 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -37,9 +37,7 @@
#include <iosfwd>
#include <iterator>
#include <string>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#include <string.h>
@@ -118,11 +116,7 @@ class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
inline PkgIterator PackageList() const;
- PkgIterator FindPkg(std::string Arch = "any") const;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN PkgIterator FindPkg(APT::StringView Arch = APT::StringView("any", 3)) const;
- APT_HIDDEN PkgIterator FindPkg(const char *Arch) const;
-#endif
+ PkgIterator FindPkg(APT::StringView Arch = APT::StringView("any", 3)) const;
/** \brief find the package with the "best" architecture
The best architecture is either the "native" or the first
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index 670cdba3a..0c0f213b7 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -231,33 +231,6 @@ bool CacheSetHelper::PackageFromFnmatch(PackageContainerInterface * const pci,
return true;
}
/*}}}*/
-// PackageFromName - Returns the package defined by this string /*{{{*/
-pkgCache::PkgIterator CacheSetHelper::PackageFromName(pkgCacheFile &Cache,
- std::string const &str) {
- std::string pkg = str;
- size_t archfound = pkg.find_last_of(':');
- std::string arch;
- if (archfound != std::string::npos) {
- arch = pkg.substr(archfound+1);
- pkg.erase(archfound);
- }
-
- if (Cache.GetPkgCache() == 0)
- return pkgCache::PkgIterator(Cache, 0);
-
- pkgCache::PkgIterator Pkg(Cache, 0);
- if (arch.empty() == true) {
- pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
- if (Grp.end() == false)
- Pkg = Grp.FindPreferredPkg();
- } else
- Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
-
- if (Pkg.end() == true)
- return canNotFindPkgName(Cache, str);
- return Pkg;
-}
- /*}}}*/
// PackageFromPackageName - Returns the package defined by this string /*{{{*/
bool CacheSetHelper::PackageFromPackageName(PackageContainerInterface * const pci, pkgCacheFile &Cache,
std::string pkg) {
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index b00fc7318..934f6611c 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -75,7 +75,6 @@ public: /*{{{*/
pkgCacheFile &Cache, const char * cmdline,
std::list<PkgModifier> const &mods);
- APT_DEPRECATED_MSG("use .PackageFrom(PACKAGENAME, …) instead") pkgCache::PkgIterator PackageFromName(pkgCacheFile &Cache, std::string const &pattern);
/** \brief be notified about the package being selected via pattern
*
@@ -311,11 +310,6 @@ public:
inline const char *Name() const {return getType().Name(); }
inline std::string FullName(bool const Pretty) const { return getType().FullName(Pretty); }
inline std::string FullName() const { return getType().FullName(); }
- APT_DEPRECATED_MSG("Use the .Section method of VerIterator instead") inline const char *Section() const {
- APT_IGNORE_DEPRECATED_PUSH
- return getType().Section();
- APT_IGNORE_DEPRECATED_POP
- }
inline bool Purge() const {return getType().Purge(); }
inline const char *Arch() const {return getType().Arch(); }
inline pkgCache::GrpIterator Group() const { return getType().Group(); }
@@ -324,7 +318,6 @@ public:
inline pkgCache::DepIterator RevDependsList() const { return getType().RevDependsList(); }
inline pkgCache::PrvIterator ProvidesList() const { return getType().ProvidesList(); }
inline pkgCache::PkgIterator::OkState State() const { return getType().State(); }
- APT_DEPRECATED_MSG("This method does not respect apt_preferences! Use pkgDepCache::GetCandidateVersion(Pkg)") inline const char *CandVersion() const { return getType().CandVersion(); }
inline const char *CurVersion() const { return getType().CurVersion(); }
inline pkgCache *Cache() const { return getType().Cache(); }
inline unsigned long Index() const {return getType().Index();}
@@ -340,14 +333,6 @@ public:
virtual void clear() = 0;
virtual size_t size() const = 0;
- enum APT_DEPRECATED_MSG("Use CacheSetHelper::PkgSelector instead") Constructor { UNKNOWN = CacheSetHelper::UNKNOWN,
- REGEX = CacheSetHelper::REGEX,
- TASK = CacheSetHelper::TASK,
- FNMATCH = CacheSetHelper::FNMATCH };
-APT_IGNORE_DEPRECATED_PUSH
- void setConstructor(Constructor const by) { ConstructedBy = (CacheSetHelper::PkgSelector)by; }
-APT_IGNORE_DEPRECATED_POP
-
void setConstructor(CacheSetHelper::PkgSelector const by) { ConstructedBy = by; }
CacheSetHelper::PkgSelector getConstructor() const { return ConstructedBy; }
PackageContainerInterface();
@@ -355,30 +340,6 @@ APT_IGNORE_DEPRECATED_POP
PackageContainerInterface& operator=(PackageContainerInterface const &other);
virtual ~PackageContainerInterface();
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::TASK, …) instead") static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::TASK, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::REGEX, …) instead") static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::REGEX, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::FNMATCH, …) instead") static bool FromFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::FNMATCH, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::PACKAGENAME, …) instead") static bool FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::PACKAGENAME, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::STRING, …) instead") static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::STRING, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFromCommandLine instead") static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
- return helper.PackageFromCommandLine(pci, Cache, cmdline); }
-
- APT_DEPRECATED_MSG("enum moved to CacheSetHelper::PkgModifier") typedef CacheSetHelper::PkgModifier Modifier;
-
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
- return helper.PackageFromName(Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFromModifierCommandLine instead") static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
- pkgCacheFile &Cache, const char * cmdline,
- std::list<Modifier> const &mods, CacheSetHelper &helper) {
- return helper.PackageFromModifierCommandLine(modID, pci, Cache, cmdline, mods); }
-APT_IGNORE_DEPRECATED_POP
-
private:
CacheSetHelper::PkgSelector ConstructedBy;
void * const d;
@@ -438,9 +399,6 @@ public: /*{{{*/
PackageContainer() : PackageContainerInterface(CacheSetHelper::UNKNOWN) {}
explicit PackageContainer(CacheSetHelper::PkgSelector const &by) : PackageContainerInterface(by) {}
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Construct with a CacheSetHelper::PkgSelector instead") explicit PackageContainer(Constructor const &by) : PackageContainerInterface((CacheSetHelper::PkgSelector)by) {}
-APT_IGNORE_DEPRECATED_POP
template<typename Itr> PackageContainer(Itr first, Itr last) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(first, last) {}
#if __cplusplus >= 201103L
PackageContainer(std::initializer_list<value_type> list) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(list) {}
@@ -508,21 +466,6 @@ APT_IGNORE_DEPRECATED_POP
return FromFnmatch(Cache, pattern, helper);
}
-APT_IGNORE_DEPRECATED_PUSH
- /** \brief returns a package specified by a string
-
- \param Cache the package is in
- \param pattern String the package name should be extracted from
- \param helper responsible for error and message handling */
- APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
- return helper.PackageFromName(Cache, pattern);
- }
- APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern) {
- CacheSetHelper helper;
- return FromName(Cache, pattern, helper);
- }
-APT_IGNORE_DEPRECATED_POP
-
/** \brief returns all packages specified by a string
\param Cache the packages are in
@@ -792,17 +735,6 @@ public:
virtual void clear() = 0;
virtual size_t size() const = 0;
- /** \brief specifies which version(s) will be returned if non is given */
- enum APT_DEPRECATED_MSG("enum moved to CacheSetHelper::VerSelector instead") Version {
- ALL = CacheSetHelper::ALL,
- CANDANDINST = CacheSetHelper::CANDANDINST,
- CANDIDATE = CacheSetHelper::CANDIDATE,
- INSTALLED = CacheSetHelper::INSTALLED,
- CANDINST = CacheSetHelper::CANDINST,
- INSTCAND = CacheSetHelper::INSTCAND,
- NEWEST = CacheSetHelper::NEWEST
- };
-
struct Modifier {
unsigned short const ID;
const char * const Alias;
@@ -811,45 +743,20 @@ public:
Modifier (unsigned short const &id, const char * const alias, Position const &pos,
enum CacheSetHelper::VerSelector const select) : ID(id), Alias(alias), Pos(pos),
SelectVersion(select) {}
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Construct with a CacheSetHelper::VerSelector instead") Modifier(unsigned short const &id, const char * const alias, Position const &pos,
- Version const &select) : ID(id), Alias(alias), Pos(pos),
- SelectVersion((CacheSetHelper::VerSelector)select) {}
-APT_IGNORE_DEPRECATED_POP
};
static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
const char **cmdline, CacheSetHelper::VerSelector const fallback,
CacheSetHelper &helper);
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
- const char **cmdline, Version const &fallback,
- CacheSetHelper &helper) {
- return FromCommandLine(vci, Cache, cmdline, (CacheSetHelper::VerSelector)fallback, helper);
- }
-APT_IGNORE_DEPRECATED_POP
static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
bool const onlyFromName = false);
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
- std::string pkg, Version const &fallback, CacheSetHelper &helper,
- bool const onlyFromName = false) {
- return FromString(vci, Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper, onlyFromName);
- }
-APT_IGNORE_DEPRECATED_POP
+
static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback,
CacheSetHelper &helper);
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
- pkgCache::PkgIterator const &P, Version const &fallback,
- CacheSetHelper &helper) {
- return FromPackage(vci, Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
- }
-APT_IGNORE_DEPRECATED_POP
static bool FromModifierCommandLine(unsigned short &modID,
VersionContainerInterface * const vci,
@@ -863,15 +770,6 @@ APT_IGNORE_DEPRECATED_POP
pkgCache::DepIterator const &D,
CacheSetHelper::VerSelector const selector,
CacheSetHelper &helper);
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromDependency(VersionContainerInterface * const vci,
- pkgCacheFile &Cache,
- pkgCache::DepIterator const &D,
- Version const &selector,
- CacheSetHelper &helper) {
- return FromDependency(vci, Cache, D, (CacheSetHelper::VerSelector)selector, helper);
- }
-APT_IGNORE_DEPRECATED_POP
VersionContainerInterface();
VersionContainerInterface& operator=(VersionContainerInterface const &other);
@@ -1008,31 +906,7 @@ public: /*{{{*/
static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg) {
return FromString(Cache, pkg, CacheSetHelper::CANDINST);
}
-APT_IGNORE_DEPRECATED_PUSH
- static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
- Version const &fallback, CacheSetHelper &helper) {
- VersionContainer vercon;
- VersionContainerInterface::FromCommandLine(&vercon, Cache, cmdline, (CacheSetHelper::VerSelector)fallback, helper);
- return vercon;
- }
- static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
- Version const &fallback) {
- CacheSetHelper helper;
- return FromCommandLine(Cache, cmdline, (CacheSetHelper::VerSelector)fallback, helper);
- }
- static VersionContainer FromString(pkgCacheFile &Cache, std::string const &pkg,
- Version const &fallback, CacheSetHelper &helper,
- bool const /*onlyFromName = false*/) {
- VersionContainer vercon;
- VersionContainerInterface::FromString(&vercon, Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper);
- return vercon;
- }
- static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg,
- Version const &fallback) {
- CacheSetHelper helper;
- return FromString(Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper);
- }
-APT_IGNORE_DEPRECATED_POP
+
/** \brief returns all versions specified for the package
@@ -1051,19 +925,6 @@ APT_IGNORE_DEPRECATED_POP
CacheSetHelper helper;
return FromPackage(Cache, P, fallback, helper);
}
-APT_IGNORE_DEPRECATED_PUSH
- static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
- Version const &fallback, CacheSetHelper &helper) {
- VersionContainer vercon;
- VersionContainerInterface::FromPackage(&vercon, Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
- return vercon;
- }
- static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
- Version const &fallback) {
- CacheSetHelper helper;
- return FromPackage(Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
- }
-APT_IGNORE_DEPRECATED_POP
static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P) {
return FromPackage(Cache, P, CacheSetHelper::CANDIDATE);
}
@@ -1104,19 +965,6 @@ APT_IGNORE_DEPRECATED_POP
CacheSetHelper helper;
return FromDependency(Cache, D, selector, helper);
}
-APT_IGNORE_DEPRECATED_PUSH
- static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
- Version const &selector, CacheSetHelper &helper) {
- VersionContainer vercon;
- VersionContainerInterface::FromDependency(&vercon, Cache, D, (CacheSetHelper::VerSelector)selector, helper);
- return vercon;
- }
- static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
- Version const &selector) {
- CacheSetHelper helper;
- return FromDependency(Cache, D, (CacheSetHelper::VerSelector)selector, helper);
- }
-APT_IGNORE_DEPRECATED_POP
static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D) {
return FromDependency(Cache, D, CacheSetHelper::CANDIDATE);
}
diff --git a/apt-pkg/contrib/arfile.cc b/apt-pkg/contrib/arfile.cc
new file mode 100644
index 000000000..3fc3afedb
--- /dev/null
+++ b/apt-pkg/contrib/arfile.cc
@@ -0,0 +1,160 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ AR File - Handle an 'AR' archive
+
+ AR Archives have plain text headers at the start of each file
+ section. The headers are aligned on a 2 byte boundary.
+
+ Information about the structure of AR files can be found in ar(5)
+ on a BSD system, or in the binutils source.
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <config.h>
+
+#include <apt-pkg/arfile.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
+
+#include <string>
+#include <string.h>
+#include <sys/types.h>
+
+#include <apti18n.h>
+ /*}}}*/
+
+struct ARArchive::MemberHeader
+{
+ char Name[16];
+ char MTime[12];
+ char UID[6];
+ char GID[6];
+ char Mode[8];
+ char Size[10];
+ char Magic[2];
+};
+
+// ARArchive::ARArchive - Constructor /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+ARArchive::ARArchive(FileFd &File) : List(0), File(File)
+{
+ LoadHeaders();
+}
+ /*}}}*/
+// ARArchive::~ARArchive - Destructor /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+ARArchive::~ARArchive()
+{
+ while (List != 0)
+ {
+ Member *Tmp = List;
+ List = List->Next;
+ delete Tmp;
+ }
+}
+ /*}}}*/
+// ARArchive::LoadHeaders - Load the headers from each file /*{{{*/
+// ---------------------------------------------------------------------
+/* AR files are structured with a 8 byte magic string followed by a 60
+ byte plain text header then the file data, another header, data, etc */
+bool ARArchive::LoadHeaders()
+{
+ off_t Left = File.Size();
+
+ // Check the magic byte
+ char Magic[8];
+ if (File.Read(Magic,sizeof(Magic)) == false)
+ return false;
+ if (memcmp(Magic,"!<arch>\012",sizeof(Magic)) != 0)
+ return _error->Error(_("Invalid archive signature"));
+ Left -= sizeof(Magic);
+
+ // Read the member list
+ while (Left > 0)
+ {
+ MemberHeader Head;
+ if (File.Read(&Head,sizeof(Head)) == false)
+ return _error->Error(_("Error reading archive member header"));
+ Left -= sizeof(Head);
+
+ // Convert all of the integer members
+ Member *Memb = new Member();
+ if (StrToNum(Head.MTime,Memb->MTime,sizeof(Head.MTime)) == false ||
+ StrToNum(Head.UID,Memb->UID,sizeof(Head.UID)) == false ||
+ StrToNum(Head.GID,Memb->GID,sizeof(Head.GID)) == false ||
+ StrToNum(Head.Mode,Memb->Mode,sizeof(Head.Mode),8) == false ||
+ StrToNum(Head.Size,Memb->Size,sizeof(Head.Size)) == false)
+ {
+ delete Memb;
+ return _error->Error(_("Invalid archive member header %s"), Head.Name);
+ }
+
+ // Check for an extra long name string
+ if (memcmp(Head.Name,"#1/",3) == 0)
+ {
+ char S[300];
+ unsigned long Len;
+ if (StrToNum(Head.Name+3,Len,sizeof(Head.Size)-3) == false ||
+ Len >= sizeof(S))
+ {
+ delete Memb;
+ return _error->Error(_("Invalid archive member header"));
+ }
+ if (File.Read(S,Len) == false)
+ {
+ delete Memb;
+ return false;
+ }
+ S[Len] = 0;
+ Memb->Name = S;
+ Memb->Size -= Len;
+ Left -= Len;
+ }
+ else
+ {
+ unsigned int I = sizeof(Head.Name) - 1;
+ for (; Head.Name[I] == ' ' || Head.Name[I] == '/'; I--);
+ Memb->Name = std::string(Head.Name,I+1);
+ }
+
+ // Account for the AR header alignment
+ off_t Skip = Memb->Size % 2;
+
+ // Add it to the list
+ Memb->Next = List;
+ List = Memb;
+ Memb->Start = File.Tell();
+ if (File.Skip(Memb->Size + Skip) == false)
+ return false;
+ if (Left < (off_t)(Memb->Size + Skip))
+ return _error->Error(_("Archive is too short"));
+ Left -= Memb->Size + Skip;
+ }
+ if (Left != 0)
+ return _error->Error(_("Failed to read the archive headers"));
+
+ return true;
+}
+ /*}}}*/
+// ARArchive::FindMember - Find a name in the member list /*{{{*/
+// ---------------------------------------------------------------------
+/* Find a member with the given name */
+const ARArchive::Member *ARArchive::FindMember(const char *Name) const
+{
+ const Member *Res = List;
+ while (Res != 0)
+ {
+ if (Res->Name == Name)
+ return Res;
+ Res = Res->Next;
+ }
+
+ return 0;
+}
+ /*}}}*/
diff --git a/apt-pkg/contrib/arfile.h b/apt-pkg/contrib/arfile.h
new file mode 100644
index 000000000..cf454941e
--- /dev/null
+++ b/apt-pkg/contrib/arfile.h
@@ -0,0 +1,69 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ AR File - Handle an 'AR' archive
+
+ This is a reader for the usual 4.4 BSD AR format. It allows raw
+ stream access to a single member at a time. Basically all this class
+ provides is header parsing and verification. It is up to the client
+ to correctly make use of the stream start/stop points.
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_ARFILE_H
+#define PKGLIB_ARFILE_H
+
+#include <apt-pkg/macros.h>
+#include <string>
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/fileutl.h>
+#endif
+
+class FileFd;
+
+class ARArchive
+{
+ struct MemberHeader;
+ public:
+ struct Member;
+
+ protected:
+
+ // Linked list of members
+ Member *List;
+
+ bool LoadHeaders();
+
+ public:
+
+ // The stream file
+ FileFd &File;
+
+ // Locate a member by name
+ const Member *FindMember(const char *Name) const;
+ inline Member *Members() { return List; }
+
+ explicit ARArchive(FileFd &File);
+ ~ARArchive();
+};
+
+// A member of the archive
+struct ARArchive::Member
+{
+ // Fields from the header
+ std::string Name;
+ unsigned long MTime;
+ unsigned long UID;
+ unsigned long GID;
+ unsigned long Mode;
+ unsigned long long Size;
+
+ // Location of the data.
+ unsigned long long Start;
+ Member *Next;
+
+ Member() : Start(0), Next(0) {};
+};
+
+#endif
diff --git a/apt-pkg/contrib/extracttar.cc b/apt-pkg/contrib/extracttar.cc
new file mode 100644
index 000000000..9bb0a55c0
--- /dev/null
+++ b/apt-pkg/contrib/extracttar.cc
@@ -0,0 +1,306 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ Extract a Tar - Tar Extractor
+
+ Some performance measurements showed that zlib performed quite poorly
+ in comparison to a forked gzip process. This tar extractor makes use
+ of the fact that dup'd file descriptors have the same seek pointer
+ and that gzip will not read past the end of a compressed stream,
+ even if there is more data. We use the dup property to track extraction
+ progress and the gzip feature to just feed gzip a fd in the middle
+ of an AR file.
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <config.h>
+
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/dirstream.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/extracttar.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
+
+#include <algorithm>
+#include <iostream>
+#include <string>
+#include <fcntl.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <apti18n.h>
+ /*}}}*/
+
+using namespace std;
+
+// The on disk header for a tar file.
+struct ExtractTar::TarHeader
+{
+ char Name[100];
+ char Mode[8];
+ char UserID[8];
+ char GroupID[8];
+ char Size[12];
+ char MTime[12];
+ char Checksum[8];
+ char LinkFlag;
+ char LinkName[100];
+ char MagicNumber[8];
+ char UserName[32];
+ char GroupName[32];
+ char Major[8];
+ char Minor[8];
+};
+
+// ExtractTar::ExtractTar - Constructor /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+ExtractTar::ExtractTar(FileFd &Fd,unsigned long long Max,string DecompressionProgram)
+ : File(Fd), MaxInSize(Max), DecompressProg(DecompressionProgram)
+{
+ GZPid = -1;
+ Eof = false;
+}
+ /*}}}*/
+// ExtractTar::ExtractTar - Destructor /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+ExtractTar::~ExtractTar()
+{
+ // Error close
+ Done();
+}
+ /*}}}*/
+// ExtractTar::Done - Reap the gzip sub process /*{{{*/
+bool ExtractTar::Done()
+{
+ return InFd.Close();
+}
+ /*}}}*/
+// ExtractTar::StartGzip - Startup gzip /*{{{*/
+// ---------------------------------------------------------------------
+/* This creates a gzip sub process that has its input as the file itself.
+ If this tar file is embedded into something like an ar file then
+ gzip will efficiently ignore the extra bits. */
+bool ExtractTar::StartGzip()
+{
+ if (DecompressProg.empty())
+ {
+ InFd.OpenDescriptor(File.Fd(), FileFd::ReadOnly, FileFd::None, false);
+ return true;
+ }
+
+ std::vector<APT::Configuration::Compressor> const compressors = APT::Configuration::getCompressors();
+ std::vector<APT::Configuration::Compressor>::const_iterator compressor = compressors.begin();
+ for (; compressor != compressors.end(); ++compressor) {
+ if (compressor->Name == DecompressProg) {
+ return InFd.OpenDescriptor(File.Fd(), FileFd::ReadOnly, *compressor, false);
+ }
+ }
+
+ return _error->Error(_("Cannot find a configured compressor for '%s'"),
+ DecompressProg.c_str());
+
+}
+ /*}}}*/
+// ExtractTar::Go - Perform extraction /*{{{*/
+// ---------------------------------------------------------------------
+/* This reads each 512 byte block from the archive and extracts the header
+ information into the Item structure. Then it resolves the UID/GID and
+ invokes the correct processing function. */
+bool ExtractTar::Go(pkgDirStream &Stream)
+{
+ if (StartGzip() == false)
+ return false;
+
+ // Loop over all blocks
+ string LastLongLink, ItemLink;
+ string LastLongName, ItemName;
+ while (1)
+ {
+ bool BadRecord = false;
+ unsigned char Block[512];
+ if (InFd.Read(Block,sizeof(Block),true) == false)
+ return false;
+
+ if (InFd.Eof() == true)
+ break;
+
+ // Get the checksum
+ TarHeader *Tar = (TarHeader *)Block;
+ unsigned long CheckSum;
+ if (StrToNum(Tar->Checksum,CheckSum,sizeof(Tar->Checksum),8) == false)
+ return _error->Error(_("Corrupted archive"));
+
+ /* Compute the checksum field. The actual checksum is blanked out
+ with spaces so it is not included in the computation */
+ unsigned long NewSum = 0;
+ memset(Tar->Checksum,' ',sizeof(Tar->Checksum));
+ for (int I = 0; I != sizeof(Block); I++)
+ NewSum += Block[I];
+
+ /* Check for a block of nulls - in this case we kill gzip, GNU tar
+ does this.. */
+ if (NewSum == ' '*sizeof(Tar->Checksum))
+ return Done();
+
+ if (NewSum != CheckSum)
+ return _error->Error(_("Tar checksum failed, archive corrupted"));
+
+ // Decode all of the fields
+ pkgDirStream::Item Itm;
+ if (StrToNum(Tar->Mode,Itm.Mode,sizeof(Tar->Mode),8) == false ||
+ (Base256ToNum(Tar->UserID,Itm.UID,8) == false &&
+ StrToNum(Tar->UserID,Itm.UID,sizeof(Tar->UserID),8) == false) ||
+ (Base256ToNum(Tar->GroupID,Itm.GID,8) == false &&
+ StrToNum(Tar->GroupID,Itm.GID,sizeof(Tar->GroupID),8) == false) ||
+ (Base256ToNum(Tar->Size,Itm.Size,12) == false &&
+ StrToNum(Tar->Size,Itm.Size,sizeof(Tar->Size),8) == false) ||
+ (Base256ToNum(Tar->MTime,Itm.MTime,12) == false &&
+ StrToNum(Tar->MTime,Itm.MTime,sizeof(Tar->MTime),8) == false) ||
+ StrToNum(Tar->Major,Itm.Major,sizeof(Tar->Major),8) == false ||
+ StrToNum(Tar->Minor,Itm.Minor,sizeof(Tar->Minor),8) == false)
+ return _error->Error(_("Corrupted archive"));
+
+ // Grab the filename and link target: use last long name if one was
+ // set, otherwise use the header value as-is, but remember that it may
+ // fill the entire 100-byte block and needs to be zero-terminated.
+ // See Debian Bug #689582.
+ if (LastLongName.empty() == false)
+ Itm.Name = (char *)LastLongName.c_str();
+ else
+ Itm.Name = (char *)ItemName.assign(Tar->Name, sizeof(Tar->Name)).c_str();
+ if (Itm.Name[0] == '.' && Itm.Name[1] == '/' && Itm.Name[2] != 0)
+ Itm.Name += 2;
+
+ if (LastLongLink.empty() == false)
+ Itm.LinkTarget = (char *)LastLongLink.c_str();
+ else
+ Itm.LinkTarget = (char *)ItemLink.assign(Tar->LinkName, sizeof(Tar->LinkName)).c_str();
+
+ // Convert the type over
+ switch (Tar->LinkFlag)
+ {
+ case NormalFile0:
+ case NormalFile:
+ Itm.Type = pkgDirStream::Item::File;
+ break;
+
+ case HardLink:
+ Itm.Type = pkgDirStream::Item::HardLink;
+ break;
+
+ case SymbolicLink:
+ Itm.Type = pkgDirStream::Item::SymbolicLink;
+ break;
+
+ case CharacterDevice:
+ Itm.Type = pkgDirStream::Item::CharDevice;
+ break;
+
+ case BlockDevice:
+ Itm.Type = pkgDirStream::Item::BlockDevice;
+ break;
+
+ case Directory:
+ Itm.Type = pkgDirStream::Item::Directory;
+ break;
+
+ case FIFO:
+ Itm.Type = pkgDirStream::Item::FIFO;
+ break;
+
+ case GNU_LongLink:
+ {
+ unsigned long long Length = Itm.Size;
+ unsigned char Block[512];
+ while (Length > 0)
+ {
+ if (InFd.Read(Block,sizeof(Block),true) == false)
+ return false;
+ if (Length <= sizeof(Block))
+ {
+ LastLongLink.append(Block,Block+sizeof(Block));
+ break;
+ }
+ LastLongLink.append(Block,Block+sizeof(Block));
+ Length -= sizeof(Block);
+ }
+ continue;
+ }
+
+ case GNU_LongName:
+ {
+ unsigned long long Length = Itm.Size;
+ unsigned char Block[512];
+ while (Length > 0)
+ {
+ if (InFd.Read(Block,sizeof(Block),true) == false)
+ return false;
+ if (Length < sizeof(Block))
+ {
+ LastLongName.append(Block,Block+sizeof(Block));
+ break;
+ }
+ LastLongName.append(Block,Block+sizeof(Block));
+ Length -= sizeof(Block);
+ }
+ continue;
+ }
+
+ default:
+ BadRecord = true;
+ _error->Warning(_("Unknown TAR header type %u, member %s"),(unsigned)Tar->LinkFlag,Tar->Name);
+ break;
+ }
+
+ int Fd = -1;
+ if (BadRecord == false)
+ if (Stream.DoItem(Itm,Fd) == false)
+ return false;
+
+ // Copy the file over the FD
+ unsigned long long Size = Itm.Size;
+ while (Size != 0)
+ {
+ unsigned char Junk[32*1024];
+ unsigned long Read = min(Size, (unsigned long long)sizeof(Junk));
+ if (InFd.Read(Junk,((Read+511)/512)*512) == false)
+ return false;
+
+ if (BadRecord == false)
+ {
+ if (Fd > 0)
+ {
+ if (write(Fd,Junk,Read) != (signed)Read)
+ return Stream.Fail(Itm,Fd);
+ }
+ else
+ {
+ /* An Fd of -2 means to send to a special processing
+ function */
+ if (Fd == -2)
+ if (Stream.Process(Itm,Junk,Read,Itm.Size - Size) == false)
+ return Stream.Fail(Itm,Fd);
+ }
+ }
+
+ Size -= Read;
+ }
+
+ // And finish up
+ if (BadRecord == false)
+ if (Stream.FinishedFile(Itm,Fd) == false)
+ return false;
+
+ LastLongName.erase();
+ LastLongLink.erase();
+ }
+
+ return Done();
+}
+ /*}}}*/
diff --git a/apt-pkg/contrib/extracttar.h b/apt-pkg/contrib/extracttar.h
new file mode 100644
index 000000000..adde21352
--- /dev/null
+++ b/apt-pkg/contrib/extracttar.h
@@ -0,0 +1,60 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ Extract a Tar - Tar Extractor
+
+ The tar extractor takes an ordinary gzip compressed tar stream from
+ the given file and explodes it, passing the individual items to the
+ given Directory Stream for processing.
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EXTRACTTAR_H
+#define PKGLIB_EXTRACTTAR_H
+
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/macros.h>
+
+#include <string>
+
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/dirstream.h>
+#include <algorithm>
+using std::min;
+#endif
+
+class pkgDirStream;
+
+class ExtractTar
+{
+ protected:
+
+ struct TarHeader;
+
+ // The varios types items can be
+ enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
+ SymbolicLink = '2',CharacterDevice = '3',
+ BlockDevice = '4',Directory = '5',FIFO = '6',
+ GNU_LongLink = 'K',GNU_LongName = 'L'};
+
+ FileFd &File;
+ unsigned long long MaxInSize;
+ int GZPid;
+ FileFd InFd;
+ bool Eof;
+ std::string DecompressProg;
+
+ // Fork and reap gzip
+ bool StartGzip();
+ bool Done();
+
+ public:
+
+ bool Go(pkgDirStream &Stream);
+
+ ExtractTar(FileFd &Fd,unsigned long long Max,std::string DecompressionProgram);
+ virtual ~ExtractTar();
+};
+
+#endif
diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h
index f11fc2f1c..52b2cbab3 100644
--- a/apt-pkg/contrib/hashsum_template.h
+++ b/apt-pkg/contrib/hashsum_template.h
@@ -11,9 +11,7 @@
#include <cstring>
#include <string>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#include <apt-pkg/strutl.h>
@@ -77,17 +75,10 @@ class HashSumValue
return Value();
}
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN bool Set(APT::StringView Str)
- {
- return Hex2Num(Str,Sum,sizeof(Sum));
- }
-#else
- bool Set(std::string Str)
+ bool Set(APT::StringView Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
}
-#endif
inline void Set(unsigned char S[N/8])
{
for (int I = 0; I != sizeof(Sum); ++I)
@@ -99,8 +90,7 @@ class HashSumValue
memset(Sum,0,sizeof(Sum));
Set(Str);
}
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN explicit HashSumValue(APT::StringView const &Str)
+ explicit HashSumValue(APT::StringView const &Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);
@@ -110,7 +100,6 @@ class HashSumValue
memset(Sum,0,sizeof(Sum));
Set(Str);
}
-#endif
HashSumValue()
{
memset(Sum,0,sizeof(Sum));
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h
index f15625a4c..3648390ce 100644
--- a/apt-pkg/contrib/macros.h
+++ b/apt-pkg/contrib/macros.h
@@ -165,8 +165,8 @@
// reverse-dependencies of libapt-pkg against the new SONAME.
// Non-ABI-Breaks should only increase RELEASE number.
// See also buildlib/libversion.mak
-#define APT_PKG_MAJOR 6
-#define APT_PKG_MINOR 0
+#define APT_PKG_MAJOR 5
+#define APT_PKG_MINOR 90
#define APT_PKG_RELEASE 0
#define APT_PKG_ABI ((APT_PKG_MAJOR * 100) + APT_PKG_MINOR)
diff --git a/apt-pkg/contrib/string_view.h b/apt-pkg/contrib/string_view.h
index 536744e32..f4f0c645f 100644
--- a/apt-pkg/contrib/string_view.h
+++ b/apt-pkg/contrib/string_view.h
@@ -9,7 +9,7 @@
* (at your option) any later version.
*/
-#if !defined(APT_STRINGVIEW_H) && defined(APT_PKG_EXPOSE_STRING_VIEW)
+#if !defined(APT_STRINGVIEW_H)
#define APT_STRINGVIEW_H
#include <apt-pkg/macros.h>
#include <string>
@@ -24,7 +24,7 @@ namespace APT {
* used by APT. It is not meant to be used in programs, only inside the
* library for performance critical paths.
*/
-class APT_HIDDEN StringView {
+class StringView {
const char *data_;
size_t size_;
@@ -128,5 +128,7 @@ static inline int StringViewCompareFast(StringView a, StringView b) {
inline bool operator ==(const char *other, APT::StringView that);
inline bool operator ==(const char *other, APT::StringView that) { return that.operator==(other); }
+inline bool operator ==(std::string const &other, APT::StringView that);
+inline bool operator ==(std::string const &other, APT::StringView that) { return that.operator==(other); }
#endif
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index e854c5bf1..c00bce5d5 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1202,11 +1202,6 @@ static int HexDigit(int c)
// Hex2Num - Convert a long hex number into a buffer /*{{{*/
// ---------------------------------------------------------------------
/* The length of the buffer must be exactly 1/2 the length of the string. */
-bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length)
-{
- return Hex2Num(APT::StringView(Str), Num, Length);
-}
-
bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length)
{
if (Str.length() != Length*2)
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index ae0aaedf9..3853d5ba6 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -20,9 +20,7 @@
#include <limits>
#include <string>
#include <vector>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#include <stddef.h>
#include <time.h>
@@ -100,10 +98,7 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0)
bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0);
bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
bool Base256ToNum(const char *Str,unsigned long long &Res,unsigned int Len);
-bool Hex2Num(const std::string &Str,unsigned char *Num,unsigned int Length);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
-APT_HIDDEN bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length);
-#endif
+bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length);
// input changing string split
bool TokSplitString(char Tok,char *Input,char **List,
unsigned long ListMax);
diff --git a/apt-pkg/deb/debfile.cc b/apt-pkg/deb/debfile.cc
new file mode 100644
index 000000000..f8d752e7f
--- /dev/null
+++ b/apt-pkg/deb/debfile.cc
@@ -0,0 +1,250 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ Debian Archive File (.deb)
+
+ .DEB archives are AR files containing two tars and an empty marker
+ member called 'debian-binary'. The two tars contain the meta data and
+ the actual archive contents. Thus this class is a very simple wrapper
+ around ar/tar to simply extract the right tar files.
+
+ It also uses the deb package list parser to parse the control file
+ into the cache.
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <config.h>
+
+#include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/arfile.h>
+#include <apt-pkg/debfile.h>
+#include <apt-pkg/dirstream.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/extracttar.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/tagfile.h>
+
+#include <string>
+#include <vector>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <apti18n.h>
+ /*}}}*/
+
+// DebFile::debDebFile - Constructor /*{{{*/
+// ---------------------------------------------------------------------
+/* Open the AR file and check for consistency */
+debDebFile::debDebFile(FileFd &File) : File(File), AR(File)
+{
+ if (_error->PendingError() == true)
+ return;
+
+ if (!CheckMember("debian-binary")) {
+ _error->Error(_("This is not a valid DEB archive, missing '%s' member"), "debian-binary");
+ return;
+ }
+
+ if (!CheckMember("control.tar") &&
+ !CheckMember("control.tar.gz") &&
+ !CheckMember("control.tar.xz") &&
+ !CheckMember("control.tar.zst"))
+ {
+ _error->Error(_("This is not a valid DEB archive, missing '%s' member"), "control.tar");
+ return;
+ }
+
+ if (!CheckMember("data.tar") &&
+ !CheckMember("data.tar.gz") &&
+ !CheckMember("data.tar.bz2") &&
+ !CheckMember("data.tar.lzma") &&
+ !CheckMember("data.tar.xz") &&
+ !CheckMember("data.tar.zst"))
+ {
+ _error->Error(_("This is not a valid DEB archive, missing '%s' member"), "data.tar");
+ return;
+ }
+}
+ /*}}}*/
+// DebFile::CheckMember - Check if a named member is in the archive /*{{{*/
+// ---------------------------------------------------------------------
+/* This is used to check for a correct deb and to give nicer error messages
+ for people playing around. */
+bool debDebFile::CheckMember(const char *Name)
+{
+ if (AR.FindMember(Name) == 0)
+ return false;
+ return true;
+}
+ /*}}}*/
+// DebFile::GotoMember - Jump to a Member /*{{{*/
+// ---------------------------------------------------------------------
+/* Jump in the file to the start of a named member and return the information
+ about that member. The caller can then read from the file up to the
+ returned size. Note, since this relies on the file position this is
+ a destructive operation, it also changes the last returned Member
+ structure - so don't nest them! */
+const ARArchive::Member *debDebFile::GotoMember(const char *Name)
+{
+ // Get the archive member and positition the file
+ const ARArchive::Member *Member = AR.FindMember(Name);
+ if (Member == 0)
+ {
+ return 0;
+ }
+ if (File.Seek(Member->Start) == false)
+ return 0;
+
+ return Member;
+}
+ /*}}}*/
+// DebFile::ExtractTarMember - Extract the contents of a tar member /*{{{*/
+// ---------------------------------------------------------------------
+/* Simple wrapper around tar.. */
+bool debDebFile::ExtractTarMember(pkgDirStream &Stream,const char *Name)
+{
+ // Get the archive member
+ const ARArchive::Member *Member = NULL;
+ std::string Compressor;
+
+ std::vector<APT::Configuration::Compressor> compressor = APT::Configuration::getCompressors();
+ for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+ c != compressor.end(); ++c)
+ {
+ Member = AR.FindMember(std::string(Name).append(c->Extension).c_str());
+ if (Member == NULL)
+ continue;
+ Compressor = c->Name;
+ break;
+ }
+
+ if (Member == NULL)
+ Member = AR.FindMember(std::string(Name).c_str());
+
+ if (Member == NULL)
+ {
+ std::string ext = std::string(Name) + ".{";
+ for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+ c != compressor.end(); ++c) {
+ if (!c->Extension.empty())
+ ext.append(c->Extension.substr(1));
+ }
+ ext.append("}");
+ return _error->Error(_("Internal error, could not locate member %s"), ext.c_str());
+ }
+
+ if (File.Seek(Member->Start) == false)
+ return false;
+
+ // Prepare Tar
+ ExtractTar Tar(File,Member->Size,Compressor);
+ if (_error->PendingError() == true)
+ return false;
+ return Tar.Go(Stream);
+}
+ /*}}}*/
+// DebFile::ExtractArchive - Extract the archive data itself /*{{{*/
+// ---------------------------------------------------------------------
+/* Simple wrapper around DebFile::ExtractTarMember. */
+bool debDebFile::ExtractArchive(pkgDirStream &Stream)
+{
+ return ExtractTarMember(Stream, "data.tar");
+}
+ /*}}}*/
+
+// DebFile::ControlExtract::DoItem - Control Tar Extraction /*{{{*/
+// ---------------------------------------------------------------------
+/* This directory stream handler for the control tar handles extracting
+ it into the temporary meta directory. It only extracts files, it does
+ not create directories, links or anything else. */
+bool debDebFile::ControlExtract::DoItem(Item &Itm,int &Fd)
+{
+ if (Itm.Type != Item::File)
+ return true;
+
+ /* Cleanse the file name, prevent people from trying to unpack into
+ absolute paths, .., etc */
+ for (char *I = Itm.Name; *I != 0; I++)
+ if (*I == '/')
+ *I = '_';
+
+ /* Force the ownership to be root and ensure correct permissions,
+ go-w, the rest are left untouched */
+ Itm.UID = 0;
+ Itm.GID = 0;
+ Itm.Mode &= ~(S_IWGRP | S_IWOTH);
+
+ return pkgDirStream::DoItem(Itm,Fd);
+}
+ /*}}}*/
+
+// MemControlExtract::DoItem - Check if it is the control file /*{{{*/
+// ---------------------------------------------------------------------
+/* This sets up to extract the control block member file into a memory
+ block of just the right size. All other files go into the bit bucket. */
+bool debDebFile::MemControlExtract::DoItem(Item &Itm,int &Fd)
+{
+ // At the control file, allocate buffer memory.
+ if (Member == Itm.Name)
+ {
+ delete [] Control;
+ Control = new char[Itm.Size+2];
+ IsControl = true;
+ Fd = -2; // Signal to pass to Process
+ Length = Itm.Size;
+ }
+ else
+ IsControl = false;
+
+ return true;
+}
+ /*}}}*/
+// MemControlExtract::Process - Process extracting the control file /*{{{*/
+// ---------------------------------------------------------------------
+/* Just memcopy the block from the tar extractor and put it in the right
+ place in the pre-allocated memory block. */
+bool debDebFile::MemControlExtract::Process(Item &/*Itm*/,const unsigned char *Data,
+ unsigned long long Size,unsigned long long Pos)
+{
+ memcpy(Control + Pos, Data,Size);
+ return true;
+}
+ /*}}}*/
+// MemControlExtract::Read - Read the control information from the deb /*{{{*/
+// ---------------------------------------------------------------------
+/* This uses the internal tar extractor to fetch the control file, and then
+ it parses it into a tag section parser. */
+bool debDebFile::MemControlExtract::Read(debDebFile &Deb)
+{
+ if (Deb.ExtractTarMember(*this, "control.tar") == false)
+ return false;
+
+ if (Control == 0)
+ return true;
+
+ Control[Length] = '\n';
+ Control[Length+1] = '\n';
+ if (Section.Scan(Control,Length+2) == false)
+ return _error->Error(_("Unparsable control file"));
+ return true;
+}
+ /*}}}*/
+// MemControlExtract::TakeControl - Parse a memory block /*{{{*/
+// ---------------------------------------------------------------------
+/* The given memory block is loaded into the parser and parsed as a control
+ record. */
+bool debDebFile::MemControlExtract::TakeControl(const void *Data,unsigned long long Size)
+{
+ delete [] Control;
+ Control = new char[Size+2];
+ Length = Size;
+ memcpy(Control,Data,Size);
+
+ Control[Length] = '\n';
+ Control[Length+1] = '\n';
+ return Section.Scan(Control,Length+2);
+}
+ /*}}}*/
+
diff --git a/apt-pkg/deb/debfile.h b/apt-pkg/deb/debfile.h
new file mode 100644
index 000000000..21c59a567
--- /dev/null
+++ b/apt-pkg/deb/debfile.h
@@ -0,0 +1,95 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ Debian Archive File (.deb)
+
+ This Class handles all the operations performed directly on .deb
+ files. It makes use of the AR and TAR classes to give the necessary
+ external interface.
+
+ There are only two things that can be done with a raw package,
+ extract it's control information and extract the contents itself.
+
+ This should probably subclass an as-yet unwritten super class to
+ produce a generic archive mechanism.
+
+ The memory control file extractor is useful to extract a single file
+ into memory from the control.tar.gz
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_DEBFILE_H
+#define PKGLIB_DEBFILE_H
+
+#include <apt-pkg/arfile.h>
+#include <apt-pkg/dirstream.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/tagfile.h>
+
+#include <string>
+
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/md5.h>
+#endif
+#ifndef APT_10_CLEANER_HEADERS
+#include <apt-pkg/pkgcache.h>
+#endif
+
+class FileFd;
+
+class debDebFile
+{
+ protected:
+
+ FileFd &File;
+ ARArchive AR;
+
+ bool CheckMember(const char *Name);
+
+ public:
+ class ControlExtract;
+ class MemControlExtract;
+
+ bool ExtractTarMember(pkgDirStream &Stream, const char *Name);
+ bool ExtractArchive(pkgDirStream &Stream);
+ const ARArchive::Member *GotoMember(const char *Name);
+ inline FileFd &GetFile() {return File;};
+
+ explicit debDebFile(FileFd &File);
+};
+
+class debDebFile::ControlExtract : public pkgDirStream
+{
+ public:
+
+ virtual bool DoItem(Item &Itm,int &Fd) APT_OVERRIDE;
+};
+
+class debDebFile::MemControlExtract : public pkgDirStream
+{
+ bool IsControl;
+
+ public:
+
+ char *Control;
+ pkgTagSection Section;
+ unsigned long Length;
+ std::string Member;
+
+ // Members from DirStream
+ virtual bool DoItem(Item &Itm,int &Fd) APT_OVERRIDE;
+ virtual bool Process(Item &Itm,const unsigned char *Data,
+ unsigned long long Size,unsigned long long Pos) APT_OVERRIDE;
+
+ // Helpers
+ bool Read(debDebFile &Deb);
+ bool TakeControl(const void *Data,unsigned long long Size);
+
+ MemControlExtract() : IsControl(false), Control(0), Length(0), Member("control") {};
+ explicit MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
+ ~MemControlExtract() {delete [] Control;};
+};
+ /*}}}*/
+
+#endif
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index 25e0a3312..279f35a38 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -10,7 +10,9 @@
// Include Files /*{{{*/
#include <config.h>
+#include <apti18n.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/debfile.h>
#include <apt-pkg/debindexfile.h>
#include <apt-pkg/deblistparser.h>
#include <apt-pkg/debrecords.h>
@@ -172,36 +174,23 @@ bool debDebPkgFileIndex::GetContent(std::ostream &content, std::string const &de
if (stat(debfile.c_str(), &Buf) != 0)
return false;
- // get the control data out of the deb file via dpkg-deb -I
- std::string dpkg = _config->Find("Dir::Bin::dpkg","dpkg-deb");
- std::vector<const char *> Args;
- Args.push_back(dpkg.c_str());
- Args.push_back("-I");
- Args.push_back(debfile.c_str());
- Args.push_back("control");
- Args.push_back(NULL);
- FileFd PipeFd;
- pid_t Child;
- if(Popen((const char**)&Args[0], PipeFd, Child, FileFd::ReadOnly) == false)
- return _error->Error("Popen failed");
+ FileFd debFd(debfile, FileFd::ReadOnly);
+ debDebFile deb(debFd);
+ debDebFile::MemControlExtract extractor("control");
- std::string line;
- bool first_line_seen = false;
- while (PipeFd.ReadLine(line))
- {
- if (first_line_seen == false)
- {
- if (line.empty())
- continue;
- first_line_seen = true;
- }
- else if (line.empty())
- break;
- content << line << "\n";
- }
+ if (not extractor.Read(deb))
+ return _error->Error(_("Could not read meta data from %s"), debfile.c_str());
+
+ // trim off newlines
+ while (extractor.Control[extractor.Length] == '\n')
+ extractor.Control[extractor.Length--] = '\0';
+ const char *Control = extractor.Control;
+ while (isspace_ascii(Control[0]))
+ Control++;
+
+ content << Control;
content << "Filename: " << debfile << "\n";
content << "Size: " << std::to_string(Buf.st_size) << "\n";
- ExecWait(Child, "Popen");
return true;
}
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 80ca10e37..832e3948d 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -546,28 +546,6 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
/* This parses the dependency elements out of a standard string in place,
bit by bit. */
const char *debListParser::ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op)
- { return ParseDepends(Start, Stop, Package, Ver, Op, false, true, false); }
-const char *debListParser::ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op,
- bool const &ParseArchFlags)
- { return ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, true, false); }
-const char *debListParser::ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op,
- bool const &ParseArchFlags, bool const &StripMultiArch)
- { return ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, StripMultiArch, false); }
-const char *debListParser::ParseDepends(const char *Start,const char *Stop,
- string &Package,string &Ver,
- unsigned int &Op, bool const &ParseArchFlags,
- bool const &StripMultiArch,
- bool const &ParseRestrictionsList)
-{
- return debListParser::ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags,
- StripMultiArch, ParseRestrictionsList,
- _config->Find("APT::Architecture"));
-}
-
-const char *debListParser::ParseDepends(const char *Start,const char *Stop,
string &Package,string &Ver,
unsigned int &Op, bool const &ParseArchFlags,
bool const &StripMultiArch,
@@ -584,23 +562,15 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
return res;
}
-const char *debListParser::ParseDepends(const char *Start,const char *Stop,
- StringView &Package,StringView &Ver,
- unsigned int &Op, bool ParseArchFlags,
- bool StripMultiArch,
- bool ParseRestrictionsList)
-{
- return debListParser::ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags,
- StripMultiArch, ParseRestrictionsList,
- _config->Find("APT::Architecture"));
-}
-const char *debListParser::ParseDepends(const char *Start,const char *Stop,
- StringView &Package,StringView &Ver,
+const char *debListParser::ParseDepends(const char *Start, const char *Stop,
+ StringView &Package, StringView &Ver,
unsigned int &Op, bool ParseArchFlags,
bool StripMultiArch,
- bool ParseRestrictionsList, string const &Arch)
+ bool ParseRestrictionsList, string Arch)
{
+ if (Arch.empty())
+ Arch = _config->Find("APT::Architecture");
// Strip off leading space
for (;Start != Stop && isspace_ascii(*Start) != 0; ++Start);
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index ad2b947fe..807968452 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -18,9 +18,7 @@
#include <string>
#include <vector>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/indexfile.h>
@@ -32,14 +30,12 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
{
public:
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
// Parser Helper
struct WordList
{
APT::StringView Str;
unsigned char Val;
};
-#endif
private:
std::vector<std::string> forceEssential;
@@ -57,9 +53,7 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
unsigned int Type);
bool ParseProvides(pkgCache::VerIterator &Ver);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN static bool GrabWord(APT::StringView Word,const WordList *List,unsigned char &Out);
-#endif
APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors);
public:
@@ -69,15 +63,11 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
// These all operate against the current section
virtual std::string Package() APT_OVERRIDE;
virtual bool ArchitectureAll() APT_OVERRIDE;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
virtual APT::StringView Architecture() APT_OVERRIDE;
virtual APT::StringView Version() APT_OVERRIDE;
-#endif
virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
virtual APT::StringView Description_md5() APT_OVERRIDE;
-#endif
virtual unsigned short VersionHash() APT_OVERRIDE;
virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE;
virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
@@ -87,37 +77,18 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
virtual bool Step() APT_OVERRIDE;
- APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op);
- APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op,
- bool const &ParseArchFlags);
- APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op,
- bool const &ParseArchFlags, bool const &StripMultiArch);
- APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op,
- bool const &ParseArchFlags, bool const &StripMultiArch,
- bool const &ParseRestrictionsList);
- APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
- std::string &Package,std::string &Ver,unsigned int &Op,
- bool const &ParseArchFlags, bool const &StripMultiArch,
- bool const &ParseRestrictionsList,
- std::string const &Arch);
-
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN static const char *ParseDepends(const char *Start,const char *Stop,
- APT::StringView &Package,
- APT::StringView &Ver,unsigned int &Op,
- bool const ParseArchFlags = false, bool StripMultiArch = true,
- bool const ParseRestrictionsList = false);
- APT_HIDDEN static const char *ParseDepends(const char *Start,const char *Stop,
- APT::StringView &Package,
- APT::StringView &Ver,unsigned int &Op,
- bool const ParseArchFlags, bool StripMultiArch,
- bool const ParseRestrictionsList,
- std::string const &Arch);
-#endif
+ APT_PUBLIC static const char *ParseDepends(const char *Start, const char *Stop,
+ std::string &Package, std::string &Ver, unsigned int &Op,
+ bool const &ParseArchFlags = false, bool const &StripMultiArch = true,
+ bool const &ParseRestrictionsList = false,
+ std::string const &Arch = "");
+
+ APT_PUBLIC static const char *ParseDepends(const char *Start, const char *Stop,
+ APT::StringView &Package,
+ APT::StringView &Ver, unsigned int &Op,
+ bool const ParseArchFlags = false, bool StripMultiArch = true,
+ bool const ParseRestrictionsList = false,
+ std::string Arch = "");
APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op);
@@ -139,11 +110,9 @@ class APT_HIDDEN debDebFileParser : public debListParser
class APT_HIDDEN debTranslationsParser : public debListParser
{
public:
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
// a translation can never be a real package
virtual APT::StringView Architecture() APT_OVERRIDE { return ""; }
virtual APT::StringView Version() APT_OVERRIDE { return ""; }
-#endif
explicit debTranslationsParser(FileFd *File)
: debListParser(File) {};
@@ -152,7 +121,7 @@ class APT_HIDDEN debTranslationsParser : public debListParser
class APT_HIDDEN debStatusListParser : public debListParser
{
public:
- virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
+ virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE;
explicit debStatusListParser(FileFd *File)
: debListParser(File) {};
};
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 13575e10b..fef58f543 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -59,7 +59,7 @@ static std::string NormalizeSignedBy(std::string SignedBy, bool const SupportFil
// but fingerprints are harder to fake than the others and this option is set once,
// not interactively all the time so easy to type is not really a concern.
std::transform(SignedBy.begin(), SignedBy.end(), SignedBy.begin(), [](char const c) {
- return (isspace(c) == 0) ? c : ',';
+ return (isspace_ascii(c) == 0) ? c : ',';
});
auto fingers = VectorizeString(SignedBy, ',');
auto const isAnEmptyString = [](std::string const &s) { return s.empty(); };
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 5df6c58a1..0c7e9ff39 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -153,8 +153,8 @@ bool debSystem::UnLock(bool NoErrors)
return _error->Error(_("Not locked"));
if (--d->LockCount == 0)
{
- close(d->FrontendLockFD);
close(d->LockFD);
+ close(d->FrontendLockFD);
d->LockCount = 0;
}
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index ad5a9007e..4de36d528 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -2460,7 +2460,7 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
{
fprintf(report, "Df:\n");
- FILE *log = popen("/bin/df -l","r");
+ FILE *log = popen("/bin/df -l -x squashfs","r");
if(log != NULL)
{
char buf[1024];
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 3013c0ddb..5cbaf5f9a 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -356,9 +356,9 @@ class pkgDepCache : protected pkgCache::Namespace
inline Header &Head() {return *Cache->HeaderP;};
inline GrpIterator GrpBegin() {return Cache->GrpBegin();};
inline PkgIterator PkgBegin() {return Cache->PkgBegin();};
- inline GrpIterator FindGrp(std::string const &Name) {return Cache->FindGrp(Name);};
- inline PkgIterator FindPkg(std::string const &Name) {return Cache->FindPkg(Name);};
- inline PkgIterator FindPkg(std::string const &Name, std::string const &Arch) {return Cache->FindPkg(Name, Arch);};
+ inline GrpIterator FindGrp(APT::StringView Name) {return Cache->FindGrp(Name);};
+ inline PkgIterator FindPkg(APT::StringView Name) {return Cache->FindPkg(Name);};
+ inline PkgIterator FindPkg(APT::StringView Name, APT::StringView Arch) {return Cache->FindPkg(Name, Arch);};
inline pkgCache &GetCache() {return *Cache;};
inline pkgVersioningSystem &VS() {return *Cache->VS;};
diff --git a/apt-pkg/dirstream.cc b/apt-pkg/dirstream.cc
new file mode 100644
index 000000000..d6cf0ab3f
--- /dev/null
+++ b/apt-pkg/dirstream.cc
@@ -0,0 +1,118 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ Directory Stream
+
+ This class provides a simple basic extractor that can be used for
+ a number of purposes.
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <config.h>
+
+#include <apt-pkg/dirstream.h>
+#include <apt-pkg/error.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <apti18n.h>
+ /*}}}*/
+
+// DirStream::DoItem - Process an item /*{{{*/
+// ---------------------------------------------------------------------
+/* This is a very simple extractor, it does not deal with things like
+ overwriting directories with files and so on. */
+bool pkgDirStream::DoItem(Item &Itm,int &Fd)
+{
+ switch (Itm.Type)
+ {
+ case Item::File:
+ {
+ /* Open the output file, NDELAY is used to prevent this from
+ blowing up on device special files.. */
+ int iFd = open(Itm.Name,O_NDELAY|O_WRONLY|O_CREAT|O_TRUNC|O_APPEND,
+ Itm.Mode);
+ if (iFd < 0)
+ return _error->Errno("open",_("Failed to write file %s"),
+ Itm.Name);
+
+ // fchmod deals with umask and fchown sets the ownership
+ if (fchmod(iFd,Itm.Mode) != 0)
+ {
+ close(iFd);
+ return _error->Errno("fchmod",_("Failed to write file %s"), Itm.Name);
+ }
+ if (fchown(iFd,Itm.UID,Itm.GID) != 0 && errno != EPERM)
+ {
+ close(iFd);
+ return _error->Errno("fchown",_("Failed to write file %s"), Itm.Name);
+ }
+ Fd = iFd;
+ return true;
+ }
+
+ case Item::HardLink:
+ case Item::SymbolicLink:
+ case Item::CharDevice:
+ case Item::BlockDevice:
+ case Item::Directory:
+ {
+ struct stat Buf;
+ // check if the dir is already there, if so return true
+ if (stat(Itm.Name,&Buf) == 0)
+ {
+ if(S_ISDIR(Buf.st_mode))
+ return true;
+ // something else is there already, return false
+ return false;
+ }
+ // nothing here, create the dir
+ if(mkdir(Itm.Name,Itm.Mode) < 0)
+ return false;
+ return true;
+ }
+ case Item::FIFO:
+ break;
+ }
+
+ return true;
+}
+ /*}}}*/
+// DirStream::FinishedFile - Finished processing a file /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgDirStream::FinishedFile(Item &Itm,int Fd)
+{
+ if (Fd < 0)
+ return true;
+
+ /* Set the modification times. The only way it can fail is if someone
+ has futzed with our file, which is intolerable :> */
+ struct timeval times[2];
+ times[0].tv_sec = times[1].tv_sec = Itm.MTime;
+ times[0].tv_usec = times[1].tv_usec = 0;
+ if (utimes(Itm.Name, times) != 0)
+ _error->Errno("utimes", "Failed to set modification time for %s",Itm.Name);
+
+ if (close(Fd) != 0)
+ return _error->Errno("close",_("Failed to close file %s"),Itm.Name);
+ return true;
+}
+ /*}}}*/
+// DirStream::Fail - Failed processing a file /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgDirStream::Fail(Item &/*Itm*/, int Fd)
+{
+ if (Fd < 0)
+ return true;
+
+ close(Fd);
+ return false;
+}
+ /*}}}*/
diff --git a/apt-pkg/dirstream.h b/apt-pkg/dirstream.h
new file mode 100644
index 000000000..0f0e348d0
--- /dev/null
+++ b/apt-pkg/dirstream.h
@@ -0,0 +1,57 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ Directory Stream
+
+ When unpacking the contents of the archive are passed into a directory
+ stream class for analysis and processing. The class controls all aspects
+ of actually writing the directory stream from disk. The low level
+ archive handlers are only responsible for decoding the archive format
+ and sending events (via method calls) to the specified directory
+ stream.
+
+ When unpacking a real file the archive handler is passed back a file
+ handle to write the data to, this is to support strange
+ archives+unpacking methods. If that fd is -1 then the file data is
+ simply ignored.
+
+ The provided defaults do the 'Right Thing' for a normal unpacking
+ process (ie 'tar')
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_DIRSTREAM_H
+#define PKGLIB_DIRSTREAM_H
+
+#include <apt-pkg/macros.h>
+
+class pkgDirStream
+{
+ public:
+
+ // All possible information about a component
+ struct Item
+ {
+ enum Type_t {File, HardLink, SymbolicLink, CharDevice, BlockDevice,
+ Directory, FIFO} Type;
+ char *Name;
+ char *LinkTarget;
+ unsigned long Mode;
+ unsigned long UID;
+ unsigned long GID;
+ unsigned long long Size;
+ unsigned long MTime;
+ unsigned long Major;
+ unsigned long Minor;
+ };
+
+ virtual bool DoItem(Item &Itm,int &Fd);
+ virtual bool Fail(Item &Itm,int Fd);
+ virtual bool FinishedFile(Item &Itm,int Fd);
+ virtual bool Process(Item &/*Itm*/,const unsigned char * /*Data*/,
+ unsigned long long /*Size*/,unsigned long long /*Pos*/) {return true;};
+ virtual ~pkgDirStream() {};
+};
+
+#endif
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 5819a9b4a..edd5cf30e 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -213,21 +213,6 @@ map_id_t pkgCache::sHash(StringView Str) const
Hash = 33 * Hash + tolower_ascii_unsafe(*I);
return Hash % HeaderP->GetHashTableSize();
}
-map_id_t pkgCache::sHash(const string &Str) const
-{
- uint32_t Hash = 5381;
- for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
- Hash = 33 * Hash + tolower_ascii_unsafe((signed char)*I);
- return Hash % HeaderP->GetHashTableSize();
-}
-
-map_id_t pkgCache::sHash(const char *Str) const
-{
- uint32_t Hash = 5381;
- for (const char *I = Str; *I != 0; ++I)
- Hash = 33 * Hash + tolower_ascii_unsafe((signed char)*I);
- return Hash % HeaderP->GetHashTableSize();
-}
#if defined(HAVE_FMV_SSE42_AND_CRC32)
@@ -305,10 +290,6 @@ uint32_t pkgCache::CacheHash()
// Cache::FindPkg - Locate a package by name /*{{{*/
// ---------------------------------------------------------------------
/* Returns 0 on error, pointer to the package otherwise */
-pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
- return FindPkg(StringView(Name));
-}
-
pkgCache::PkgIterator pkgCache::FindPkg(StringView Name) {
auto const found = Name.rfind(':');
if (found == string::npos)
@@ -325,10 +306,6 @@ pkgCache::PkgIterator pkgCache::FindPkg(StringView Name) {
// Cache::FindPkg - Locate a package by name /*{{{*/
// ---------------------------------------------------------------------
/* Returns 0 on error, pointer to the package otherwise */
-pkgCache::PkgIterator pkgCache::FindPkg(const string &Name, string const &Arch) {
- return FindPkg(StringView(Name), StringView(Arch));
-}
-
pkgCache::PkgIterator pkgCache::FindPkg(StringView Name, StringView Arch) {
/* We make a detour via the GrpIterator here as
on a multi-arch environment a group is easier to
@@ -343,10 +320,6 @@ pkgCache::PkgIterator pkgCache::FindPkg(StringView Name, StringView Arch) {
// Cache::FindGrp - Locate a group by name /*{{{*/
// ---------------------------------------------------------------------
/* Returns End-Pointer on error, pointer to the group otherwise */
-pkgCache::GrpIterator pkgCache::FindGrp(const string &Name) {
- return FindGrp(StringView(Name));
-}
-
pkgCache::GrpIterator pkgCache::FindGrp(StringView Name) {
if (unlikely(Name.empty() == true))
return GrpIterator(*this,0);
@@ -416,12 +389,6 @@ const char *pkgCache::Priority(unsigned char Prio)
// GrpIterator::FindPkg - Locate a package by arch /*{{{*/
// ---------------------------------------------------------------------
/* Returns an End-Pointer on error, pointer to the package otherwise */
-pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
- return FindPkg(StringView(Arch));
-}
-pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(const char *Arch) const {
- return FindPkg(StringView(Arch));
-}
pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(StringView Arch) const {
if (unlikely(IsGood() == false || S->FirstPackage == 0))
return PkgIterator(*Owner, 0);
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index c20320a56..4511aade0 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -81,9 +81,7 @@
#include <stdint.h>
#include <time.h>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#ifndef APT_8_CLEANER_HEADERS
using std::string;
@@ -199,11 +197,7 @@ class pkgCache /*{{{*/
// Memory mapped cache file
std::string CacheFile;
MMap &Map;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN map_id_t sHash(APT::StringView S) const APT_PURE;
-#endif
- map_id_t sHash(const std::string &S) const APT_PURE;
- map_id_t sHash(const char *S) const APT_PURE;
+ map_id_t sHash(APT::StringView S) const APT_PURE;
public:
@@ -228,11 +222,7 @@ class pkgCache /*{{{*/
inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}
// String hashing function (512 range)
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN inline map_id_t Hash(APT::StringView S) const {return sHash(S);}
-#endif
- inline map_id_t Hash(const std::string &S) const {return sHash(S);}
- inline map_id_t Hash(const char *S) const {return sHash(S);}
+ inline map_id_t Hash(APT::StringView S) const {return sHash(S);}
APT_HIDDEN uint32_t CacheHash();
@@ -240,25 +230,16 @@ class pkgCache /*{{{*/
static const char *Priority(unsigned char Priority);
// Accessors
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN GrpIterator FindGrp(APT::StringView Name);
- APT_HIDDEN PkgIterator FindPkg(APT::StringView Name);
- APT_HIDDEN PkgIterator FindPkg(APT::StringView Name, APT::StringView Arch);
-#endif
+ GrpIterator FindGrp(APT::StringView Name);
+ PkgIterator FindPkg(APT::StringView Name);
+ PkgIterator FindPkg(APT::StringView Name, APT::StringView Arch);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT::StringView ViewString(map_stringitem_t idx) const
{
char *name = StrP + idx;
uint16_t len = *reinterpret_cast<const uint16_t*>(name - sizeof(uint16_t));
return APT::StringView(name, len);
}
-#endif
-
-
- GrpIterator FindGrp(const std::string &Name);
- PkgIterator FindPkg(const std::string &Name);
- PkgIterator FindPkg(const std::string &Name, const std::string &Arch);
Header &Head() {return *HeaderP;}
inline GrpIterator GrpBegin();
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index 42ea3aa34..1f639c526 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -28,9 +28,7 @@
#if __cplusplus >= 201103L
#include <unordered_set>
#endif
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
class FileFd;
class pkgSourceList;
@@ -40,9 +38,7 @@ class pkgCacheListParser;
class APT_HIDDEN pkgCacheGenerator /*{{{*/
{
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN map_stringitem_t WriteStringInMap(APT::StringView String) { return WriteStringInMap(String.data(), String.size()); };
-#endif
APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String);
APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String, const unsigned long &Len);
APT_HIDDEN map_pointer_t AllocateInMap(const unsigned long &size);
@@ -112,14 +108,12 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
std::string PkgFileName;
pkgCache::PackageFile *CurrentFile;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
bool NewGroup(pkgCache::GrpIterator &Grp, APT::StringView Name);
bool NewPackage(pkgCache::PkgIterator &Pkg, APT::StringView Name, APT::StringView Arch);
map_pointer_t NewVersion(pkgCache::VerIterator &Ver, APT::StringView const &VerStr,
map_pointer_t const ParentPkg, unsigned short const Hash,
map_pointer_t const Next);
map_pointer_t NewDescription(pkgCache::DescIterator &Desc,const std::string &Lang, APT::StringView md5sum,map_stringitem_t const idxmd5str);
-#endif
bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
@@ -133,9 +127,7 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
enum StringType { MIXED, PKGNAME, VERSIONNUMBER, SECTION };
map_stringitem_t StoreString(StringType const type, const char * S, unsigned int const Size);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
inline map_stringitem_t StoreString(enum StringType const type, APT::StringView S) {return StoreString(type, S.data(),S.length());};
-#endif
void DropProgress() {Progress = 0;};
bool SelectFile(const std::string &File,pkgIndexFile const &Index, std::string const &Architecture, std::string const &Component, unsigned long Flags = 0);
@@ -163,19 +155,15 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
void * const d;
APT_HIDDEN bool MergeListGroup(ListParser &List, std::string const &GrpName);
APT_HIDDEN bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
APT::StringView const &Version, pkgCache::VerIterator* &OutVer);
-#endif
APT_HIDDEN bool AddImplicitDepends(pkgCache::GrpIterator &G, pkgCache::PkgIterator &P,
pkgCache::VerIterator &V);
APT_HIDDEN bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator &D);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN bool AddNewDescription(ListParser &List, pkgCache::VerIterator &Ver,
std::string const &lang, APT::StringView CurMd5, map_stringitem_t &md5idx);
-#endif
};
/*}}}*/
// This is the abstract package list parser class. /*{{{*/
@@ -193,13 +181,10 @@ class APT_HIDDEN pkgCacheListParser
protected:
inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, const char *S,unsigned int Size) {return Owner->StoreString(type, S, Size);};
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, APT::StringView S) {return Owner->StoreString(type, S);};
inline map_stringitem_t WriteString(APT::StringView S) {return Owner->WriteStringInMap(S.data(), S.size());};
-#endif
inline map_stringitem_t WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);};
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
bool NewDepends(pkgCache::VerIterator &Ver,APT::StringView Package, APT::StringView Arch,
APT::StringView Version,uint8_t const Op,
uint8_t const Type);
@@ -208,21 +193,16 @@ class APT_HIDDEN pkgCacheListParser
uint8_t const Flags);
bool NewProvidesAllArch(pkgCache::VerIterator &Ver, APT::StringView Package,
APT::StringView Version, uint8_t const Flags);
-#endif
public:
// These all operate against the current section
virtual std::string Package() = 0;
virtual bool ArchitectureAll() = 0;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
virtual APT::StringView Architecture() = 0;
virtual APT::StringView Version() = 0;
-#endif
virtual bool NewVersion(pkgCache::VerIterator &Ver) = 0;
virtual std::vector<std::string> AvailableDescriptionLanguages() = 0;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
virtual APT::StringView Description_md5() = 0;
-#endif
virtual unsigned short VersionHash() = 0;
/** compare currently parsed version with given version
*
diff --git a/apt-pkg/tagfile-compat.cc b/apt-pkg/tagfile-compat.cc
deleted file mode 100644
index 1e1d23e8c..000000000
--- a/apt-pkg/tagfile-compat.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description /*{{{*/
-/* ######################################################################
-
- Fast scanner for RFC-822 type header information
-
- This uses a rotating buffer to load the package information into.
- The scanner runs over it and isolates and indexes a single section.
-
- This defines compat functions for the external code.
-
- ##################################################################### */
- /*}}}*/
-
-#include <config.h>
-#define APT_COMPILING_TAGFILE_COMPAT_CC
-#include <apt-pkg/tagfile.h>
-
-using std::string;
-using APT::StringView;
-
-
-bool pkgTagSection::Exists(const char* const Tag) const
-{
- return Exists(StringView(Tag));
-}
-
-bool pkgTagSection::Find(const char *Tag,unsigned int &Pos) const
-{
- return Find(StringView(Tag), Pos);
-}
-
-bool pkgTagSection::Find(const char *Tag,const char *&Start,
- const char *&End) const
-{
- return Find(StringView(Tag), Start, End);
-}
-
-string pkgTagSection::FindS(const char *Tag) const
-{
- return Find(StringView(Tag)).to_string();
-}
-
-string pkgTagSection::FindRawS(const char *Tag) const
-{
- return FindRaw(StringView(Tag)).to_string();
-}
-
-signed int pkgTagSection::FindI(const char *Tag,signed long Default) const
-{
- return FindI(StringView(Tag), Default);
-}
-
-unsigned long long pkgTagSection::FindULL(const char *Tag, unsigned long long const &Default) const
-{
- return FindULL(StringView(Tag), Default);
-}
- /*}}}*/
-
-bool pkgTagSection::FindB(const char *Tag, bool const &Default) const
-{
- return FindB(StringView(Tag), Default);
-}
-
-bool pkgTagSection::FindFlag(const char * const Tag, uint8_t &Flags,
- uint8_t const Flag) const
-{
- return FindFlag(StringView(Tag), Flags, Flag);
-}
-
-bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags,
- unsigned long Flag) const
-{
- return FindFlag(StringView(Tag), Flags, Flag);
-}
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index de7bfcbaf..d00a735c3 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -27,9 +27,7 @@
#include <list>
#include <string>
#include <vector>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/fileutl.h>
@@ -55,10 +53,8 @@ class pkgTagSection
pkgTagSectionPrivate * const d;
APT_HIDDEN bool FindInternal(unsigned int Pos,const char *&Start, const char *&End) const;
-#if defined(APT_PKG_EXPOSE_STRING_VIEW)
APT_HIDDEN APT::StringView FindInternal(unsigned int Pos) const;
APT_HIDDEN APT::StringView FindRawInternal(unsigned int Pos) const;
-#endif
APT_HIDDEN signed int FindIInternal(unsigned int Pos,signed long Default = 0) const;
APT_HIDDEN bool FindBInternal(unsigned int Pos, bool Default = false) const;
APT_HIDDEN unsigned long long FindULLInternal(unsigned int Pos, unsigned long long const &Default = 0) const;
@@ -73,21 +69,9 @@ class pkgTagSection
inline bool operator ==(const pkgTagSection &rhs) {return Section == rhs.Section;};
inline bool operator !=(const pkgTagSection &rhs) {return Section != rhs.Section;};
-#if !defined(APT_PKG_EXPOSE_STRING_VIEW) || defined(APT_COMPILING_TAGFILE_COMPAT_CC)
- bool Find(const char *Tag,const char *&Start, const char *&End) const;
- bool Find(const char *Tag,unsigned int &Pos) const;
- signed int FindI(const char *Tag,signed long Default = 0) const;
- bool FindB(const char *Tag, bool const &Default = false) const;
- unsigned long long FindULL(const char *Tag, unsigned long long const &Default = 0) const;
- bool FindFlag(const char * const Tag,uint8_t &Flags,
- uint8_t const Flag) const;
- bool FindFlag(const char *Tag,unsigned long &Flags,
- unsigned long Flag) const;
- bool Exists(const char* const Tag) const;
-#endif
// TODO: Remove internally
- std::string FindS(const char *Tag) const;
- std::string FindRawS(const char *Tag) const;
+ std::string FindS(APT::StringView sv) const { return Find(sv).to_string(); }
+ std::string FindRawS(APT::StringView sv) const { return FindRaw(sv).to_string(); };
// Functions for lookup with a perfect hash function
enum class Key;
@@ -99,23 +83,21 @@ class pkgTagSection
APT_HIDDEN bool FindFlag(Key key,uint8_t &Flags, uint8_t const Flag) const;
APT_HIDDEN bool FindFlag(Key key,unsigned long &Flags, unsigned long Flag) const;
APT_HIDDEN bool Exists(Key key) const;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN APT::StringView Find(Key key) const;
APT_HIDDEN APT::StringView FindRaw(Key key) const;
- APT_HIDDEN bool Find(APT::StringView Tag,const char *&Start, const char *&End) const;
- APT_HIDDEN bool Find(APT::StringView Tag,unsigned int &Pos) const;
- APT_HIDDEN APT::StringView Find(APT::StringView Tag) const;
- APT_HIDDEN APT::StringView FindRaw(APT::StringView Tag) const;
- APT_HIDDEN signed int FindI(APT::StringView Tag,signed long Default = 0) const;
- APT_HIDDEN bool FindB(APT::StringView, bool Default = false) const;
- APT_HIDDEN unsigned long long FindULL(APT::StringView Tag, unsigned long long const &Default = 0) const;
-
- APT_HIDDEN bool FindFlag(APT::StringView Tag,uint8_t &Flags,
+ bool Find(APT::StringView Tag,const char *&Start, const char *&End) const;
+ bool Find(APT::StringView Tag,unsigned int &Pos) const;
+ APT::StringView Find(APT::StringView Tag) const;
+ APT::StringView FindRaw(APT::StringView Tag) const;
+ signed int FindI(APT::StringView Tag,signed long Default = 0) const;
+ bool FindB(APT::StringView, bool Default = false) const;
+ unsigned long long FindULL(APT::StringView Tag, unsigned long long const &Default = 0) const;
+
+ bool FindFlag(APT::StringView Tag,uint8_t &Flags,
uint8_t const Flag) const;
- APT_HIDDEN bool FindFlag(APT::StringView Tag,unsigned long &Flags,
+ bool FindFlag(APT::StringView Tag,unsigned long &Flags,
unsigned long Flag) const;
- APT_HIDDEN bool Exists(APT::StringView Tag) const;
-#endif
+ bool Exists(APT::StringView Tag) const;
bool static FindFlag(uint8_t &Flags, uint8_t const Flag,
const char* const Start, const char* const Stop);