diff options
author | CoolStar <coolstarorganization@gmail.com> | 2019-05-02 01:02:42 -0700 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2019-12-26 15:24:16 -1000 |
commit | d784ec66fa0019ae1b359578a85488649fdbd621 (patch) | |
tree | c6f902c34d81b7326084fff2aac4ec31889a8362 /apt-pkg | |
parent | 713b65be84830af1a57148b44dc1d1d4010ece3e (diff) |
1.8.0-Sileosille-apt
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/CMakeLists.txt | 3 | ||||
-rw-r--r-- | apt-pkg/algorithms.h | 3 | ||||
-rw-r--r-- | apt-pkg/algorithms.mm (renamed from apt-pkg/algorithms.cc) | 138 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.h | 2 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 4 | ||||
-rw-r--r-- | apt-pkg/edsp.cc | 9 |
6 files changed, 82 insertions, 77 deletions
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt index 64709ce34..09c82d7e6 100644 --- a/apt-pkg/CMakeLists.txt +++ b/apt-pkg/CMakeLists.txt @@ -32,7 +32,7 @@ set(APT_PKG_MAJOR ${MAJOR} PARENT_SCOPE) # exporting for methods/CMakeLists.txt # Definition of the C++ files used to build the library - note that this # is expanded at CMake time, so you have to rerun cmake if you add or remove # a file (you can just run cmake . in the build directory) -file(GLOB_RECURSE library "*.cc" "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.cc") +file(GLOB_RECURSE library "*.cc" "*.mm" "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.cc") file(GLOB_RECURSE headers "*.h") # Create a library using the C++ files @@ -59,6 +59,7 @@ target_link_libraries(apt-pkg $<$<BOOL:${ZSTD_FOUND}>:${ZSTD_LIBRARIES}> $<$<BOOL:${UDEV_FOUND}>:${UDEV_LIBRARIES}> ${ICONV_LIBRARIES} + "-framework Foundation" ) set_target_properties(apt-pkg PROPERTIES VERSION ${MAJOR}.${MINOR}) set_target_properties(apt-pkg PROPERTIES SOVERSION ${MAJOR}) diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index c5c9f4c69..7637f6d1d 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -87,6 +87,9 @@ public: private: APT_HIDDEN void ShortBreaks(); APT_HIDDEN void Describe(PkgIterator iPkg,std::ostream &out,bool Current,bool Candidate); +#if ENABLE_SILEO + APT_HIDDEN NSMutableDictionary * DescribeSileo(PkgIterator iPkg,bool Current,bool Candidate); +#endif APT_HIDDEN bool RealInstall(PkgIterator Pkg,std::string File); APT_HIDDEN bool RealConfigure(PkgIterator Pkg); APT_HIDDEN bool RealRemove(PkgIterator Pkg,bool Purge); diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.mm index 4c34e5989..be0acb178 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.mm @@ -15,6 +15,9 @@ // Include Files /*{{{*/ #include <config.h> +#define ENABLE_SILEO 1 +#include <Foundation/Foundation.h> + #include <apt-pkg/algorithms.h> #include <apt-pkg/configuration.h> #include <apt-pkg/depcache.h> @@ -73,32 +76,6 @@ pkgSimulate::~pkgSimulate() Parameter Candidate == true displays the candidate package version */ void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candidate) { - bool forSileo = _config->FindB("APT::Format::for-sileo", false); - if (forSileo){ - VerIterator Ver(Sim); - - out << "\"Package\":\"" << Pkg.FullName(true) << "\""; - - if (Current == true) - { - Ver = Pkg.CurrentVer(); - if (Ver.end() == false) - out << ",\"Version\":\"" << Ver.VerStr() << '"'; - } - - if (Candidate == true) - { - Ver = Sim[Pkg].CandidateVerIter(Sim); - if (Ver.end() == true) - return; - - out << ",\"Version\":\"" << Ver.VerStr() << '"'; - out << ",\"Release\":\"" << Ver.RelStr() << '"'; - } - out << "}"; - return; - } - VerIterator Ver(Sim); out << Pkg.FullName(true); @@ -120,6 +97,37 @@ void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candid } } /*}}}*/ +// Simulate::DescribeSileo - Describe a package /*{{{*/ +// --------------------------------------------------------------------- +/* Parameter Current == true displays the current package version, + Parameter Candidate == true displays the candidate package version */ +NSMutableDictionary * pkgSimulate::DescribeSileo(PkgIterator Pkg,bool Current,bool Candidate) +{ + VerIterator Ver(Sim); + + NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; + [dictionary setObject:[NSString stringWithUTF8String:Pkg.FullName(true).c_str()] forKey:@"Package"]; + + if (Current == true) + { + Ver = Pkg.CurrentVer(); + if (Ver.end() == false){ + [dictionary setObject:[NSString stringWithUTF8String:Ver.VerStr()] forKey:@"Version"]; + } + } + + if (Candidate == true) + { + Ver = Sim[Pkg].CandidateVerIter(Sim); + if (Ver.end() == true) + return dictionary; + [dictionary setObject:[NSString stringWithUTF8String:Ver.VerStr()] forKey:@"Version"]; + [dictionary setObject:[NSString stringWithUTF8String:Ver.RelStr().c_str()] forKey:@"Release"]; + } + + return dictionary; +} + /*}}}*/ // Simulate::Install - Simulate unpacking of a package /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -137,39 +145,41 @@ bool pkgSimulate::RealInstall(PkgIterator iPkg,string /*File*/) // Adapt the iterator PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch()); Flags[Pkg->ID] = 1; - - cout << "{\"Type\":\"Inst\","; - Describe(Pkg,cout,true,true); + + NSMutableDictionary *package = DescribeSileo(Pkg, true, true); + [package setObject:@"Inst" forKey:@"Type"]; + + cout << flush; + + NSData *data = [NSJSONSerialization dataWithJSONObject:package options:0 error:nil]; + NSFileHandle *stdout = [NSFileHandle fileHandleWithStandardOutput]; + [stdout writeData:data]; + + cout << endl; + Sim.MarkInstall(Pkg,false); // Look for broken conflicts+predepends. for (PkgIterator I = Sim.PkgBegin(); I.end() == false; ++I) { if (Sim[I].InstallVer == 0) - continue; - + continue; + for (DepIterator D = Sim[I].InstVerIter(Sim).DependsList(); D.end() == false;) { - DepIterator Start; - DepIterator End; - D.GlobOr(Start,End); - if (Start.IsNegative() == true || - End->Type == pkgCache::Dep::PreDepends) + DepIterator Start; + DepIterator End; + D.GlobOr(Start,End); + if (Start.IsNegative() == true || End->Type == pkgCache::Dep::PreDepends) { - if ((Sim[End] & pkgDepCache::DepGInstall) == 0) - { - cout << " [" << I.FullName(false) << " on " << Start.TargetPkg().FullName(false) << ']'; - if (Start->Type == pkgCache::Dep::Conflicts) - _error->Error("Fatal, conflicts violated %s",I.FullName(false).c_str()); - } - } + if ((Sim[End] & pkgDepCache::DepGInstall) == 0) + { + if (Start->Type == pkgCache::Dep::Conflicts) + _error->Error("Fatal, conflicts violated %s",I.FullName(false).c_str()); + } + } } } - - if (Sim.BrokenCount() != 0) - ShortBreaks(); - else - cout << endl; return true; } @@ -227,6 +237,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg) bool pkgSimulate::RealConfigure(PkgIterator iPkg) { bool forSileo = _config->FindB("APT::Format::for-sileo", false); + // Adapt the iterator PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch()); @@ -264,12 +275,12 @@ bool pkgSimulate::RealConfigure(PkgIterator iPkg) cout << "Conf "; Describe(Pkg,cout,false,true); } - } - if (Sim.BrokenCount() != 0) - ShortBreaks(); - else if (!forSileo) - cout << endl; + if (Sim.BrokenCount() != 0) + ShortBreaks(); + else + cout << endl; + } return true; } @@ -287,7 +298,7 @@ bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge) bool pkgSimulate::RealRemove(PkgIterator iPkg,bool Purge) { bool forSileo = _config->FindB("APT::Format::for-sileo", false); - + // Adapt the iterator PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch()); if (Pkg.end() == true) @@ -300,25 +311,30 @@ bool pkgSimulate::RealRemove(PkgIterator iPkg,bool Purge) Sim.MarkDelete(Pkg); if (forSileo){ + NSMutableDictionary *package = DescribeSileo(Pkg, true, false); if (Purge == true) - cout << "{\"Type\":\"Purg\","; + [package setObject:@"Purg" forKey:@"Type"]; else - cout << "{\"Type\":\"Remv\","; + [package setObject:@"Remv" forKey:@"Type"]; + + cout << flush; + + NSData *data = [NSJSONSerialization dataWithJSONObject:package options:0 error:nil]; + NSFileHandle *stdout = [NSFileHandle fileHandleWithStandardOutput]; + [stdout writeData:data]; + + cout << endl; } else { if (Purge == true) cout << "Purg "; else cout << "Remv "; - } - Describe(Pkg,cout,true,false); + Describe(Pkg,cout,true,false); - if (!forSileo){ if (Sim.BrokenCount() != 0) ShortBreaks(); else cout << endl; - } else { - cout << endl; } return true; diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 4cde9f56f..f02252d58 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -52,8 +52,6 @@ class APT_HIDDEN debListParser : public pkgCacheListParser pkgTagSection Section; map_filesize_t iOffset; - std::string Arch; - virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver); bool ParseDepends(pkgCache::VerIterator &Ver, pkgTagSection::Key Key, unsigned int Type); diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 98bac7a70..f88076abf 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -565,10 +565,6 @@ bool debReleaseIndex::Load(std::string const &Filename, std::string * const Erro if (CheckValidUntil == true) { - - if (Date == 0) - strprintf(*ErrorText, _("Invalid '%s' entry in Release file %s"), "Date", Filename.c_str()); - std::string const StrValidUntil = Section.FindS("Valid-Until"); // if we have a Valid-Until header in the Release file, use it as default diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 9879fd8b3..2e39be377 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -661,15 +661,6 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache, OpProgress *Progres _error->Error("External solver failed with: %s", msg.substr(0,msg.find('\n')).c_str()); if (Progress != nullptr) Progress->Done(); - - bool forSileo = _config->FindB("APT::Format::for-sileo", false); - if (forSileo){ - std::cerr << "SOLVERR: " << section.FindS("Error") << std::endl; - std::cerr << "SOLVINFO:" << std::endl; - std::cerr << msg << std::endl << std::endl; - return false; - } - std::cerr << "The solver encountered an error of type: " << section.FindS("Error") << std::endl; std::cerr << "The following information might help you to understand what is wrong:" << std::endl; std::cerr << msg << std::endl << std::endl; |