summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/acqprogress.cc20
-rw-r--r--cmdline/apt-cache.cc10
-rw-r--r--cmdline/apt-cdrom.cc8
-rw-r--r--cmdline/apt-config.cc7
-rw-r--r--cmdline/apt-extracttemplates.cc5
-rw-r--r--cmdline/apt-get.cc29
-rwxr-xr-xcmdline/apt-key2
-rw-r--r--cmdline/apt-mark.cc7
-rw-r--r--cmdline/apt-sortpkgs.cc7
9 files changed, 52 insertions, 43 deletions
diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc
index d2db949ea..1ccb08804 100644
--- a/cmdline/acqprogress.cc
+++ b/cmdline/acqprogress.cc
@@ -8,19 +8,21 @@
##################################################################### */
/*}}}*/
// Include files /*{{{*/
-#include "acqprogress.h"
+#include<config.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 <apti18n.h>
-
#include <stdio.h>
#include <signal.h>
#include <iostream>
#include <unistd.h>
+
+#include "acqprogress.h"
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -161,7 +163,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
ScreenWidth = sizeof(Buffer)-1;
// Put in the percent done
- sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
+ sprintf(S,"%.0f%%",((CurrentBytes + CurrentItems)*100.0)/(TotalBytes+TotalItems));
bool Shown = false;
for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
@@ -212,11 +214,11 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
{
if (Mode == Short)
- snprintf(S,End-S," %lu%%",
- long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+ snprintf(S,End-S," %.0f%%",
+ (I->CurrentSize*100.0)/I->TotalSize);
else
- snprintf(S,End-S,"/%sB %lu%%",SizeToStr(I->TotalSize).c_str(),
- long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+ snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(),
+ (I->CurrentSize*100.0)/I->TotalSize);
}
S += strlen(S);
snprintf(S,End-S,"]");
@@ -236,7 +238,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
if (CurrentCPS != 0)
{
char Tmp[300];
- unsigned long ETA = (unsigned long)((TotalBytes - CurrentBytes)/CurrentCPS);
+ 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);
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index db5475227..a4cdf784e 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -13,8 +13,9 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/error.h>
-#include <cassert>
#include <apt-pkg/pkgcachegen.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
@@ -31,17 +32,16 @@
#include <apt-pkg/algorithms.h>
#include <apt-pkg/sptr.h>
-#include <config.h>
-#include <apti18n.h>
-
+#include <cassert>
#include <locale.h>
#include <iostream>
#include <unistd.h>
#include <errno.h>
#include <regex.h>
#include <stdio.h>
-
#include <iomanip>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index d1268edf9..8608b1215 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -11,6 +11,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
@@ -21,10 +23,6 @@
#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/cdrom.h>
-#include <config.h>
-#include <apti18n.h>
-
-//#include "indexcopy.h"
#include <locale.h>
#include <iostream>
@@ -36,6 +34,8 @@
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc
index 589ee7ada..df2958975 100644
--- a/cmdline/apt-config.cc
+++ b/cmdline/apt-config.cc
@@ -16,6 +16,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
@@ -23,13 +25,12 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/aptconfiguration.h>
-#include <config.h>
-#include <apti18n.h>
-
#include <locale.h>
#include <iostream>
#include <string>
#include <vector>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index 07bc0c25d..5d7b76c23 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -13,6 +13,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/init.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/pkgcache.h>
@@ -28,7 +30,7 @@
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
-
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -36,7 +38,6 @@
#include <fstream>
#include <locale.h>
-#include <config.h>
#include <apti18n.h>
#include "apt-extracttemplates.h"
/*}}}*/
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 4a05648fa..d8f207f0a 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -25,8 +25,7 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
+#include <config.h>
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/error.h>
@@ -46,9 +45,6 @@
#include <apt-pkg/md5.h>
#include <apt-pkg/versionmatch.h>
-#include <config.h>
-#include <apti18n.h>
-
#include "acqprogress.h"
#include <set>
@@ -68,8 +64,7 @@
#include <sys/wait.h>
#include <sstream>
-#define statfs statfs64
-#define statvfs statvfs64
+#include <apti18n.h>
/*}}}*/
#define RAMFS_MAGIC 0x858458f6
@@ -1630,7 +1625,8 @@ bool DoUpdate(CommandLine &CmdL)
if (_config->FindB("APT::Get::Download",true) == true)
ListUpdate(Stat, *List);
- // Rebuild the cache.
+ // Rebuild the cache.
+ pkgCacheFile::RemoveCaches();
if (Cache.BuildCaches() == false)
return false;
@@ -2210,10 +2206,14 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
/* */
bool DoClean(CommandLine &CmdL)
{
+ std::string const archivedir = _config->FindDir("Dir::Cache::archives");
+ std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+ std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
if (_config->FindB("APT::Get::Simulate") == true)
{
- cout << "Del " << _config->FindDir("Dir::Cache::archives") << "* " <<
- _config->FindDir("Dir::Cache::archives") << "partial/*" << endl;
+ cout << "Del " << archivedir << "* " << archivedir << "partial/*"<< endl
+ << "Del " << pkgcache << " " << srcpkgcache << endl;
return true;
}
@@ -2221,14 +2221,17 @@ bool DoClean(CommandLine &CmdL)
FileFd Lock;
if (_config->FindB("Debug::NoLocking",false) == false)
{
- Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ Lock.Fd(GetLock(archivedir + "lock"));
if (_error->PendingError() == true)
return _error->Error(_("Unable to lock the download directory"));
}
pkgAcquire Fetcher;
- Fetcher.Clean(_config->FindDir("Dir::Cache::archives"));
- Fetcher.Clean(_config->FindDir("Dir::Cache::archives") + "partial/");
+ Fetcher.Clean(archivedir);
+ Fetcher.Clean(archivedir + "partial/");
+
+ pkgCacheFile::RemoveCaches();
+
return true;
}
/*}}}*/
diff --git a/cmdline/apt-key b/cmdline/apt-key
index e632be706..97d6e0323 100755
--- a/cmdline/apt-key
+++ b/cmdline/apt-key
@@ -152,7 +152,7 @@ if [ "$1" = "--keyring" ]; then
#echo "keyfile given"
shift
TRUSTEDFILE="$1"
- if [ -r "$TRUSTEDFILE" ]; then
+ if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ]; then
GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
else
echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index b2c664979..8c9a47913 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -5,6 +5,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
@@ -12,10 +14,9 @@
#include <apt-pkg/init.h>
#include <apt-pkg/strutl.h>
-#include <config.h>
-#include <apti18n.h>
-
#include <algorithm>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc
index f95a434cc..44b74cf6c 100644
--- a/cmdline/apt-sortpkgs.cc
+++ b/cmdline/apt-sortpkgs.cc
@@ -12,6 +12,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/tagfile.h>
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
@@ -19,14 +21,13 @@
#include <apt-pkg/init.h>
#include <apt-pkg/strutl.h>
-#include <config.h>
-#include <apti18n.h>
-
#include <vector>
#include <algorithm>
#include <locale.h>
#include <unistd.h>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;