summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/acqprogress.cc69
-rw-r--r--apt-private/acqprogress.h9
-rw-r--r--apt-private/makefile1
-rw-r--r--apt-private/private-cachefile.cc12
-rw-r--r--apt-private/private-cachefile.h9
-rw-r--r--apt-private/private-cacheset.cc13
-rw-r--r--apt-private/private-cacheset.h23
-rw-r--r--apt-private/private-cmndline.cc22
-rw-r--r--apt-private/private-cmndline.h3
-rw-r--r--apt-private/private-download.cc5
-rw-r--r--apt-private/private-download.h8
-rw-r--r--apt-private/private-install.cc72
-rw-r--r--apt-private/private-install.h26
-rw-r--r--apt-private/private-list.cc50
-rw-r--r--apt-private/private-list.h6
-rw-r--r--apt-private/private-main.cc12
-rw-r--r--apt-private/private-main.h5
-rw-r--r--apt-private/private-moo.cc38
-rw-r--r--apt-private/private-moo.h2
-rw-r--r--apt-private/private-output.cc30
-rw-r--r--apt-private/private-output.h26
-rw-r--r--apt-private/private-search.cc52
-rw-r--r--apt-private/private-search.h6
-rw-r--r--apt-private/private-show.cc72
-rw-r--r--apt-private/private-show.h6
-rw-r--r--apt-private/private-sources.cc21
-rw-r--r--apt-private/private-sources.h11
-rw-r--r--apt-private/private-update.cc38
-rw-r--r--apt-private/private-update.h4
-rw-r--r--apt-private/private-upgrade.cc18
-rw-r--r--apt-private/private-upgrade.h8
-rw-r--r--apt-private/private-utils.cc8
-rw-r--r--apt-private/private-utils.h8
33 files changed, 378 insertions, 315 deletions
diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc
index d25ffef75..fe7a45e12 100644
--- a/apt-private/acqprogress.cc
+++ b/apt-private/acqprogress.cc
@@ -10,18 +10,21 @@
// Include files /*{{{*/
#include<config.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/error.h>
+#include <apt-private/acqprogress.h>
+
+#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <iostream>
#include <unistd.h>
-#include "acqprogress.h"
#include <apti18n.h>
/*}}}*/
@@ -42,12 +45,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 +61,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,28 +78,28 @@ 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 /*{{{*/
// ---------------------------------------------------------------------
/* We don't display anything... */
-void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm)
+void AcqTextStatus::Done(pkgAcquire::ItemDesc &/*Itm*/)
{
Update = true;
-};
+}
/*}}}*/
// AcqTextStatus::Fail - Called when an item fails to download /*{{{*/
// ---------------------------------------------------------------------
@@ -109,10 +112,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 +125,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 +157,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 +177,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 +186,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 +206,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 +216,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 +226,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 +234,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 +271,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
memset(BlankLine,' ',strlen(Buffer));
BlankLine[strlen(Buffer)] = 0;
-
+
Update = false;
return true;
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 <apt-pkg/acquire.h>
+#include <apt-pkg/macros.h>
#include <string>
-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.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 <apt-pkg/algorithms.h>
#include <apt-pkg/upgrade.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
-#include <cstdlib>
+#include <apt-private/private-output.h>
+#include <apt-private/private-cachefile.h>
-#include "private-output.h"
-#include "private-cachefile.h"
+#include <string.h>
+#include <ostream>
+#include <cstdlib>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h
index f24d93020..dce7e0a3a 100644
--- a/apt-private/private-cachefile.h
+++ b/apt-private/private-cachefile.h
@@ -3,16 +3,19 @@
#include <apt-pkg/cachefile.h>
#include <apt-pkg/progress.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/macros.h>
// 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_HIDDEN static int NameComp(const void *a,const void *b) APT_PURE;
+
public:
pkgCache::Package **List;
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 <config.h>
+
#include <apt-pkg/cachefile.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/depcache.h>
-#include <apt-pkg/strutl.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/policy.h>
+
+#include <apt-private/private-cacheset.h>
+
+#include <stddef.h>
-#include "private-cacheset.h"
+#include <apti18n.h>
bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
LocalitySortedVersionSet &output_set,
diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h
index 322b3be6b..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 <apt-pkg/aptconfiguration.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/sptr.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/macros.h>
#include <algorithm>
#include <vector>
+#include <string.h>
+#include <list>
+#include <ostream>
+#include <set>
+#include <string>
+#include <utility>
#include "private-output.h"
#include <apti18n.h>
+class OpProgress;
+
struct VersionSortDescriptionLocality
{
bool operator () (const pkgCache::VerIterator &v_lhs,
@@ -42,8 +57,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 +126,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-cmndline.cc b/apt-private/private-cmndline.cc
index ef7d65f3c..682be0a19 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -2,19 +2,17 @@
#include <config.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/configuration.h>
-#include <vector>
+#include <apt-private/private-cmndline.h>
+#include <vector>
#include <stdarg.h>
#include <string.h>
-#include "private-cmndline.h"
-
#include <apti18n.h>
/*}}}*/
-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;
@@ -33,7 +31,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<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
+static bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
{
if (CmdMatches("depends", "rdepends", "xvcg", "dotty"))
{
@@ -82,7 +80,7 @@ bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char const * con
return true;
}
/*}}}*/
-bool addArgumentsAPTCDROM(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
+static bool addArgumentsAPTCDROM(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
{
if (CmdMatches("add", "ident") == false)
return false;
@@ -100,7 +98,7 @@ bool addArgumentsAPTCDROM(std::vector<CommandLine::Args> &Args, char const * con
return true;
}
/*}}}*/
-bool addArgumentsAPTConfig(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
+static bool addArgumentsAPTConfig(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
{
if (CmdMatches("dump"))
{
@@ -115,7 +113,7 @@ bool addArgumentsAPTConfig(std::vector<CommandLine::Args> &Args, char const * co
return true;
}
/*}}}*/
-bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
+static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
{
if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade",
"dselect-upgrade", "autoremove"))
@@ -141,6 +139,7 @@ bool addArgumentsAPTGet(std::vector<CommandLine::Args> &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 +148,7 @@ bool addArgumentsAPTGet(std::vector<CommandLine::Args> &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)
@@ -200,7 +200,7 @@ bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const
return true;
}
/*}}}*/
-bool addArgumentsAPTMark(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
+static bool addArgumentsAPTMark(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
{
if (CmdMatches("auto", "manual", "hold", "unhold", "showauto",
"showmanual", "showhold", "showholds", "install",
@@ -220,7 +220,7 @@ bool addArgumentsAPTMark(std::vector<CommandLine::Args> &Args, char const * cons
return true;
}
/*}}}*/
-bool addArgumentsAPT(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
+static bool addArgumentsAPT(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
{
if (CmdMatches("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 <apt-pkg/cmndline.h>
+#include <apt-pkg/macros.h>
#include <vector>
-std::vector<CommandLine::Args> getCommandArgs(char const * const Program, char const * const Cmd);
+APT_PUBLIC std::vector<CommandLine::Args> getCommandArgs(char const * const Program, char const * const Cmd);
#endif
diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc
index f02991cde..a095f0c67 100644
--- a/apt-private/private-download.cc
+++ b/apt-private/private-download.cc
@@ -7,9 +7,8 @@
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
-#include "private-output.h"
-
-#include <locale.h>
+#include <apt-private/private-output.h>
+#include <apt-private/private-download.h>
#include <fstream>
#include <string>
diff --git a/apt-private/private-download.h b/apt-private/private-download.h
index b8cc8da1e..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 <apt-pkg/acquire.h>
+#include <apt-pkg/macros.h>
-bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser);
-bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure);
+class pkgAcquire;
+
+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.cc b/apt-private/private-install.cc
index 3adb00b23..107ed398e 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -1,57 +1,45 @@
// Include Files /*{{{*/
#include <config.h>
-#include <apt-pkg/aptconfiguration.h>
-#include <apt-pkg/error.h>
-#include <apt-pkg/cmndline.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/depcache.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/algorithms.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/clean.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
+#include <apt-pkg/algorithms.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/sptr.h>
-#include <apt-pkg/md5.h>
-#include <apt-pkg/versionmatch.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/cmndline.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/install-progress.h>
-#include <apt-pkg/init.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/sptr.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/packagemanager.h>
+#include <apt-pkg/pkgcache.h>
-#include <set>
-#include <locale.h>
-#include <langinfo.h>
-#include <fstream>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
-#include <signal.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <regex.h>
-#include <sys/wait.h>
-#include <sstream>
+#include <algorithm>
+#include <iostream>
+#include <set>
+#include <vector>
-#include "private-install.h"
-#include "private-download.h"
-#include "private-cachefile.h"
-#include "private-output.h"
-#include "private-cacheset.h"
-#include "acqprogress.h"
+#include <apt-private/acqprogress.h>
+#include <apt-private/private-install.h>
+#include <apt-private/private-cachefile.h>
+#include <apt-private/private-cacheset.h>
+#include <apt-private/private-download.h>
+#include <apt-private/private-output.h>
#include <apti18n.h>
/*}}}*/
+class pkgSourceList;
// InstallPackages - Actually download and install the packages /*{{{*/
// ---------------------------------------------------------------------
@@ -156,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
@@ -386,7 +374,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-install.h b/apt-private/private-install.h
index 2187146d3..5e18560c5 100644
--- a/apt-private/private-install.h
+++ b/apt-private/private-install.h
@@ -1,24 +1,40 @@
#ifndef APT_PRIVATE_INSTALL_H
#define APT_PRIVATE_INSTALL_H
+#include <apt-pkg/cachefile.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/cmndline.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/algorithms.h>
+#include <apt-pkg/macros.h>
+
+#include <apt-private/private-output.h>
+
+#include <stddef.h>
+#include <iosfwd>
+#include <list>
+#include <map>
+#include <string>
+#include <utility>
-#include "private-cachefile.h"
-#include "private-output.h"
#include <apti18n.h>
+class CacheFile;
+class CommandLine;
+
#define RAMFS_MAGIC 0x858458f6
-bool DoInstall(CommandLine &Cmd);
+APT_PUBLIC bool DoInstall(CommandLine &Cmd);
bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache,
std::map<unsigned short, APT::VersionSet> &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.cc b/apt-private/private-list.cc
index 44a766c84..b053cbcbe 100644
--- a/apt-private/private-list.cc
+++ b/apt-private/private-list.cc
@@ -1,43 +1,28 @@
// Include Files /*{{{*/
#include <config.h>
-#include <apt-pkg/error.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cachefilter.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/sourcelist.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/fileutl.h>
#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
-#include <apt-pkg/policy.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/sptr.h>
-#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/metaindex.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-private/private-cacheset.h>
+#include <apt-private/private-list.h>
+#include <apt-private/private-output.h>
+
+#include <iostream>
#include <sstream>
-#include <vector>
+#include <map>
+#include <string>
#include <utility>
-#include <cassert>
-#include <locale.h>
-#include <iostream>
-#include <unistd.h>
-#include <errno.h>
-#include <regex.h>
-#include <stdio.h>
-#include <algorithm>
-
-#include "private-cmndline.h"
-#include "private-list.h"
-#include "private-output.h"
-#include "private-cacheset.h"
+#include <vector>
#include <apti18n.h>
/*}}}*/
@@ -99,7 +84,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)
@@ -114,14 +99,13 @@ 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 6f5aad27a..aa2677764 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 <apt-pkg/cmndline.h>
+#include <apt-pkg/macros.h>
-bool List(CommandLine &Cmd);
+class CommandLine;
+
+APT_PUBLIC bool DoList(CommandLine &Cmd);
#endif
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 <config.h>
-#include<unistd.h>
-#include<cstring>
-
+#include <apt-pkg/cmndline.h>
#include <apt-pkg/configuration.h>
-#include "private-main.h"
+
+#include <apt-private/private-main.h>
+
+#include <iostream>
+#include <string.h>
+#include <unistd.h>
#include <apti18n.h>
diff --git a/apt-private/private-main.h b/apt-private/private-main.h
index f9a95c4ec..23d4aca68 100644
--- a/apt-private/private-main.h
+++ b/apt-private/private-main.h
@@ -1,9 +1,10 @@
#ifndef APT_PRIVATE_MAIN_H
#define APT_PRIVATE_MAIN_H
-#include <apt-pkg/cmndline.h>
+#include <apt-pkg/macros.h>
-void CheckSimulateMode(CommandLine &CmdL);
+class CommandLine;
+APT_PUBLIC void CheckSimulateMode(CommandLine &CmdL);
#endif
diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc
index 9b5b94654..a87999150 100644
--- a/apt-private/private-moo.cc
+++ b/apt-private/private-moo.cc
@@ -13,16 +13,20 @@
#include <apt-pkg/cmndline.h>
#include <apt-pkg/strutl.h>
-#include <strings.h>
-#include <sstream>
+#include <apt-private/private-moo.h>
+#include <apt-private/private-output.h>
-#include "private-moo.h"
-#include "private-output.h"
+#include <stddef.h>
+#include <string.h>
+#include <time.h>
+#include <iostream>
+#include <sstream>
+#include <string>
#include <apti18n.h>
/*}}}*/
-std::string getMooLine() { /*{{{*/
+static std::string getMooLine() { /*{{{*/
time_t const timenow = time(NULL);
struct tm special;
localtime_r(&timenow, &special);
@@ -60,12 +64,12 @@ std::string getMooLine() { /*{{{*/
return out.str();
}
/*}}}*/
-bool printMooLine() { /*{{{*/
+static bool printMooLine() { /*{{{*/
std::cerr << getMooLine() << std::endl;
return true;
}
/*}}}*/
-bool DoMoo1(CommandLine &CmdL) /*{{{*/
+bool DoMoo1(CommandLine &) /*{{{*/
{
// our trustworthy super cow since 2001
if (_config->FindI("quiet") >= 2)
@@ -83,7 +87,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)
@@ -102,22 +106,22 @@ 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;
}
/*}}}*/
-bool DoMoo3(CommandLine &CmdL) /*{{{*/
+bool DoMoo3(CommandLine &) /*{{{*/
{
// by Robert Millan in deb:134156
if (_config->FindI("quiet") >= 2)
@@ -134,7 +138,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-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.cc b/apt-private/private-output.cc
index 420ca14d5..bbd8545ad 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -7,16 +7,22 @@
#include <apt-pkg/cachefile.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/policy.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-private/private-output.h>
+#include <apt-private/private-cachefile.h>
+
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <iomanip>
#include <iostream>
-#include <locale.h>
#include <langinfo.h>
#include <unistd.h>
-#include "private-output.h"
-#include "private-cachefile.h"
-
#include <apti18n.h>
/*}}}*/
@@ -63,7 +69,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 +88,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 +105,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 +113,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 +140,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-output.h b/apt-private/private-output.h
index 2a2a69458..9633d0c37 100644
--- a/apt-private/private-output.h
+++ b/apt-private/private-output.h
@@ -1,37 +1,37 @@
#ifndef APT_PRIVATE_OUTPUT_H
#define APT_PRIVATE_OUTPUT_H
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/macros.h>
-#include <iostream>
#include <fstream>
#include <string>
-#include "private-cachefile.h"
-
// forward declaration
class pkgCacheFile;
class CacheFile;
-class pkgCache;
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;
+
+APT_PUBLIC bool InitOutput();
-bool InitOutput();
-void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,
+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.cc b/apt-private/private-search.cc
index 0b1a929b0..ecd5d7fad 100644
--- a/apt-private/private-search.cc
+++ b/apt-private/private-search.cc
@@ -1,40 +1,30 @@
// Includes /*{{{*/
-#include <apt-pkg/error.h>
+#include <config.h>
+
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/cachefilter.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/sourcelist.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/fileutl.h>
#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
#include <apt-pkg/policy.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/sptr.h>
-#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/metaindex.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
-#include <sstream>
-#include <utility>
-#include <cassert>
-#include <locale.h>
+#include <apt-private/private-cacheset.h>
+#include <apt-private/private-output.h>
+#include <apt-private/private-search.h>
+
+#include <string.h>
#include <iostream>
-#include <unistd.h>
-#include <errno.h>
-#include <regex.h>
-#include <stdio.h>
-#include <iomanip>
-#include <algorithm>
+#include <sstream>
#include <map>
+#include <string>
+#include <utility>
-#include "private-search.h"
-#include "private-cacheset.h"
+#include <apti18n.h>
/*}}}*/
bool FullTextSearch(CommandLine &CmdL) /*{{{*/
@@ -78,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)
{
diff --git a/apt-private/private-search.h b/apt-private/private-search.h
index 17faffebc..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 <apt-pkg/cmndline.h>
+#include <apt-pkg/macros.h>
-bool FullTextSearch(CommandLine &CmdL);
+class CommandLine;
+
+APT_PUBLIC bool FullTextSearch(CommandLine &CmdL);
#endif
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc
index 60d951316..8ae6a6dac 100644
--- a/apt-private/private-show.cc
+++ b/apt-private/private-show.cc
@@ -1,29 +1,32 @@
// Includes /*{{{*/
-#include <apt-pkg/error.h>
+#include <config.h>
+
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/cachefilter.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/sourcelist.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/indexfile.h>
#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
-#include <apt-pkg/policy.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/sptr.h>
#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/metaindex.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/tagfile.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
-#include <apti18n.h>
+#include <apt-private/private-cacheset.h>
+#include <apt-private/private-output.h>
+#include <apt-private/private-show.h>
+
+#include <stdio.h>
+#include <ostream>
+#include <string>
-#include "private-output.h"
-#include "private-cacheset.h"
+#include <apti18n.h>
/*}}}*/
namespace APT {
@@ -31,8 +34,8 @@ namespace APT {
// DisplayRecord - Displays the complete record for the package /*{{{*/
// ---------------------------------------------------------------------
-bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
- ostream &out)
+static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
+ std::ostream &out)
{
pkgCache *Cache = CacheFile.GetPkgCache();
if (unlikely(Cache == NULL))
@@ -96,23 +99,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)
@@ -148,8 +151,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();
diff --git a/apt-private/private-show.h b/apt-private/private-show.h
index b428c7af0..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 <apt-pkg/cmndline.h>
+#include <apt-pkg/macros.h>
+
+class CommandLine;
namespace APT {
namespace Cmd {
- bool ShowPackage(CommandLine &CmdL);
+ APT_PUBLIC bool ShowPackage(CommandLine &CmdL);
}
}
#endif
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 <config.h>
#include <apt-pkg/hashes.h>
-#include <apti18n.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/cmndline.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+
+#include <apt-private/private-output.h>
+#include <apt-private/private-sources.h>
+#include <apt-private/private-utils.h>
-#include "private-output.h"
-#include "private-sources.h"
-#include "private-utils.h"
+#include <stddef.h>
+#include <unistd.h>
+#include <iostream>
+#include <string>
+
+#include <apti18n.h>
/* 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..0c421902e 100644
--- a/apt-private/private-sources.h
+++ b/apt-private/private-sources.h
@@ -1,3 +1,10 @@
-#include <apt-pkg/cmndline.h>
+#ifndef APT_PRIVATE_SOURCES_H
+#define APT_PRIVATE_SOURCES_H
-bool EditSources(CommandLine &CmdL);
+#include <apt-pkg/macros.h>
+
+class CommandLine;
+
+APT_PUBLIC bool EditSources(CommandLine &CmdL);
+
+#endif
diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc
index f6c12c26a..da83d7741 100644
--- a/apt-private/private-update.cc
+++ b/apt-private/private-update.cc
@@ -1,37 +1,23 @@
// Include files /*{{{*/
#include<config.h>
-#include <apt-pkg/aptconfiguration.h>
-#include <apt-pkg/error.h>
-#include <apt-pkg/cmndline.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/depcache.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/algorithms.h>
#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/clean.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/cacheset.h>
-#include <apt-pkg/sptr.h>
-#include <apt-pkg/md5.h>
-#include <apt-pkg/versionmatch.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/indexfile.h>
+#include <apt-pkg/cmndline.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/sourcelist.h>
#include <apt-pkg/update.h>
+#include <apt-pkg/acquire.h>
+#include <apt-pkg/configuration.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#include <apt-private/acqprogress.h>
+#include <apt-private/private-cachefile.h>
+#include <apt-private/private-output.h>
+#include <apt-private/private-update.h>
-#include "private-cachefile.h"
-#include "private-output.h"
-#include "acqprogress.h"
+#include <ostream>
+#include <string>
#include <apti18n.h>
/*}}}*/
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 <apt-pkg/macros.h>
+
class CommandLine;
-bool DoUpdate(CommandLine &CmdL);
+APT_PUBLIC bool DoUpdate(CommandLine &CmdL);
#endif
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 <apt-pkg/algorithms.h>
+#include <config.h>
+
#include <apt-pkg/upgrade.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/error.h>
+
+#include <apt-private/private-install.h>
+#include <apt-private/private-cachefile.h>
+#include <apt-private/private-upgrade.h>
+#include <apt-private/private-output.h>
+
#include <iostream>
-#include "private-install.h"
-#include "private-cachefile.h"
-#include "private-upgrade.h"
-#include "private-output.h"
+
+#include <apti18n.h>
/*}}}*/
// this is actually performing the various upgrade operations
diff --git a/apt-private/private-upgrade.h b/apt-private/private-upgrade.h
index 5efc66bf7..16bb93c9b 100644
--- a/apt-private/private-upgrade.h
+++ b/apt-private/private-upgrade.h
@@ -1,13 +1,13 @@
#ifndef APTPRIVATE_PRIVATE_UPGRADE_H
#define APTPRIVATE_PRIVATE_UPGRADE_H
-#include <apt-pkg/cmndline.h>
+#include <apt-pkg/macros.h>
+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);
-
#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 <cstdlib>
+#include <config.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/fileutl.h>
-#include "private-utils.h"
+#include <apt-private/private-utils.h>
+
+#include <cstdlib>
+#include <unistd.h>
// 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..432699787 100644
--- a/apt-private/private-utils.h
+++ b/apt-private/private-utils.h
@@ -1,11 +1,11 @@
#ifndef APT_PRIVATE_UTILS_H
#define APT_PRIVATE_UTILS_H
-#include<string>
-
-void DisplayFileInPager(std::string filename);
-void EditFileInSensibleEditor(std::string filename);
+#include <apt-pkg/macros.h>
+#include <string>
+APT_PUBLIC void DisplayFileInPager(std::string filename);
+APT_PUBLIC void EditFileInSensibleEditor(std::string filename);
#endif