summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-02-26 16:31:25 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2019-02-26 16:31:25 +0100
commit3b13b8a0b79d625d2913518529a34e92b4f41539 (patch)
tree404745c04c1eb4548bd6151034229c98d97d36f6 /apt-pkg/contrib
parent4935c8af8acd8856211c0a527bf4dec4dace0d08 (diff)
parente1024dc0acf72b9615c0821f005364543775a58a (diff)
Merge branch 'pu/abi6'
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/fileutl.cc24
-rw-r--r--apt-pkg/contrib/fileutl.h19
-rw-r--r--apt-pkg/contrib/hashes.cc21
-rw-r--r--apt-pkg/contrib/hashes.h43
-rw-r--r--apt-pkg/contrib/macros.h4
-rw-r--r--apt-pkg/contrib/netrc.cc9
-rw-r--r--apt-pkg/contrib/netrc.h2
-rw-r--r--apt-pkg/contrib/sptr.h74
-rw-r--r--apt-pkg/contrib/strutl.cc55
-rw-r--r--apt-pkg/contrib/strutl.h2
10 files changed, 9 insertions, 244 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 0c0cb05ea..3b4a4a10c 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -25,7 +25,6 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/macros.h>
#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/sptr.h>
#include <apt-pkg/strutl.h>
#include <cstdio>
@@ -3015,19 +3014,6 @@ bool FileFd::FileFdError(const char *Description,...) {
return false;
}
/*}}}*/
-gzFile FileFd::gzFd() { /*{{{*/
-#ifdef HAVE_ZLIB
- GzipFileFdPrivate * const gzipd = dynamic_cast<GzipFileFdPrivate*>(d);
- if (gzipd == nullptr)
- return nullptr;
- else
- return gzipd->gz;
-#else
- return nullptr;
-#endif
-}
- /*}}}*/
-
// Glob - wrapper around "glob()" /*{{{*/
std::vector<std::string> Glob(std::string const &pattern, int flags)
{
@@ -3150,16 +3136,6 @@ bool Rename(std::string From, std::string To) /*{{{*/
return true;
}
/*}}}*/
-bool Popen(const char* Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode)/*{{{*/
-{
- return Popen(Args, Fd, Child, Mode, true);
-}
- /*}}}*/
-bool Popen(const char* Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr)/*{{{*/
-{
- return Popen(Args, Fd, Child, Mode, CaptureStderr, false);
-}
- /*}}}*/
bool Popen(const char *Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr, bool Sandbox) /*{{{*/
{
int fd;
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 862880c31..fff49a757 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -133,20 +133,6 @@ class FileFd
unsigned long long FileSize();
time_t ModificationTime();
- /* You want to use 'unsigned long long' if you are talking about a file
- to be able to support large files (>2 or >4 GB) properly.
- This shouldn't happen all to often for the indexes, but deb's might be…
- And as the auto-conversation converts a 'unsigned long *' to a 'bool'
- instead of 'unsigned long long *' we need to provide this explicitly -
- otherwise applications magically start to fail… */
- bool Read(void *To,unsigned long long Size,unsigned long *Actual) APT_DEPRECATED_MSG("The Actual variable you pass in should be an unsigned long long")
- {
- unsigned long long R;
- bool const T = Read(To, Size, &R);
- *Actual = R;
- return T;
- }
-
bool Open(std::string FileName,unsigned int const Mode,CompressMode Compress,unsigned long const AccessMode = 0666);
bool Open(std::string FileName,unsigned int const Mode,APT::Configuration::Compressor const &compressor,unsigned long const AccessMode = 0666);
inline bool Open(std::string const &FileName,unsigned int const Mode, unsigned long const AccessMode = 0666) {
@@ -163,7 +149,6 @@ class FileFd
// Simple manipulators
inline int Fd() {return iFd;};
inline void Fd(int fd) { OpenDescriptor(fd, ReadWrite);};
- gzFile gzFd() APT_DEPRECATED_MSG("Implementation detail, do not use to be able to support bzip2, xz and co") APT_PURE;
inline bool IsOpen() {return iFd >= 0;};
inline bool Failed() {return (Flags & Fail) == Fail;};
@@ -294,9 +279,7 @@ std::vector<std::string> Glob(std::string const &pattern, int flags=0);
* \param Sandbox True if this should run sandboxed
* \return true on success, false on failure with _error set
*/
-bool Popen(const char *Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr, bool Sandbox) APT_HIDDEN;
-bool Popen(const char* Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr);
-bool Popen(const char* Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode);
+bool Popen(const char *Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr = true, bool Sandbox = false);
APT_HIDDEN bool OpenConfigurationFileFd(std::string const &File, FileFd &Fd);
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index 98b92cc81..d03fb6083 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -312,7 +312,6 @@ bool Hashes::Add(const unsigned char * const Data, unsigned long long const Size
if (Size == 0)
return true;
bool Res = true;
-APT_IGNORE_DEPRECATED_PUSH
if ((d->CalcHashes & MD5SUM) == MD5SUM)
Res &= MD5.Add(Data, Size);
if ((d->CalcHashes & SHA1SUM) == SHA1SUM)
@@ -321,15 +320,9 @@ APT_IGNORE_DEPRECATED_PUSH
Res &= SHA256.Add(Data, Size);
if ((d->CalcHashes & SHA512SUM) == SHA512SUM)
Res &= SHA512.Add(Data, Size);
-APT_IGNORE_DEPRECATED_POP
d->FileSize += Size;
return Res;
}
-bool Hashes::Add(const unsigned char * const Data, unsigned long long const Size, unsigned int const Hashes)
-{
- d->CalcHashes = Hashes;
- return Add(Data, Size);
-}
bool Hashes::AddFD(int const Fd,unsigned long long Size)
{
unsigned char Buf[64*64];
@@ -349,11 +342,6 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size)
}
return true;
}
-bool Hashes::AddFD(int const Fd,unsigned long long Size, unsigned int const Hashes)
-{
- d->CalcHashes = Hashes;
- return AddFD(Fd, Size);
-}
bool Hashes::AddFD(FileFd &Fd,unsigned long long Size)
{
unsigned char Buf[64*64];
@@ -378,16 +366,10 @@ bool Hashes::AddFD(FileFd &Fd,unsigned long long Size)
}
return true;
}
-bool Hashes::AddFD(FileFd &Fd,unsigned long long Size, unsigned int const Hashes)
-{
- d->CalcHashes = Hashes;
- return AddFD(Fd, Size);
-}
/*}}}*/
HashStringList Hashes::GetHashStringList()
{
HashStringList hashes;
-APT_IGNORE_DEPRECATED_PUSH
if ((d->CalcHashes & MD5SUM) == MD5SUM)
hashes.push_back(HashString("MD5Sum", MD5.Result().Value()));
if ((d->CalcHashes & SHA1SUM) == SHA1SUM)
@@ -396,13 +378,10 @@ APT_IGNORE_DEPRECATED_PUSH
hashes.push_back(HashString("SHA256", SHA256.Result().Value()));
if ((d->CalcHashes & SHA512SUM) == SHA512SUM)
hashes.push_back(HashString("SHA512", SHA512.Result().Value()));
-APT_IGNORE_DEPRECATED_POP
hashes.FileSize(d->FileSize);
return hashes;
}
-APT_IGNORE_DEPRECATED_PUSH
Hashes::Hashes() : d(new PrivateHashes(~0)) { }
Hashes::Hashes(unsigned int const Hashes) : d(new PrivateHashes(Hashes)) {}
Hashes::Hashes(HashStringList const &Hashes) : d(new PrivateHashes(Hashes)) {}
Hashes::~Hashes() { delete d; }
-APT_IGNORE_DEPRECATED_POP
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h
index 28bfd3459..9ef2945d7 100644
--- a/apt-pkg/contrib/hashes.h
+++ b/apt-pkg/contrib/hashes.h
@@ -53,8 +53,6 @@ class HashString
// get hash type used
std::string HashType() const { return Type; };
std::string HashValue() const { return Hash; };
- APT_DEPRECATED_MSG("method was const-ified") std::string HashType() { return Type; };
- APT_DEPRECATED_MSG("method was const-ified") std::string HashValue() { return Hash; };
// verify the given filename against the currently loaded hash
bool VerifyFile(std::string filename) const;
@@ -182,19 +180,17 @@ class PrivateHashes;
class Hashes
{
PrivateHashes * const d;
-
- public:
- /* those will disappear in the future as it is hard to add new ones this way.
+ /* TODO: those will disappear in the future as it is hard to add new ones this way.
* Use Add* to build the results and get them via GetHashStringList() instead */
- APT_DEPRECATED_MSG("Use general .Add* and .GetHashStringList methods instead of hardcoding specific hashes") MD5Summation MD5;
- APT_DEPRECATED_MSG("Use general .Add* and .GetHashStringList methods instead of hardcoding specific hashes") SHA1Summation SHA1;
- APT_DEPRECATED_MSG("Use general .Add* and .GetHashStringList methods instead of hardcoding specific hashes") SHA256Summation SHA256;
- APT_DEPRECATED_MSG("Use general .Add* and .GetHashStringList methods instead of hardcoding specific hashes") SHA512Summation SHA512;
+ MD5Summation MD5;
+ SHA1Summation SHA1;
+ SHA256Summation SHA256;
+ SHA512Summation SHA512;
+ public:
static const int UntilEOF = 0;
bool Add(const unsigned char * const Data, unsigned long long const Size) APT_NONNULL(2);
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool Add(const unsigned char * const Data, unsigned long long const Size, unsigned int const Hashes) APT_NONNULL(2);
inline bool Add(const char * const Data) APT_NONNULL(2)
{return Add(reinterpret_cast<unsigned char const *>(Data),strlen(Data));};
inline bool Add(const unsigned char * const Beg,const unsigned char * const End) APT_NONNULL(2,3)
@@ -203,13 +199,10 @@ class Hashes
enum SupportedHashes { MD5SUM = (1 << 0), SHA1SUM = (1 << 1), SHA256SUM = (1 << 2),
SHA512SUM = (1 << 3) };
bool AddFD(int const Fd,unsigned long long Size = 0);
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool AddFD(int const Fd,unsigned long long Size, unsigned int const Hashes);
bool AddFD(FileFd &Fd,unsigned long long Size = 0);
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool AddFD(FileFd &Fd,unsigned long long Size, unsigned int const Hashes);
HashStringList GetHashStringList();
-APT_IGNORE_DEPRECATED_PUSH
/** create a Hashes object to calculate all supported hashes
*
* If ALL is too much, you can limit which Hashes are calculated
@@ -221,30 +214,6 @@ APT_IGNORE_DEPRECATED_PUSH
/** @param Hashes is a list of hashes */
Hashes(HashStringList const &Hashes);
virtual ~Hashes();
-APT_IGNORE_DEPRECATED_POP
-
- private:
- APT_HIDDEN APT_PURE inline unsigned int boolsToFlag(bool const addMD5, bool const addSHA1, bool const addSHA256, bool const addSHA512)
- {
- unsigned int hashes = ~0;
- if (addMD5 == false) hashes &= ~MD5SUM;
- if (addSHA1 == false) hashes &= ~SHA1SUM;
- if (addSHA256 == false) hashes &= ~SHA256SUM;
- if (addSHA512 == false) hashes &= ~SHA512SUM;
- return hashes;
- }
-
- public:
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,
- bool const addSHA1, bool const addSHA256, bool const addSHA512) {
- return AddFD(Fd, Size, boolsToFlag(addMD5, addSHA1, addSHA256, addSHA512));
- };
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool AddFD(FileFd &Fd, unsigned long long Size, bool const addMD5,
- bool const addSHA1, bool const addSHA256, bool const addSHA512) {
- return AddFD(Fd, Size, boolsToFlag(addMD5, addSHA1, addSHA256, addSHA512));
- };
-APT_IGNORE_DEPRECATED_POP
};
#endif
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h
index 57d3f6c22..f15625a4c 100644
--- a/apt-pkg/contrib/macros.h
+++ b/apt-pkg/contrib/macros.h
@@ -165,9 +165,9 @@
// 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 5
+#define APT_PKG_MAJOR 6
#define APT_PKG_MINOR 0
-#define APT_PKG_RELEASE 2
+#define APT_PKG_RELEASE 0
#define APT_PKG_ABI ((APT_PKG_MAJOR * 100) + APT_PKG_MINOR)
#endif
diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc
index 48114ba3c..ee1996f8d 100644
--- a/apt-pkg/contrib/netrc.cc
+++ b/apt-pkg/contrib/netrc.cc
@@ -142,15 +142,6 @@ bool MaybeAddAuth(FileFd &NetRCFile, URI &Uri)
return false;
}
-void maybe_add_auth(URI &Uri, std::string NetRCFile)
-{
- if (FileExists(NetRCFile) == false)
- return;
- FileFd fd;
- if (fd.Open(NetRCFile, FileFd::ReadOnly))
- MaybeAddAuth(fd, Uri);
-}
-
/* Check if we are authorized. */
bool IsAuthorized(pkgCache::PkgFileIterator const I, std::vector<std::unique_ptr<FileFd>> &authconfs)
{
diff --git a/apt-pkg/contrib/netrc.h b/apt-pkg/contrib/netrc.h
index 80d95acc1..96a5a0973 100644
--- a/apt-pkg/contrib/netrc.h
+++ b/apt-pkg/contrib/netrc.h
@@ -32,8 +32,6 @@
class URI;
class FileFd;
-APT_DEPRECATED_MSG("Use FileFd-based MaybeAddAuth instead")
-void maybe_add_auth(URI &Uri, std::string NetRCFile);
bool MaybeAddAuth(FileFd &NetRCFile, URI &Uri);
bool IsAuthorized(pkgCache::PkgFileIterator const I, std::vector<std::unique_ptr<FileFd>> &authconfs) APT_HIDDEN;
#endif
diff --git a/apt-pkg/contrib/sptr.h b/apt-pkg/contrib/sptr.h
deleted file mode 100644
index 77806d94d..000000000
--- a/apt-pkg/contrib/sptr.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description /*{{{*/
-/* ######################################################################
-
- Trivial non-ref counted 'smart pointer'
-
- This is really only good to eliminate
- {
- delete Foo;
- return;
- }
-
- Blocks from functions.
-
- I think G++ has become good enough that doing this won't have much
- code size implications.
-
- ##################################################################### */
- /*}}}*/
-#ifndef SMART_POINTER_H
-#define SMART_POINTER_H
-#include <apt-pkg/macros.h>
-
-template <class T>
-class APT_DEPRECATED_MSG("use std::unique_ptr instead") SPtr
-{
- public:
- T *Ptr;
-
- inline T *operator ->() {return Ptr;};
- inline T &operator *() {return *Ptr;};
- inline operator T *() {return Ptr;};
- inline operator void *() {return Ptr;};
- inline T *UnGuard() {T *Tmp = Ptr; Ptr = 0; return Tmp;};
- inline void operator =(T *N) {Ptr = N;};
- inline bool operator ==(T *lhs) const {return Ptr == lhs;};
- inline bool operator !=(T *lhs) const {return Ptr != lhs;};
- inline T*Get() {return Ptr;};
-
- inline SPtr(T *Ptr) : Ptr(Ptr) {};
- inline SPtr() : Ptr(0) {};
- inline ~SPtr() {delete Ptr;};
-};
-
-template <class T>
-class APT_DEPRECATED_MSG("use std::unique_ptr instead") SPtrArray
-{
- public:
- T *Ptr;
-
- //inline T &operator *() {return *Ptr;};
- inline operator T *() {return Ptr;};
- inline operator void *() {return Ptr;};
- inline T *UnGuard() {T *Tmp = Ptr; Ptr = 0; return Tmp;};
- //inline T &operator [](signed long I) {return Ptr[I];};
- inline void operator =(T *N) {Ptr = N;};
- inline bool operator ==(T *lhs) const {return Ptr == lhs;};
- inline bool operator !=(T *lhs) const {return Ptr != lhs;};
- inline T *Get() {return Ptr;};
-
- inline SPtrArray(T *Ptr) : Ptr(Ptr) {};
- inline SPtrArray() : Ptr(0) {};
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
- // gcc warns about this, but we can do nothing here…
-#endif
- inline ~SPtrArray() {delete [] Ptr;};
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
-};
-
-#endif
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 50344d1fe..e854c5bf1 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -806,10 +806,6 @@ int StringToBool(const string &Text,int Default)
// ---------------------------------------------------------------------
/* This converts a time_t into a string time representation that is
year 2000 compliant and timezone neutral */
-string TimeRFC1123(time_t Date)
-{
- return TimeRFC1123(Date, false);
-}
string TimeRFC1123(time_t Date, bool const NumericTimezone)
{
struct tm Conv;
@@ -1099,57 +1095,6 @@ bool FTPMDTMStrToTime(const char* const str,time_t &time)
return true;
}
/*}}}*/
-// StrToTime - Converts a string into a time_t /*{{{*/
-// ---------------------------------------------------------------------
-/* This handles all 3 popular time formats including RFC 1123, RFC 1036
- and the C library asctime format. It requires the GNU library function
- 'timegm' to convert a struct tm in UTC to a time_t. For some bizzar
- reason the C library does not provide any such function :< This also
- handles the weird, but unambiguous FTP time format*/
-bool StrToTime(const string &Val,time_t &Result)
-{
- struct tm Tm;
- char Month[10];
-
- // Skip the day of the week
- const char *I = strchr(Val.c_str(), ' ');
-
- // Handle RFC 1123 time
- Month[0] = 0;
- if (sscanf(I," %2d %3s %4d %2d:%2d:%2d GMT",&Tm.tm_mday,Month,&Tm.tm_year,
- &Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) != 6)
- {
- // Handle RFC 1036 time
- if (sscanf(I," %2d-%3s-%3d %2d:%2d:%2d GMT",&Tm.tm_mday,Month,
- &Tm.tm_year,&Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) == 6)
- Tm.tm_year += 1900;
- else
- {
- // asctime format
- if (sscanf(I," %3s %2d %2d:%2d:%2d %4d",Month,&Tm.tm_mday,
- &Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec,&Tm.tm_year) != 6)
- {
- // 'ftp' time
- if (sscanf(Val.c_str(),"%4d%2d%2d%2d%2d%2d",&Tm.tm_year,&Tm.tm_mon,
- &Tm.tm_mday,&Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) != 6)
- return false;
- Tm.tm_mon--;
- }
- }
- }
-
- Tm.tm_isdst = 0;
- if (Month[0] != 0)
- Tm.tm_mon = MonthConv(Month);
- else
- Tm.tm_mon = 0; // we don't have a month, so pick something
- Tm.tm_year -= 1900;
-
- // Convert to local time and then to GMT
- Result = timegm(&Tm);
- return true;
-}
- /*}}}*/
// StrToNum - Convert a fixed length string to a number /*{{{*/
// ---------------------------------------------------------------------
/* This is used in decoding the crazy fixed length string headers in
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index 9f74f8c2a..c25ce8054 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -66,7 +66,6 @@ std::string TimeToStr(unsigned long Sec);
std::string Base64Encode(const std::string &Str);
std::string OutputInDepth(const unsigned long Depth, const char* Separator=" ");
std::string URItoFileName(const std::string &URI);
-APT_DEPRECATED_MSG("Specify if GMT is required or a numeric timezone can be used") std::string TimeRFC1123(time_t Date);
/** returns a datetime string as needed by HTTP/1.1 and Debian files.
*
* Note: The date will always be represented in a UTC timezone
@@ -94,7 +93,6 @@ std::string TimeRFC1123(time_t Date, bool const NumericTimezone);
*/
bool RFC1123StrToTime(const char* const str,time_t &time) APT_MUSTCHECK;
bool FTPMDTMStrToTime(const char* const str,time_t &time) APT_MUSTCHECK;
-APT_DEPRECATED_MSG("Use RFC1123StrToTime or FTPMDTMStrToTime as needed instead") bool StrToTime(const std::string &Val,time_t &Result);
std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0);
int StringToBool(const std::string &Text,int Default = -1);
bool ReadMessages(int Fd, std::vector<std::string> &List);