From ce7f128c020e1347f91c6074238fc5da58c5df71 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Feb 2014 14:26:18 +0100 Subject: support DEB_BUILD_PROFILES and -P for build profiles Inspired by the rest of the patch in 661537, but abstract the parsing of various ways of setting the build profiles more so it can potentially be reused and all apt parts have the same behaviour. Especially config options, cmdline options and environment will not be combined as proposed as this isn't APTs usual behaviour and dpkg doesn't do it either, so one overrides the other as it normally does. --- apt-private/private-cmndline.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-private') diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index ef7d65f3c..b99443210 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -141,6 +141,7 @@ bool addArgumentsAPTGet(std::vector &Args, char const * const { addArg('b', "compile", "APT::Get::Compile", 0); addArg('b', "build", "APT::Get::Compile", 0); + addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg); addArg(0, "diff-only", "APT::Get::Diff-Only", 0); addArg(0, "debian-only", "APT::Get::Diff-Only", 0); addArg(0, "tar-only", "APT::Get::Tar-Only", 0); @@ -149,6 +150,7 @@ bool addArgumentsAPTGet(std::vector &Args, char const * const else if (CmdMatches("build-dep")) { addArg('a', "host-architecture", "APT::Get::Host-Architecture", CommandLine::HasArg); + addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg); addArg(0, "purge", "APT::Get::Purge", 0); addArg(0, "solver", "APT::Solver", CommandLine::HasArg); // this has no effect *but* sbuild is using it (see LP: #1255806) -- cgit v1.2.3 From 67c3067f1a615fd6ff0b332c2a526d052442913d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Feb 2014 22:22:41 +0100 Subject: fix -Wmissing-field-initializers warnings Reported-By: gcc Git-Dch: Ignore --- apt-private/private-show.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 60d951316..9e4bbd35e 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -96,23 +96,23 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, // FIXME: add verbose that does not do the removal of the tags? TFRewriteData RW[] = { // delete, apt-cache show has this info and most users do not care - {"MD5sum", 0}, - {"SHA1", 0}, - {"SHA256", 0}, - {"Filename", 0}, - {"Multi-Arch", 0}, - {"Architecture", 0}, - {"Conffiles",0}, + {"MD5sum", NULL, NULL}, + {"SHA1", NULL, NULL}, + {"SHA256", NULL, NULL}, + {"Filename", NULL, NULL}, + {"Multi-Arch", NULL, NULL}, + {"Architecture", NULL, NULL}, + {"Conffiles", NULL, NULL}, // we use the translated description - {"Description",0}, - {"Description-md5",0}, + {"Description", NULL, NULL}, + {"Description-md5", NULL, NULL}, // improve - {"Installed-Size", installed_size.c_str(), 0}, + {"Installed-Size", installed_size.c_str(), NULL}, {"Size", package_size.c_str(), "Download-Size"}, // add - {"APT-Manual-Installed", manual_installed, 0}, - {"APT-Sources", source_index_file.c_str(), 0}, - {} + {"APT-Manual-Installed", manual_installed, NULL}, + {"APT-Sources", source_index_file.c_str(), NULL}, + {NULL, NULL, NULL} }; if(TFRewrite(stdout, Tags, NULL, RW) == false) -- cgit v1.2.3 From 6298ff8b6492e2071a8f2ca7669a3aeef0fb29c7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Feb 2014 22:30:39 +0100 Subject: fix -Wformat= warnings about size_t != %lu on e.g. armel Git-Dch: Ignore Reported-By: gcc --- apt-private/private-show.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 9e4bbd35e..0a69debbf 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -148,8 +148,9 @@ bool ShowPackage(CommandLine &CmdL) /*{{{*/ if (select == APT::VersionList::CANDIDATE) { APT::VersionList const verset_all = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionList::ALL, helper); - if (verset_all.size() > verset.size()) - _error->Notice(ngettext("There is %lu additional record. Please use the '-a' switch to see it", "There are %lu additional records. Please use the '-a' switch to see them.", verset_all.size() - verset.size()), verset_all.size() - verset.size()); + int const records = verset_all.size() - verset.size(); + if (records > 0) + _error->Notice(P_("There is %i additional record. Please use the '-a' switch to see it", "There are %i additional records. Please use the '-a' switch to see them.", records), records); } for (APT::PackageSet::const_iterator Pkg = helper.virtualPkgs.begin(); -- cgit v1.2.3 From 27511c011f9ade22e90e90e7acbeb87ba7324a19 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 00:56:11 +0100 Subject: warning: non-ISO-standard escape sequence, '\e' [enabled by default] Git-Dch: Ignore Reported-By: gcc -Wpedantic --- apt-private/private-moo.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc index 9b5b94654..23255db6f 100644 --- a/apt-private/private-moo.cc +++ b/apt-private/private-moo.cc @@ -102,16 +102,16 @@ bool DoMoo2(CommandLine &CmdL) /*{{{*/ else { c1out << - OutputInDepth(depth, " ") << " \e[1;97m(\e[0;33m__\e[1;97m)\e[0m\n" << - OutputInDepth(depth, " ") << " \e[31m_______\e[33m~(\e[1;34m..\e[0;33m)~\e[0m\n" << - OutputInDepth(depth, " ") << " \e[33m,----\e[31m\\\e[33m(\e[1;4;35moo\e[0;33m)\e[0m\n" << - OutputInDepth(depth, " ") << " \e[33m/|____|,'\e[0m\n" << - OutputInDepth(depth, " ") << " \e[1;5;97m*\e[0;33m /\\ /\\\e[0m\n" << - "\e[32m"; + OutputInDepth(depth, " ") << " \033[1;97m(\033[0;33m__\033[1;97m)\033[0m\n" << + OutputInDepth(depth, " ") << " \033[31m_______\033[33m~(\033[1;34m..\033[0;33m)~\033[0m\n" << + OutputInDepth(depth, " ") << " \033[33m,----\033[31m\\\033[33m(\033[1;4;35moo\033[0;33m)\033[0m\n" << + OutputInDepth(depth, " ") << " \033[33m/|____|,'\033[0m\n" << + OutputInDepth(depth, " ") << " \033[1;5;97m*\033[0;33m /\\ /\\\033[0m\n" << + "\033[32m"; for (size_t i = moo.length()/2; i > 1; --i) c1out << "wW"; - c1out << "w\e[0m\n" << moo; + c1out << "w\033[0m\n" << moo; } return true; -- cgit v1.2.3 From d3e8fbb395f57954acd7a2095f02ce530a05ec6a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:20:53 +0100 Subject: =?UTF-8?q?warning:=20extra=20=E2=80=98;=E2=80=99=20[-Wpedantic]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-Dch: Ignore Reported-By: gcc -Wpedantic --- apt-private/acqprogress.cc | 62 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'apt-private') diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index d25ffef75..66e1600f1 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -42,12 +42,12 @@ AcqTextStatus::AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet) // AcqTextStatus::Start - Downloading has started /*{{{*/ // --------------------------------------------------------------------- /* */ -void AcqTextStatus::Start() +void AcqTextStatus::Start() { - pkgAcquireStatus::Start(); + pkgAcquireStatus::Start(); BlankLine[0] = 0; ID = 1; -}; +} /*}}}*/ // AcqTextStatus::IMSHit - Called when an item got a HIT response /*{{{*/ // --------------------------------------------------------------------- @@ -58,14 +58,14 @@ void AcqTextStatus::IMSHit(pkgAcquire::ItemDesc &Itm) return; if (Quiet <= 0) - cout << '\r' << BlankLine << '\r'; - + cout << '\r' << BlankLine << '\r'; + cout << _("Hit ") << Itm.Description; if (Itm.Owner->FileSize != 0) cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; cout << endl; Update = true; -}; +} /*}}}*/ // AcqTextStatus::Fetch - An item has started to download /*{{{*/ // --------------------------------------------------------------------- @@ -75,20 +75,20 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) Update = true; if (Itm.Owner->Complete == true) return; - + Itm.Owner->ID = ID++; - + if (Quiet > 1) return; if (Quiet <= 0) cout << '\r' << BlankLine << '\r'; - + cout << _("Get:") << Itm.Owner->ID << ' ' << Itm.Description; if (Itm.Owner->FileSize != 0) cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; cout << endl; -}; +} /*}}}*/ // AcqTextStatus::Done - Completed a download /*{{{*/ // --------------------------------------------------------------------- @@ -96,7 +96,7 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm) { Update = true; -}; +} /*}}}*/ // AcqTextStatus::Fail - Called when an item fails to download /*{{{*/ // --------------------------------------------------------------------- @@ -109,10 +109,10 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) // Ignore certain kinds of transient failures (bad code) if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) return; - + if (Quiet <= 0) cout << '\r' << BlankLine << '\r'; - + if (Itm.Owner->Status == pkgAcquire::Item::StatDone) { cout << _("Ign ") << Itm.Description << endl; @@ -122,9 +122,9 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) cout << _("Err ") << Itm.Description << endl; cout << " " << Itm.Owner->ErrorText << endl; } - + Update = true; -}; +} /*}}}*/ // AcqTextStatus::Stop - Finished downloading /*{{{*/ // --------------------------------------------------------------------- @@ -154,12 +154,12 @@ void AcqTextStatus::Stop() bool AcqTextStatus::Pulse(pkgAcquire *Owner) { pkgAcquireStatus::Pulse(Owner); - + if (Quiet > 0) return true; - + enum {Long = 0,Medium,Short} Mode = Medium; - + char Buffer[sizeof(BlankLine)]; char *End = Buffer + sizeof(Buffer); char *S = Buffer; @@ -174,8 +174,8 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) I = Owner->WorkerStep(I)) { S += strlen(S); - - // There is no item running + + // There is no item running if (I->CurrentItem == 0) { if (I->Status.empty() == false) @@ -183,12 +183,12 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," [%s]",I->Status.c_str()); Shown = true; } - + continue; } Shown = true; - + // Add in the short description if (I->CurrentItem->Owner->ID != 0) snprintf(S,End-S," [%lu %s",I->CurrentItem->Owner->ID, @@ -203,7 +203,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," %s",I->CurrentItem->Owner->Mode); S += strlen(S); } - + // Add the current progress if (Mode == Long) snprintf(S,End-S," %llu",I->CurrentSize); @@ -213,7 +213,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," %sB",SizeToStr(I->CurrentSize).c_str()); } S += strlen(S); - + // Add the total size and percent if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false) { @@ -223,7 +223,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) else snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(), (I->CurrentSize*100.0)/I->TotalSize); - } + } S += strlen(S); snprintf(S,End-S,"]"); } @@ -231,26 +231,26 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) // Show something.. if (Shown == false) snprintf(S,End-S,_(" [Working]")); - + /* Put in the ETA and cps meter, block off signals to prevent strangeness during resizing */ sigset_t Sigs,OldSigs; sigemptyset(&Sigs); sigaddset(&Sigs,SIGWINCH); sigprocmask(SIG_BLOCK,&Sigs,&OldSigs); - + if (CurrentCPS != 0) - { + { char Tmp[300]; unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS; sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str()); unsigned int Len = strlen(Buffer); unsigned int LenT = strlen(Tmp); if (Len + LenT < ScreenWidth) - { + { memset(Buffer + Len,' ',ScreenWidth - Len); strcpy(Buffer + ScreenWidth - LenT,Tmp); - } + } } Buffer[ScreenWidth] = 0; BlankLine[ScreenWidth] = 0; @@ -268,7 +268,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) memset(BlankLine,' ',strlen(Buffer)); BlankLine[strlen(Buffer)] = 0; - + Update = false; return true; -- cgit v1.2.3 From c3ccac9232c2684b15f75fa8622a9a290aeca123 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 03:11:54 +0100 Subject: warning: no previous declaration for foobar() [-Wmissing-declarations] Git-Dch: Ignore Reported-By: gcc -Wmissing-declarations --- apt-private/private-cmndline.cc | 14 +++++++------- apt-private/private-download.cc | 1 + apt-private/private-install.cc | 2 +- apt-private/private-list.cc | 2 +- apt-private/private-moo.cc | 4 ++-- apt-private/private-output.cc | 16 ++++++++-------- apt-private/private-show.cc | 3 ++- apt-private/private-update.cc | 1 + 8 files changed, 23 insertions(+), 20 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index b99443210..132da04d5 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -14,7 +14,7 @@ #include /*}}}*/ -bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ +static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ { va_list args; bool found = false; @@ -33,7 +33,7 @@ bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ /*}}}*/ #define addArg(w,x,y,z) Args.push_back(CommandLine::MakeArgs(w,x,y,z)) #define CmdMatches(...) strcmp_match_in_list(Cmd, __VA_ARGS__, NULL) -bool addArgumentsAPTCache(std::vector &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTCache(std::vector &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("depends", "rdepends", "xvcg", "dotty")) { @@ -82,7 +82,7 @@ bool addArgumentsAPTCache(std::vector &Args, char const * con return true; } /*}}}*/ -bool addArgumentsAPTCDROM(std::vector &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTCDROM(std::vector &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("add", "ident") == false) return false; @@ -100,7 +100,7 @@ bool addArgumentsAPTCDROM(std::vector &Args, char const * con return true; } /*}}}*/ -bool addArgumentsAPTConfig(std::vector &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTConfig(std::vector &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("dump")) { @@ -115,7 +115,7 @@ bool addArgumentsAPTConfig(std::vector &Args, char const * co return true; } /*}}}*/ -bool addArgumentsAPTGet(std::vector &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTGet(std::vector &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade", "dselect-upgrade", "autoremove")) @@ -202,7 +202,7 @@ bool addArgumentsAPTGet(std::vector &Args, char const * const return true; } /*}}}*/ -bool addArgumentsAPTMark(std::vector &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTMark(std::vector &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("auto", "manual", "hold", "unhold", "showauto", "showmanual", "showhold", "showholds", "install", @@ -222,7 +222,7 @@ bool addArgumentsAPTMark(std::vector &Args, char const * cons return true; } /*}}}*/ -bool addArgumentsAPT(std::vector &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPT(std::vector &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("list")) { diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc index f02991cde..80795f964 100644 --- a/apt-private/private-download.cc +++ b/apt-private/private-download.cc @@ -8,6 +8,7 @@ #include #include "private-output.h" +#include "private-download.h" #include diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 3adb00b23..ff609f567 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -386,7 +386,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) // DoAutomaticRemove - Remove all automatic unused packages /*{{{*/ // --------------------------------------------------------------------- /* Remove unused automatic packages */ -bool DoAutomaticRemove(CacheFile &Cache) +static bool DoAutomaticRemove(CacheFile &Cache) { bool Debug = _config->FindI("Debug::pkgAutoRemove",false); bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false); diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index 44a766c84..bc4539aeb 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -99,7 +99,7 @@ private: #undef PackageMatcher }; /*}}}*/ -void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ +static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/ pkgCache::PkgIterator P, std::ostream &outs, bool include_summary=true) diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc index 23255db6f..5d247041d 100644 --- a/apt-private/private-moo.cc +++ b/apt-private/private-moo.cc @@ -22,7 +22,7 @@ #include /*}}}*/ -std::string getMooLine() { /*{{{*/ +static std::string getMooLine() { /*{{{*/ time_t const timenow = time(NULL); struct tm special; localtime_r(&timenow, &special); @@ -60,7 +60,7 @@ std::string getMooLine() { /*{{{*/ return out.str(); } /*}}}*/ -bool printMooLine() { /*{{{*/ +static bool printMooLine() { /*{{{*/ std::cerr << getMooLine() << std::endl; return true; } diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 420ca14d5..dec518392 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -63,7 +63,7 @@ bool InitOutput() /*{{{*/ return true; } /*}}}*/ -std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver) /*{{{*/ +static std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver) /*{{{*/ { std::string suite = ""; if (ver && ver.FileList() && ver.FileList()) @@ -82,7 +82,7 @@ std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver) return suite; } /*}}}*/ -std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ { pkgDepCache *DepCache = CacheFile.GetDepCache(); pkgDepCache::StateCache &state = (*DepCache)[P]; @@ -99,7 +99,7 @@ std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ return flags_str; } /*}}}*/ -std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ { pkgPolicy *policy = CacheFile.GetPolicy(); pkgCache::VerIterator cand = policy->GetCandidateVer(P); @@ -107,14 +107,14 @@ std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P return cand ? cand.VerStr() : "(none)"; } /*}}}*/ -std::string GetInstalledVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetInstalledVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ { pkgCache::VerIterator inst = P.CurrentVer(); return inst ? inst.VerStr() : "(none)"; } /*}}}*/ -std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)/*{{{*/ +static std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)/*{{{*/ { pkgCache::PkgIterator P = V.ParentPkg(); if (V == P.CurrentVer()) @@ -134,16 +134,16 @@ std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)/*{{{*/ return "(none)"; } /*}}}*/ -std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ { pkgPolicy *policy = CacheFile.GetPolicy(); pkgCache::VerIterator inst = P.CurrentVer(); pkgCache::VerIterator cand = policy->GetCandidateVer(P); - + return inst ? inst.Arch() : cand.Arch(); } /*}}}*/ -std::string GetShortDescription(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetShortDescription(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::PkgIterator P)/*{{{*/ { pkgPolicy *policy = CacheFile.GetPolicy(); diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 0a69debbf..94f944af1 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -24,6 +24,7 @@ #include "private-output.h" #include "private-cacheset.h" +#include "private-show.h" /*}}}*/ namespace APT { @@ -31,7 +32,7 @@ namespace APT { // DisplayRecord - Displays the complete record for the package /*{{{*/ // --------------------------------------------------------------------- -bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, +static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, ostream &out) { pkgCache *Cache = CacheFile.GetPkgCache(); diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index f6c12c26a..1f6fb6f79 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -31,6 +31,7 @@ #include "private-cachefile.h" #include "private-output.h" +#include "private-update.h" #include "acqprogress.h" #include -- cgit v1.2.3 From 655122418d714f342b5d9789f45f8035f3fe8b9a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 1 Mar 2014 15:11:42 +0100 Subject: =?UTF-8?q?warning:=20unused=20parameter=20=E2=80=98foo=E2=80=99?= =?UTF-8?q?=20[-Wunused-parameter]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-By: gcc -Wunused-parameter Git-Dch: Ignore --- apt-private/acqprogress.cc | 2 +- apt-private/private-cacheset.h | 8 ++++---- apt-private/private-moo.cc | 8 ++++---- apt-private/private-output.cc | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'apt-private') diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index 66e1600f1..d08ed072f 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -93,7 +93,7 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) // AcqTextStatus::Done - Completed a download /*{{{*/ // --------------------------------------------------------------------- /* We don't display anything... */ -void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm) +void AcqTextStatus::Done(pkgAcquire::ItemDesc &/*Itm*/) { Update = true; } diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h index 322b3be6b..26c7f1ac2 100644 --- a/apt-private/private-cacheset.h +++ b/apt-private/private-cacheset.h @@ -42,8 +42,8 @@ typedef APT::VersionContainer< class Matcher { public: - virtual bool operator () (const pkgCache::PkgIterator &P) { - return true;}; + virtual bool operator () (const pkgCache::PkgIterator &/*P*/) { + return true;} }; // FIXME: add default argument for OpProgress (or overloaded function) @@ -111,8 +111,8 @@ public: Pkg.FullName(true).c_str(), pattern.c_str()); explicitlyNamed = false; } - virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver, - std::string const &ver, bool const verIsRel) { + virtual void showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, pkgCache::VerIterator const Ver, + std::string const &ver, bool const /*verIsRel*/) { if (ver == Ver.VerStr()) return; selectedByRelease.push_back(make_pair(Ver, ver)); diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc index 5d247041d..9c4f6bf15 100644 --- a/apt-private/private-moo.cc +++ b/apt-private/private-moo.cc @@ -65,7 +65,7 @@ static bool printMooLine() { /*{{{*/ return true; } /*}}}*/ -bool DoMoo1(CommandLine &CmdL) /*{{{*/ +bool DoMoo1(CommandLine &) /*{{{*/ { // our trustworthy super cow since 2001 if (_config->FindI("quiet") >= 2) @@ -83,7 +83,7 @@ bool DoMoo1(CommandLine &CmdL) /*{{{*/ return true; } /*}}}*/ -bool DoMoo2(CommandLine &CmdL) /*{{{*/ +bool DoMoo2(CommandLine &) /*{{{*/ { // by Fernando Ribeiro in lp:56125 if (_config->FindI("quiet") >= 2) @@ -117,7 +117,7 @@ bool DoMoo2(CommandLine &CmdL) /*{{{*/ return true; } /*}}}*/ -bool DoMoo3(CommandLine &CmdL) /*{{{*/ +bool DoMoo3(CommandLine &) /*{{{*/ { // by Robert Millan in deb:134156 if (_config->FindI("quiet") >= 2) @@ -134,7 +134,7 @@ bool DoMoo3(CommandLine &CmdL) /*{{{*/ return true; } /*}}}*/ -bool DoMooApril(CommandLine &CmdL) /*{{{*/ +bool DoMooApril(CommandLine &) /*{{{*/ { // by Christopher Allan Webber and proposed by Paul Tagliamonte // in a "Community outreach": https://lists.debian.org/debian-devel/2013/04/msg00045.html diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index dec518392..52f65d794 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -63,7 +63,7 @@ bool InitOutput() /*{{{*/ return true; } /*}}}*/ -static std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver) /*{{{*/ +static std::string GetArchiveSuite(pkgCacheFile &/*CacheFile*/, pkgCache::VerIterator ver) /*{{{*/ { std::string suite = ""; if (ver && ver.FileList() && ver.FileList()) @@ -107,14 +107,14 @@ static std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIte return cand ? cand.VerStr() : "(none)"; } /*}}}*/ -static std::string GetInstalledVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetInstalledVersion(pkgCacheFile &/*CacheFile*/, pkgCache::PkgIterator P)/*{{{*/ { pkgCache::VerIterator inst = P.CurrentVer(); return inst ? inst.VerStr() : "(none)"; } /*}}}*/ -static std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)/*{{{*/ +static std::string GetVersion(pkgCacheFile &/*CacheFile*/, pkgCache::VerIterator V)/*{{{*/ { pkgCache::PkgIterator P = V.ParentPkg(); if (V == P.CurrentVer()) -- cgit v1.2.3 From 453b82a388013e522b3a1b9fcd6ed0810dab1f4f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Mar 2014 22:11:25 +0100 Subject: cleanup headers and especially #includes everywhere Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use) --- apt-private/acqprogress.cc | 5 ++- apt-private/private-cachefile.cc | 12 +++++-- apt-private/private-cachefile.h | 2 ++ apt-private/private-cacheset.cc | 13 ++++++-- apt-private/private-cacheset.h | 15 +++++++++ apt-private/private-cmndline.cc | 6 ++-- apt-private/private-download.cc | 6 ++-- apt-private/private-download.h | 2 +- apt-private/private-install.cc | 68 +++++++++++++++++----------------------- apt-private/private-install.h | 18 +++++++++-- apt-private/private-list.cc | 43 +++++++++---------------- apt-private/private-list.h | 2 +- apt-private/private-main.cc | 12 ++++--- apt-private/private-main.h | 3 +- apt-private/private-moo.cc | 12 ++++--- apt-private/private-output.cc | 14 ++++++--- apt-private/private-output.h | 5 +-- apt-private/private-search.cc | 44 ++++++++++---------------- apt-private/private-search.h | 2 +- apt-private/private-show.cc | 40 ++++++++++++----------- apt-private/private-show.h | 2 +- apt-private/private-sources.cc | 21 ++++++++++--- apt-private/private-sources.h | 7 ++++- apt-private/private-update.cc | 39 +++++++---------------- apt-private/private-upgrade.cc | 18 +++++++---- apt-private/private-upgrade.h | 4 +-- apt-private/private-utils.cc | 8 +++-- apt-private/private-utils.h | 2 -- 28 files changed, 226 insertions(+), 199 deletions(-) (limited to 'apt-private') diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index d08ed072f..fe7a45e12 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -10,18 +10,21 @@ // Include files /*{{{*/ #include +#include #include #include #include #include #include +#include + +#include #include #include #include #include -#include "acqprogress.h" #include /*}}}*/ diff --git a/apt-private/private-cachefile.cc b/apt-private/private-cachefile.cc index c822b9bad..5e955ac39 100644 --- a/apt-private/private-cachefile.cc +++ b/apt-private/private-cachefile.cc @@ -4,11 +4,17 @@ #include #include #include +#include +#include +#include +#include -#include +#include +#include -#include "private-output.h" -#include "private-cachefile.h" +#include +#include +#include #include /*}}}*/ diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index f24d93020..94d93df2c 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -3,6 +3,8 @@ #include #include +#include +#include // class CacheFile - Cover class for some dependency cache functions /*{{{*/ diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index a7dc0e800..4a63c7e81 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -1,9 +1,18 @@ +#include + #include #include #include -#include +#include +#include +#include +#include + +#include + +#include -#include "private-cacheset.h" +#include bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, LocalitySortedVersionSet &output_set, diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h index 26c7f1ac2..854d16922 100644 --- a/apt-private/private-cacheset.h +++ b/apt-private/private-cacheset.h @@ -1,17 +1,32 @@ #ifndef APT_PRIVATE_CACHESET_H #define APT_PRIVATE_CACHESET_H +#include #include #include #include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include #include "private-output.h" #include +class OpProgress; + struct VersionSortDescriptionLocality { bool operator () (const pkgCache::VerIterator &v_lhs, diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 132da04d5..2b2a35637 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -2,15 +2,13 @@ #include #include -#include -#include +#include +#include #include #include -#include "private-cmndline.h" - #include /*}}}*/ diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc index 80795f964..a095f0c67 100644 --- a/apt-private/private-download.cc +++ b/apt-private/private-download.cc @@ -7,10 +7,8 @@ #include #include -#include "private-output.h" -#include "private-download.h" - -#include +#include +#include #include #include diff --git a/apt-private/private-download.h b/apt-private/private-download.h index b8cc8da1e..1447845ed 100644 --- a/apt-private/private-download.h +++ b/apt-private/private-download.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_DOWNLOAD_H #define APT_PRIVATE_DOWNLOAD_H -#include +class pkgAcquire; bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index ff609f567..8092af939 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -1,57 +1,45 @@ // Include Files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include -#include "private-install.h" -#include "private-download.h" -#include "private-cachefile.h" -#include "private-output.h" -#include "private-cacheset.h" -#include "acqprogress.h" +#include +#include +#include +#include +#include +#include #include /*}}}*/ +class pkgSourceList; // InstallPackages - Actually download and install the packages /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-private/private-install.h b/apt-private/private-install.h index 2187146d3..79769d470 100644 --- a/apt-private/private-install.h +++ b/apt-private/private-install.h @@ -1,15 +1,29 @@ #ifndef APT_PRIVATE_INSTALL_H #define APT_PRIVATE_INSTALL_H +#include +#include +#include +#include +#include #include -#include #include +#include + +#include +#include +#include +#include +#include +#include -#include "private-cachefile.h" #include "private-output.h" #include +class CacheFile; +class CommandLine; + #define RAMFS_MAGIC 0x858458f6 bool DoInstall(CommandLine &Cmd); diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index bc4539aeb..7664ca134 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -1,43 +1,28 @@ // Include Files /*{{{*/ #include -#include #include #include #include -#include -#include -#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "private-cmndline.h" -#include "private-list.h" -#include "private-output.h" -#include "private-cacheset.h" +#include #include /*}}}*/ diff --git a/apt-private/private-list.h b/apt-private/private-list.h index 6f5aad27a..749744dd1 100644 --- a/apt-private/private-list.h +++ b/apt-private/private-list.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_LIST_H #define APT_PRIVATE_LIST_H -#include +class CommandLine; bool List(CommandLine &Cmd); diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc index 1fdf3f0be..2d3965172 100644 --- a/apt-private/private-main.cc +++ b/apt-private/private-main.cc @@ -1,9 +1,13 @@ +#include -#include -#include - +#include #include -#include "private-main.h" + +#include + +#include +#include +#include #include diff --git a/apt-private/private-main.h b/apt-private/private-main.h index f9a95c4ec..257c51a0b 100644 --- a/apt-private/private-main.h +++ b/apt-private/private-main.h @@ -1,9 +1,8 @@ #ifndef APT_PRIVATE_MAIN_H #define APT_PRIVATE_MAIN_H -#include +class CommandLine; void CheckSimulateMode(CommandLine &CmdL); - #endif diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc index 9c4f6bf15..a87999150 100644 --- a/apt-private/private-moo.cc +++ b/apt-private/private-moo.cc @@ -13,11 +13,15 @@ #include #include -#include -#include +#include +#include -#include "private-moo.h" -#include "private-output.h" +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 52f65d794..bbd8545ad 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -7,16 +7,22 @@ #include #include #include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include #include -#include #include #include -#include "private-output.h" -#include "private-cachefile.h" - #include /*}}}*/ diff --git a/apt-private/private-output.h b/apt-private/private-output.h index 2a2a69458..81643f90a 100644 --- a/apt-private/private-output.h +++ b/apt-private/private-output.h @@ -1,17 +1,14 @@ #ifndef APT_PRIVATE_OUTPUT_H #define APT_PRIVATE_OUTPUT_H +#include -#include #include #include -#include "private-cachefile.h" - // forward declaration class pkgCacheFile; class CacheFile; -class pkgCache; class pkgDepCache; class pkgRecords; diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc index 0b1a929b0..8106333b6 100644 --- a/apt-private/private-search.cc +++ b/apt-private/private-search.cc @@ -1,40 +1,30 @@ // Includes /*{{{*/ -#include +#include + #include -#include #include -#include -#include -#include #include -#include -#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include +#include +#include +#include + +#include #include -#include -#include -#include -#include -#include -#include +#include #include +#include +#include -#include "private-search.h" -#include "private-cacheset.h" +#include /*}}}*/ bool FullTextSearch(CommandLine &CmdL) /*{{{*/ diff --git a/apt-private/private-search.h b/apt-private/private-search.h index 17faffebc..539915f1f 100644 --- a/apt-private/private-search.h +++ b/apt-private/private-search.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_SEARCH_H #define APT_PRIVATE_SEARCH_H -#include +class CommandLine; bool FullTextSearch(CommandLine &CmdL); diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 94f944af1..8ae6a6dac 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -1,30 +1,32 @@ // Includes /*{{{*/ -#include +#include + #include -#include #include -#include -#include -#include #include -#include +#include #include +#include #include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#include +#include +#include +#include + +#include +#include +#include -#include "private-output.h" -#include "private-cacheset.h" -#include "private-show.h" +#include /*}}}*/ namespace APT { @@ -33,7 +35,7 @@ namespace APT { // DisplayRecord - Displays the complete record for the package /*{{{*/ // --------------------------------------------------------------------- static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, - ostream &out) + std::ostream &out) { pkgCache *Cache = CacheFile.GetPkgCache(); if (unlikely(Cache == NULL)) diff --git a/apt-private/private-show.h b/apt-private/private-show.h index b428c7af0..a15367e28 100644 --- a/apt-private/private-show.h +++ b/apt-private/private-show.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_SHOW_H #define APT_PRIVATE_SHOW_H -#include +class CommandLine; namespace APT { namespace Cmd { diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc index 41cf6b313..301936b9d 100644 --- a/apt-private/private-sources.cc +++ b/apt-private/private-sources.cc @@ -1,10 +1,23 @@ +#include #include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include -#include "private-output.h" -#include "private-sources.h" -#include "private-utils.h" +#include +#include +#include +#include + +#include /* Interface discussion with donkult (for the future): apt [add-{archive,release,component}|edit|change-release|disable]-sources diff --git a/apt-private/private-sources.h b/apt-private/private-sources.h index b394622be..4c58af180 100644 --- a/apt-private/private-sources.h +++ b/apt-private/private-sources.h @@ -1,3 +1,8 @@ -#include +#ifndef APT_PRIVATE_SOURCES_H +#define APT_PRIVATE_SOURCES_H + +class CommandLine; bool EditSources(CommandLine &CmdL); + +#endif diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index 1f6fb6f79..da83d7741 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -1,38 +1,23 @@ // Include files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include +#include +#include -#include -#include -#include +#include +#include +#include +#include -#include "private-cachefile.h" -#include "private-output.h" -#include "private-update.h" -#include "acqprogress.h" +#include +#include #include /*}}}*/ diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc index a97e6d25b..68b2c5e00 100644 --- a/apt-private/private-upgrade.cc +++ b/apt-private/private-upgrade.cc @@ -1,12 +1,18 @@ - // Includes /*{{{*/ -#include +#include + #include +#include +#include + +#include +#include +#include +#include + #include -#include "private-install.h" -#include "private-cachefile.h" -#include "private-upgrade.h" -#include "private-output.h" + +#include /*}}}*/ // this is actually performing the various upgrade operations diff --git a/apt-private/private-upgrade.h b/apt-private/private-upgrade.h index 5efc66bf7..64c4c0874 100644 --- a/apt-private/private-upgrade.h +++ b/apt-private/private-upgrade.h @@ -1,13 +1,11 @@ #ifndef APTPRIVATE_PRIVATE_UPGRADE_H #define APTPRIVATE_PRIVATE_UPGRADE_H -#include - +class CommandLine; bool DoDistUpgrade(CommandLine &CmdL); bool DoUpgrade(CommandLine &CmdL); bool DoUpgradeNoNewPackages(CommandLine &CmdL); bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL); - #endif diff --git a/apt-private/private-utils.cc b/apt-private/private-utils.cc index 813f19329..9547a1b75 100644 --- a/apt-private/private-utils.cc +++ b/apt-private/private-utils.cc @@ -1,9 +1,12 @@ -#include +#include #include #include -#include "private-utils.h" +#include + +#include +#include // DisplayFileInPager - Display File with pager /*{{{*/ void DisplayFileInPager(std::string filename) @@ -26,7 +29,6 @@ void DisplayFileInPager(std::string filename) ExecWait(Process, "sensible-pager", false); } /*}}}*/ - // EditFileInSensibleEditor - Edit File with editor /*{{{*/ void EditFileInSensibleEditor(std::string filename) { diff --git a/apt-private/private-utils.h b/apt-private/private-utils.h index 258dd06a8..4bb535e86 100644 --- a/apt-private/private-utils.h +++ b/apt-private/private-utils.h @@ -6,6 +6,4 @@ void DisplayFileInPager(std::string filename); void EditFileInSensibleEditor(std::string filename); - - #endif -- cgit v1.2.3 From a02db58fd50ef7fc2f0284852c6b3f98e458a232 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Mar 2014 00:33:10 +0100 Subject: follow method attribute suggestions by gcc Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn} --- apt-private/private-cachefile.h | 2 +- apt-private/private-cmndline.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 94d93df2c..67c5e8cdc 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -13,7 +13,7 @@ class CacheFile : public pkgCacheFile { static pkgCache *SortCache; - static int NameComp(const void *a,const void *b); + static int NameComp(const void *a,const void *b) APT_PURE; public: pkgCache::Package **List; diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 2b2a35637..682be0a19 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -12,7 +12,7 @@ #include /*}}}*/ -static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ +APT_SENTINEL static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ { va_list args; bool found = false; -- cgit v1.2.3 From 1166ea79889ecd6c88380f7988182647cf787f8f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 02:54:33 +0100 Subject: msgstr with elipses need three dots fixes some messages and their translation so that all of them have three dots for messages with an elipse. Many translations already had this. --- apt-private/private-install.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-private') diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 8092af939..107ed398e 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -144,7 +144,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) if (DebBytes != Cache->DebSize()) { c0out << DebBytes << ',' << Cache->DebSize() << std::endl; - c0out << _("How odd.. The sizes didn't match, email apt@packages.debian.org") << std::endl; + c0out << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl; } // Number of bytes -- cgit v1.2.3 From 63ff42089863cda53aee240ea0124106e8b4d983 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 21 Mar 2014 15:54:15 +0100 Subject: enable fvisibility=hidden for our private library While it is a huge undertaking to enable it for our public libraries as basically everything we exported so far could be seen as public interface our private library is new and under our full control, so we can do whatever we like with it. The benefits are not that big in return of course, but it reduces the size a bit, so thats great nontheless. Git-Dch: ignore --- apt-private/acqprogress.h | 9 +++++---- apt-private/makefile | 1 + apt-private/private-cachefile.h | 7 ++++--- apt-private/private-cmndline.h | 3 ++- apt-private/private-download.h | 6 ++++-- apt-private/private-install.h | 8 +++++--- apt-private/private-list.h | 4 +++- apt-private/private-main.h | 4 +++- apt-private/private-moo.h | 2 +- apt-private/private-output.h | 21 ++++++++++++--------- apt-private/private-search.h | 4 +++- apt-private/private-show.h | 4 +++- apt-private/private-sources.h | 4 +++- apt-private/private-update.h | 4 +++- apt-private/private-upgrade.h | 6 ++++-- apt-private/private-utils.h | 8 +++++--- 16 files changed, 61 insertions(+), 34 deletions(-) (limited to 'apt-private') diff --git a/apt-private/acqprogress.h b/apt-private/acqprogress.h index e12dafe50..71a10d78a 100644 --- a/apt-private/acqprogress.h +++ b/apt-private/acqprogress.h @@ -10,18 +10,19 @@ #define ACQPROGRESS_H #include +#include #include -class AcqTextStatus : public pkgAcquireStatus +class APT_PUBLIC AcqTextStatus : public pkgAcquireStatus { unsigned int &ScreenWidth; char BlankLine[1024]; unsigned long ID; unsigned long Quiet; - + public: - + virtual bool MediaChange(std::string Media,std::string Drive); virtual void IMSHit(pkgAcquire::ItemDesc &Itm); virtual void Fetch(pkgAcquire::ItemDesc &Itm); @@ -29,7 +30,7 @@ class AcqTextStatus : public pkgAcquireStatus virtual void Fail(pkgAcquire::ItemDesc &Itm); virtual void Start(); virtual void Stop(); - + bool Pulse(pkgAcquire *Owner); AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet); diff --git a/apt-private/makefile b/apt-private/makefile index 728890b9b..09736c6d3 100644 --- a/apt-private/makefile +++ b/apt-private/makefile @@ -16,6 +16,7 @@ LIBRARY=apt-private MAJOR=0.0 MINOR=0 SLIBS=$(PTHREADLIB) -lapt-pkg +CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden PRIVATES=list install download output cachefile cacheset update upgrade cmndline moo search show main utils sources SOURCE += $(foreach private, $(PRIVATES), private-$(private).cc) diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 67c5e8cdc..dce7e0a3a 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -5,16 +5,17 @@ #include #include #include +#include // class CacheFile - Cover class for some dependency cache functions /*{{{*/ // --------------------------------------------------------------------- /* */ -class CacheFile : public pkgCacheFile +class APT_PUBLIC CacheFile : public pkgCacheFile { static pkgCache *SortCache; - static int NameComp(const void *a,const void *b) APT_PURE; - + APT_HIDDEN static int NameComp(const void *a,const void *b) APT_PURE; + public: pkgCache::Package **List; diff --git a/apt-private/private-cmndline.h b/apt-private/private-cmndline.h index 76045ffe7..d0af16782 100644 --- a/apt-private/private-cmndline.h +++ b/apt-private/private-cmndline.h @@ -2,9 +2,10 @@ #define APT_PRIVATE_CMNDLINE_H #include +#include #include -std::vector getCommandArgs(char const * const Program, char const * const Cmd); +APT_PUBLIC std::vector getCommandArgs(char const * const Program, char const * const Cmd); #endif diff --git a/apt-private/private-download.h b/apt-private/private-download.h index 1447845ed..a108aa531 100644 --- a/apt-private/private-download.h +++ b/apt-private/private-download.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_DOWNLOAD_H #define APT_PRIVATE_DOWNLOAD_H +#include + class pkgAcquire; -bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); -bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); +APT_PUBLIC bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); +APT_PUBLIC bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); #endif diff --git a/apt-private/private-install.h b/apt-private/private-install.h index 79769d470..5e18560c5 100644 --- a/apt-private/private-install.h +++ b/apt-private/private-install.h @@ -9,6 +9,9 @@ #include #include #include +#include + +#include #include #include @@ -17,7 +20,6 @@ #include #include -#include "private-output.h" #include @@ -26,13 +28,13 @@ class CommandLine; #define RAMFS_MAGIC 0x858458f6 -bool DoInstall(CommandLine &Cmd); +APT_PUBLIC bool DoInstall(CommandLine &Cmd); bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, std::map &verset); bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache); -bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, +APT_PUBLIC bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, bool Safety = true); diff --git a/apt-private/private-list.h b/apt-private/private-list.h index 749744dd1..461f527cb 100644 --- a/apt-private/private-list.h +++ b/apt-private/private-list.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_LIST_H #define APT_PRIVATE_LIST_H +#include + class CommandLine; -bool List(CommandLine &Cmd); +APT_PUBLIC bool List(CommandLine &Cmd); #endif diff --git a/apt-private/private-main.h b/apt-private/private-main.h index 257c51a0b..23d4aca68 100644 --- a/apt-private/private-main.h +++ b/apt-private/private-main.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_MAIN_H #define APT_PRIVATE_MAIN_H +#include + class CommandLine; -void CheckSimulateMode(CommandLine &CmdL); +APT_PUBLIC void CheckSimulateMode(CommandLine &CmdL); #endif diff --git a/apt-private/private-moo.h b/apt-private/private-moo.h index 7bfc5c1fc..b8e1cfed6 100644 --- a/apt-private/private-moo.h +++ b/apt-private/private-moo.h @@ -3,7 +3,7 @@ class CommandLine; -bool DoMoo(CommandLine &CmdL); +APT_PUBLIC bool DoMoo(CommandLine &CmdL); bool DoMoo1(CommandLine &CmdL); bool DoMoo2(CommandLine &CmdL); bool DoMoo3(CommandLine &CmdL); diff --git a/apt-private/private-output.h b/apt-private/private-output.h index 81643f90a..9633d0c37 100644 --- a/apt-private/private-output.h +++ b/apt-private/private-output.h @@ -2,6 +2,7 @@ #define APT_PRIVATE_OUTPUT_H #include +#include #include #include @@ -13,22 +14,24 @@ class pkgDepCache; class pkgRecords; -extern std::ostream c0out; -extern std::ostream c1out; -extern std::ostream c2out; -extern std::ofstream devnull; -extern unsigned int ScreenWidth; +APT_PUBLIC extern std::ostream c0out; +APT_PUBLIC extern std::ostream c1out; +APT_PUBLIC extern std::ostream c2out; +APT_PUBLIC extern std::ofstream devnull; +APT_PUBLIC extern unsigned int ScreenWidth; -bool InitOutput(); -void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, +APT_PUBLIC bool InitOutput(); + +void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::VerIterator V, std::ostream &out, bool include_summary=true); // helper to describe global state -bool ShowList(std::ostream &out, std::string Title, std::string List, +APT_PUBLIC void ShowBroken(std::ostream &out,CacheFile &Cache,bool Now); + +APT_PUBLIC bool ShowList(std::ostream &out, std::string Title, std::string List, std::string VersionsList); -void ShowBroken(std::ostream &out,CacheFile &Cache,bool Now); void ShowNew(std::ostream &out,CacheFile &Cache); void ShowDel(std::ostream &out,CacheFile &Cache); void ShowKept(std::ostream &out,CacheFile &Cache); diff --git a/apt-private/private-search.h b/apt-private/private-search.h index 539915f1f..d4786233a 100644 --- a/apt-private/private-search.h +++ b/apt-private/private-search.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_SEARCH_H #define APT_PRIVATE_SEARCH_H +#include + class CommandLine; -bool FullTextSearch(CommandLine &CmdL); +APT_PUBLIC bool FullTextSearch(CommandLine &CmdL); #endif diff --git a/apt-private/private-show.h b/apt-private/private-show.h index a15367e28..359aeeb28 100644 --- a/apt-private/private-show.h +++ b/apt-private/private-show.h @@ -1,12 +1,14 @@ #ifndef APT_PRIVATE_SHOW_H #define APT_PRIVATE_SHOW_H +#include + class CommandLine; namespace APT { namespace Cmd { - bool ShowPackage(CommandLine &CmdL); + APT_PUBLIC bool ShowPackage(CommandLine &CmdL); } } #endif diff --git a/apt-private/private-sources.h b/apt-private/private-sources.h index 4c58af180..0c421902e 100644 --- a/apt-private/private-sources.h +++ b/apt-private/private-sources.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_SOURCES_H #define APT_PRIVATE_SOURCES_H +#include + class CommandLine; -bool EditSources(CommandLine &CmdL); +APT_PUBLIC bool EditSources(CommandLine &CmdL); #endif diff --git a/apt-private/private-update.h b/apt-private/private-update.h index d3d0b7af9..e584f70cf 100644 --- a/apt-private/private-update.h +++ b/apt-private/private-update.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_UPDATE_H #define APT_PRIVATE_UPDATE_H +#include + class CommandLine; -bool DoUpdate(CommandLine &CmdL); +APT_PUBLIC bool DoUpdate(CommandLine &CmdL); #endif diff --git a/apt-private/private-upgrade.h b/apt-private/private-upgrade.h index 64c4c0874..16bb93c9b 100644 --- a/apt-private/private-upgrade.h +++ b/apt-private/private-upgrade.h @@ -1,10 +1,12 @@ #ifndef APTPRIVATE_PRIVATE_UPGRADE_H #define APTPRIVATE_PRIVATE_UPGRADE_H +#include + class CommandLine; -bool DoDistUpgrade(CommandLine &CmdL); -bool DoUpgrade(CommandLine &CmdL); +APT_PUBLIC bool DoDistUpgrade(CommandLine &CmdL); +APT_PUBLIC bool DoUpgrade(CommandLine &CmdL); bool DoUpgradeNoNewPackages(CommandLine &CmdL); bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL); diff --git a/apt-private/private-utils.h b/apt-private/private-utils.h index 4bb535e86..432699787 100644 --- a/apt-private/private-utils.h +++ b/apt-private/private-utils.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_UTILS_H #define APT_PRIVATE_UTILS_H -#include +#include -void DisplayFileInPager(std::string filename); -void EditFileInSensibleEditor(std::string filename); +#include + +APT_PUBLIC void DisplayFileInPager(std::string filename); +APT_PUBLIC void EditFileInSensibleEditor(std::string filename); #endif -- cgit v1.2.3 From ec4371acb7bf586b4ed274b47813e5785da6b424 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Apr 2014 12:16:22 +0200 Subject: Fix crash in "apt list" when a sources.list file is unreable Closes: 743413 --- apt-private/private-list.cc | 5 ++--- apt-private/private-list.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index 7664ca134..b053cbcbe 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -99,14 +99,13 @@ static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/ /*}}}*/ // list - list package based on criteria /*{{{*/ // --------------------------------------------------------------------- -bool List(CommandLine &Cmd) +bool DoList(CommandLine &Cmd) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); - pkgRecords records(CacheFile); - if (unlikely(Cache == NULL)) return false; + pkgRecords records(CacheFile); const char **patterns; const char *all_pattern[] = { "*", NULL}; diff --git a/apt-private/private-list.h b/apt-private/private-list.h index 461f527cb..aa2677764 100644 --- a/apt-private/private-list.h +++ b/apt-private/private-list.h @@ -5,7 +5,7 @@ class CommandLine; -APT_PUBLIC bool List(CommandLine &Cmd); +APT_PUBLIC bool DoList(CommandLine &Cmd); #endif -- cgit v1.2.3 From 01837669afa740b594d2075661dc9faa3ab6fe43 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 7 Apr 2014 16:40:12 +0200 Subject: make apt search case-insensitive by default --- apt-private/private-search.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc index 8106333b6..ecd5d7fad 100644 --- a/apt-private/private-search.cc +++ b/apt-private/private-search.cc @@ -68,8 +68,12 @@ bool FullTextSearch(CommandLine &CmdL) /*{{{*/ const char *pattern = patterns[i]; all_found &= ( strstr(V.ParentPkg().Name(), pattern) != NULL || - parser.ShortDesc().find(pattern) != std::string::npos || - parser.LongDesc().find(pattern) != std::string::npos); + strcasestr(parser.ShortDesc().c_str(), pattern) != NULL || + strcasestr(parser.LongDesc().c_str(), pattern) != NULL); + // search patterns are AND by default so we can skip looking further + // on the first mismatch + if(all_found == false) + break; } if (all_found) { -- cgit v1.2.3 From c8259fcde18ad9e08fffb04bf06ed64b87b1ac6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 8 Apr 2014 09:04:15 +0200 Subject: fix apt list output for pkgs in dpkg ^rc state Packages in the "deinstall ok config-file" have no candidate or instaleld version. So they must be special cased in the apt list generation. --- apt-private/private-cacheset.cc | 8 +++++++- apt-private/private-output.cc | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'apt-private') diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index 4a63c7e81..e37e7b227 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -73,7 +73,13 @@ bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, else { pkgPolicy *policy = CacheFile.GetPolicy(); - output_set.insert(policy->GetCandidateVer(P)); + if (policy->GetCandidateVer(P).IsGood()) + output_set.insert(policy->GetCandidateVer(P)); + else + // no candidate, this may happen for packages in + // dpkg "deinstall ok config-file" state - we pick the first ver + // (which should be the only one) + output_set.insert(P.VersionList()); } } progress.Done(); diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index bbd8545ad..757999167 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -146,6 +146,10 @@ static std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterato pkgCache::VerIterator inst = P.CurrentVer(); pkgCache::VerIterator cand = policy->GetCandidateVer(P); + // this may happen for packages in dpkg "deinstall ok config-file" state + if (inst.IsGood() == false && cand.IsGood() == false) + return P.VersionList().Arch(); + return inst ? inst.Arch() : cand.Arch(); } /*}}}*/ -- cgit v1.2.3 From d6570f8577a955a6950ef9fe1ee9def401759336 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 9 Apr 2014 16:23:14 +0200 Subject: Notice the user about "apt list -a" when only a single hit if found If the user is using "apt list pattern" and there is only a single hit, notice about "--all-versions" as this is what the user may be interessted in --- apt-private/private-list.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'apt-private') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index b053cbcbe..b69002103 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -130,10 +130,11 @@ bool DoList(CommandLine &Cmd) Cache->Head().PackageCount, _("Listing")); GetLocalitySortedVersionSet(CacheFile, bag, matcher, progress); + bool ShowAllVersions = _config->FindB("APT::Cmd::All-Versions", false); for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); ++V) { std::stringstream outs; - if(_config->FindB("APT::Cmd::All-Versions", false) == true) + if(ShowAllVersions == true) { ListAllVersions(CacheFile, records, V.ParentPkg(), outs, includeSummary); output_map.insert(std::make_pair( @@ -151,6 +152,18 @@ bool DoList(CommandLine &Cmd) std::cout << (*K).second << std::endl; + // be nice and tell the user if there is more to see + if (bag.size() == 1 && ShowAllVersions == false) + { + // start with -1 as we already displayed one version + int versions = -1; + pkgCache::VerIterator Ver = *bag.begin(); + for ( ; Ver.end() == false; Ver++) + versions++; + if (versions > 0) + _error->Notice(P_("There is %i additional version. Please use the '-a' switch to see it", "There are %i additional versions. Please use the '-a' switch to see them.", versions), versions); + } + return true; } -- cgit v1.2.3 From 53c3a8fa16351f35b7b7d359c81dfbe36ab04444 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 23 Mar 2014 13:17:24 +0100 Subject: use wildcard to get files in our library makefiles The explicit listing is a pain every time you want to add a file to the list and serves no propose as we list all files there anyway, so this is not only easier but also documents this fact. Git-Dch: Ignore --- apt-private/makefile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'apt-private') diff --git a/apt-private/makefile b/apt-private/makefile index 09736c6d3..9a3fbdb29 100644 --- a/apt-private/makefile +++ b/apt-private/makefile @@ -8,9 +8,6 @@ HEADER_TARGETDIRS = apt-private # Bring in the default rules include ../buildlib/defaults.mak -# The library name and version (indirectly used from init.h) -include ../buildlib/libversion.mak - # The library name LIBRARY=apt-private MAJOR=0.0 @@ -18,12 +15,7 @@ MINOR=0 SLIBS=$(PTHREADLIB) -lapt-pkg CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden -PRIVATES=list install download output cachefile cacheset update upgrade cmndline moo search show main utils sources -SOURCE += $(foreach private, $(PRIVATES), private-$(private).cc) -HEADERS += $(foreach private, $(PRIVATES), private-$(private).h) - -SOURCE+= acqprogress.cc -HEADERS+= acqprogress.h private-cacheset.h +SOURCE = $(wildcard *.cc) +HEADERS = $(addprefix apt-private/,$(wildcard *.h)) -HEADERS := $(addprefix apt-private/,$(HEADERS)) include $(LIBRARY_H) -- cgit v1.2.3 From ebe24b7ad56550f21f467b86ceab7f7209a876f6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 16 Apr 2014 22:47:25 +0200 Subject: support dist-upgrade options in full-upgrade dist-upgrade is supposed to be an alias for full-upgrade in apt, but dist-upgrade was the only command recognized of the two in the option and flags recognition code. --- apt-private/private-cmndline.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 682be0a19..a21a9dc8c 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -116,7 +116,7 @@ static bool addArgumentsAPTConfig(std::vector &Args, char con static bool addArgumentsAPTGet(std::vector &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade", - "dselect-upgrade", "autoremove")) + "dselect-upgrade", "autoremove", "full-upgrade")) { addArg(0, "show-progress", "DpkgPM::Progress", 0); addArg('f', "fix-broken", "APT::Get::Fix-Broken", 0); @@ -163,7 +163,7 @@ static bool addArgumentsAPTGet(std::vector &Args, char const if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade", "deselect-upgrade", "autoremove", "clean", "autoclean", "check", - "build-dep")) + "build-dep", "full-upgrade")) { addArg('s', "simulate", "APT::Get::Simulate", 0); addArg('s', "just-print", "APT::Get::Simulate", 0); -- cgit v1.2.3 From a3f63bc4acdc8d3914af34698c823c3b873a9beb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 22 Apr 2014 15:10:19 +0200 Subject: apt-private/acqprogress.cc: fix output when ctrl-c is hit during apt update (LP: #1310548, closes: #744297) --- apt-private/acqprogress.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-private') diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index fe7a45e12..0f5b53e50 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -267,7 +267,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) else cout << '\r' << BlankLine << '\r' << Buffer << flush; if (_config->FindB("Apt::Color", false) == true) - cout << _config->Find("APT::Color::Neutral"); + cout << _config->Find("APT::Color::Neutral") << flush; memset(BlankLine,' ',strlen(Buffer)); BlankLine[strlen(Buffer)] = 0; -- cgit v1.2.3 From 3163087b04ca5c297a7c98c018ba5c30e850a11e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 28 Apr 2014 13:41:33 +0200 Subject: Fix missing ScreenWidth check in apt.cc --- apt-private/private-main.cc | 9 +++++++++ apt-private/private-main.h | 1 + apt-private/private-output.cc | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+) (limited to 'apt-private') diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc index 2d3965172..668b1733a 100644 --- a/apt-private/private-main.cc +++ b/apt-private/private-main.cc @@ -8,9 +8,18 @@ #include #include #include +#include #include + +void InitSignals() +{ + // Setup the signals + signal(SIGPIPE,SIG_IGN); +} + + void CheckSimulateMode(CommandLine &CmdL) { // simulate user-friendly if apt-get has no root privileges diff --git a/apt-private/private-main.h b/apt-private/private-main.h index 23d4aca68..a03bf4441 100644 --- a/apt-private/private-main.h +++ b/apt-private/private-main.h @@ -6,5 +6,6 @@ class CommandLine; APT_PUBLIC void CheckSimulateMode(CommandLine &CmdL); +APT_PUBLIC void InitSignals(); #endif diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 757999167..7f3eef6c2 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include /*}}}*/ @@ -32,8 +33,24 @@ std::ostream c0out(0); std::ostream c1out(0); std::ostream c2out(0); std::ofstream devnull("/dev/null"); + + unsigned int ScreenWidth = 80 - 1; /* - 1 for the cursor */ +// SigWinch - Window size change signal handler /*{{{*/ +// --------------------------------------------------------------------- +/* */ +static void SigWinch(int) +{ + // Riped from GNU ls +#ifdef TIOCGWINSZ + struct winsize ws; + + if (ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col >= 5) + ScreenWidth = ws.ws_col - 1; +#endif +} + /*}}}*/ bool InitOutput() /*{{{*/ { if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1) @@ -47,6 +64,10 @@ bool InitOutput() /*{{{*/ if (_config->FindI("quiet",0) > 1) c1out.rdbuf(devnull.rdbuf()); + // deal with window size changes + signal(SIGWINCH,SigWinch); + SigWinch(0); + if(!isatty(1)) { _config->Set("APT::Color", "false"); -- cgit v1.2.3