From: David Kalnischkies Date: Fri, 7 Nov 2014 13:20:36 +0000 (+0100) Subject: use a abi version check similar to the gcc check X-Git-Tag: 1.1.exp9~140^2~112 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/ccf6bdb3efc54165c76b42aae94c498a36acbe1b use a abi version check similar to the gcc check Git-Dch: Ignore --- diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index c0af4b2c8..14541d4d8 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -156,5 +156,6 @@ #define APT_PKG_MAJOR 4 #define APT_PKG_MINOR 15 #define APT_PKG_RELEASE 0 +#define APT_PKG_ABI ((APT_PKG_MAJOR * 100) + APT_PKG_MINOR) #endif diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 616d8296d..42db341b3 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -992,7 +992,7 @@ unsigned char debListParser::GetPrio(string Str) return Out; } /*}}}*/ -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 bool debListParser::SameVersion(unsigned short const Hash, /*{{{*/ pkgCache::VerIterator const &Ver) { diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index f20f7f33e..a757e69f1 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -71,7 +71,7 @@ class debListParser : public pkgCacheGenerator::ListParser virtual std::vector AvailableDescriptionLanguages(); virtual MD5SumValue Description_md5(); virtual unsigned short VersionHash(); -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver); #endif virtual bool UsePackage(pkgCache::PkgIterator &Pkg, diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index c103da8f7..a6c88b393 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -78,7 +78,7 @@ string debReleaseIndex::MetaIndexURI(const char *Type) const return Res; } -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 0x0413 std::string debReleaseIndex::LocalFileName() const { // see if we have a InRelease file diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index 399543953..3d35401ec 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -53,7 +53,7 @@ class debReleaseIndex : public metaIndex { std::string MetaIndexFile(const char *Types) const; std::string MetaIndexURI(const char *Type) const; -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 virtual std::string LocalFileName() const; #endif diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index 7c4d0c1aa..ae73c27dd 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -40,9 +40,11 @@ class metaIndex virtual const char* GetType() const {return Type;} // interface to to query it -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 // returns the path of the local file (or "" if its not available) virtual std::string LocalFileName() const {return "";}; +#else + std::string LocalFileName() const; #endif // Interface for acquire diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 2247d04db..ba48c53cc 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -1059,7 +1059,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() // PM::DoInstallPostFork - compat /*{{{*/ // --------------------------------------------------------------------- /*}}}*/ -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 pkgPackageManager::OrderResult pkgPackageManager::DoInstallPostFork(int statusFd) { @@ -1096,7 +1096,7 @@ pkgPackageManager::DoInstallPostFork(int statusFd) // PM::DoInstall - Does the installation /*{{{*/ // --------------------------------------------------------------------- /* compat */ -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 pkgPackageManager::OrderResult pkgPackageManager::DoInstall(int statusFd) { @@ -1120,7 +1120,7 @@ pkgPackageManager::OrderResult pkgPackageManager::DoInstall(int statusFd) // --------------------------------------------------------------------- /* This uses the filenames in FileNames and the information in the DepCache to perform the installation of packages.*/ -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 pkgPackageManager::OrderResult pkgPackageManager::DoInstall(APT::Progress::PackageManager *progress) { diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index 5bcd2045d..fce0ad301 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -96,12 +96,10 @@ class pkgPackageManager : protected pkgCache::Namespace virtual bool Install(PkgIterator /*Pkg*/,std::string /*File*/) {return false;}; virtual bool Configure(PkgIterator /*Pkg*/) {return false;}; virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;}; -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 virtual bool Go(APT::Progress::PackageManager * /*progress*/) {return true;}; - virtual bool Go(int /*statusFd*/=-1) {return true;}; -#else - virtual bool Go(int /*statusFd*/=-1) {return true;}; #endif + virtual bool Go(int /*statusFd*/=-1) {return true;}; virtual void Reset() {}; @@ -114,8 +112,8 @@ class pkgPackageManager : protected pkgCache::Namespace bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, pkgRecords *Recs); - // Do the installation -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + // Do the installation +#if APT_PKG_ABI >= 413 OrderResult DoInstall(APT::Progress::PackageManager *progress); // compat APT_DEPRECATED OrderResult DoInstall(int statusFd=-1); @@ -129,7 +127,7 @@ class pkgPackageManager : protected pkgCache::Namespace Res = OrderInstall(); return Res; }; -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 // stuff that needs to be done after the fork OrderResult DoInstallPostFork(APT::Progress::PackageManager *progress); // compat diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 54c4f9e7a..93f30a703 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -178,7 +178,7 @@ class pkgCacheGenerator::ListParser * \param Hash of the currently parsed version * \param Ver to compare with */ -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 virtual #endif APT_PURE bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver); diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 2a4c3eea5..79a22edf4 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -94,7 +94,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) { pkgSimulate PM(Cache); -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if APT_PKG_ABI >= 413 APT::Progress::PackageManager *progress = APT::Progress::PackageManagerProgressFactory(); pkgPackageManager::OrderResult Res = PM.DoInstall(progress); delete progress; @@ -306,8 +306,8 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) } _system->UnLock(); - -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + +#if APT_PKG_ABI >= 413 APT::Progress::PackageManager *progress = APT::Progress::PackageManagerProgressFactory(); pkgPackageManager::OrderResult Res = PM->DoInstall(progress); delete progress;