From c189f87d57844a13619ec387916f49aba171c1b3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Jan 2014 08:12:28 +0100 Subject: flock() the file edited in edit-sources --- apt-private/private-sources.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apt-private') diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc index 65706e785..41cf6b313 100644 --- a/apt-private/private-sources.cc +++ b/apt-private/private-sources.cc @@ -32,6 +32,10 @@ bool EditSources(CommandLine &CmdL) if (FileExists(sourceslist)) before.FromFile(sourceslist); + int lockfd = GetLock(sourceslist); + if (lockfd < 0) + return false; + do { EditFileInSensibleEditor(sourceslist); _error->PushToStack(); @@ -46,6 +50,7 @@ bool EditSources(CommandLine &CmdL) } _error->RevertToStack(); } while (res == false); + close(lockfd); if (FileExists(sourceslist) && !before.VerifyFile(sourceslist)) { strprintf( -- cgit v1.2.3 From 3bdf7da5b40636376699aa8a976aae1b279ef356 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Jan 2014 16:45:11 +0100 Subject: add --manual-installed commandline switch --- apt-private/private-cacheset.cc | 9 +++++++++ apt-private/private-cmndline.cc | 1 + 2 files changed, 10 insertions(+) (limited to 'apt-private') diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index 6fb224010..a7dc0e800 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -52,6 +52,15 @@ bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, output_set.insert(policy->GetCandidateVer(P)); } } + else if (_config->FindB("APT::Cmd::Manual-Installed") == true) + { + if (P.CurrentVer() && + ((*DepCache)[P].Flags & pkgCache::Flag::Auto) == false) + { + pkgPolicy *policy = CacheFile.GetPolicy(); + output_set.insert(policy->GetCandidateVer(P)); + } + } else { pkgPolicy *policy = CacheFile.GetPolicy(); diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 28309af07..d6d7bca64 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -226,6 +226,7 @@ bool addArgumentsAPT(std::vector &Args, char const * const Cm { addArg(0,"installed","APT::Cmd::Installed",0); addArg(0,"upgradable","APT::Cmd::Upgradable",0); + addArg(0,"manual-installed","APT::Cmd::Manual-Installed",0); addArg('v', "verbose", "APT::Cmd::List-Include-Summary", 0); addArg('a', "all-versions", "APT::Cmd::All-Versions", 0); } -- cgit v1.2.3 From 2a79257e96010318c4bc6d2f2e3e9c475e5bf445 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Jan 2014 18:26:07 +0100 Subject: apt-private/private-show.cc: do not show Description-lang: header, the user probably knows his language (thanks to Donkult) --- apt-private/private-show.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index ddc75dbeb..0aa42ecce 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -74,13 +74,12 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, // write the description pkgRecords Recs(*Cache); + // FIXME: show (optionally) all available translations(?) pkgCache::DescIterator Desc = V.TranslatedDescription(); if (Desc.end() == false) { pkgRecords::Parser &P = Recs.Lookup(Desc.FileList()); - if (strcmp(Desc.LanguageCode(),"") != 0) - out << "Description-lang: " << Desc.LanguageCode() << std::endl; - out << "Description" << P.LongDesc(); + out << "Description: " << P.LongDesc(); } // write a final newline (after the description) -- cgit v1.2.3 From 82e7f817a434e29df9ec6fbf19acfd8e7cd890e5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 07:48:43 +0100 Subject: add apt upgrade --dist --- apt-private/private-cmndline.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apt-private') diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index d6d7bca64..cbb40d42e 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -230,6 +230,11 @@ bool addArgumentsAPT(std::vector &Args, char const * const Cm addArg('v', "verbose", "APT::Cmd::List-Include-Summary", 0); addArg('a', "all-versions", "APT::Cmd::All-Versions", 0); } + else if (CmdMatches("upgrade")) + { + // FIXME: find a better term + addArg(0,"dist","APT::Cmd::Dist-Upgrade", CommandLine::Boolean); + } else if (addArgumentsAPTGet(Args, Cmd) || addArgumentsAPTCache(Args, Cmd)) { // we have no (supported) command-name overlaps so far, so we call -- cgit v1.2.3 From 1410955589dc9f0eaa290907cac070b7ebf93b6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 08:43:14 +0100 Subject: add missing integration test for "apt list" --- apt-private/private-list.cc | 12 ++++++++---- apt-private/private-output.cc | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index a02ebf02d..fbb66d204 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -101,11 +101,15 @@ private: /*}}}*/ void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ pkgCache::PkgIterator P, - std::ostream &outs) + std::ostream &outs, + bool include_summary=true) { for (pkgCache::VerIterator Ver = P.VersionList(); Ver.end() == false; Ver++) - ListSingleVersion(CacheFile, records, Ver, outs); + { + ListSingleVersion(CacheFile, records, Ver, outs, include_summary); + outs << "\n"; + } } /*}}}*/ // list - list package based on criteria /*{{{*/ @@ -136,7 +140,7 @@ bool List(CommandLine &Cmd) PackageNameMatcher matcher(patterns); LocalitySortedVersionSet bag; - OpTextProgress progress; + OpTextProgress progress(*_config); progress.OverallProgress(0, Cache->Head().PackageCount, Cache->Head().PackageCount, @@ -147,7 +151,7 @@ bool List(CommandLine &Cmd) std::stringstream outs; if(_config->FindB("APT::Cmd::All-Versions", false) == true) { - ListAllVersions(CacheFile, records, V.ParentPkg(), outs); + ListAllVersions(CacheFile, records, V.ParentPkg(), outs, includeSummary); output_map.insert(std::make_pair( V.ParentPkg().Name(), outs.str())); } else { diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 91d13f31b..a8bbad9e5 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -114,11 +114,13 @@ std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)/*{{{*/ pkgCache::PkgIterator P = V.ParentPkg(); if (V == P.CurrentVer()) { + std::string inst_str = DeNull(V.VerStr()); +#if 0 // FIXME: do we want this or something like this? pkgDepCache *DepCache = CacheFile.GetDepCache(); pkgDepCache::StateCache &state = (*DepCache)[P]; - std::string inst_str = DeNull(V.VerStr()); if (state.Upgradable()) return "**"+inst_str; +#endif return inst_str; } @@ -224,11 +226,11 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ else out << GetVersion(CacheFile, V); } - out << " " << GetArchitecture(CacheFile, P) << " "; + out << " " << GetArchitecture(CacheFile, P); if (include_summary) { out << std::endl - << " " << GetShortDescription(CacheFile, records, P) + << " " << GetShortDescription(CacheFile, records, P) << std::endl; } } -- cgit v1.2.3