summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc5
-rw-r--r--cmdline/apt-get.cc33
-rw-r--r--cmdline/apt-helper.cc16
-rw-r--r--cmdline/apt-internal-solver.cc24
-rw-r--r--cmdline/makefile20
5 files changed, 60 insertions, 38 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 1414617eb..ac0d48a36 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -1278,8 +1278,8 @@ static bool Search(CommandLine &CmdL)
ExDescFile *DFList = new ExDescFile[descCount];
memset(DFList,0,sizeof(*DFList) * descCount);
- bool PatternMatch[descCount * NumPatterns];
- memset(PatternMatch,false,sizeof(PatternMatch));
+ bool *PatternMatch = new bool[descCount * NumPatterns];
+ memset(PatternMatch,false,sizeof(*PatternMatch) * descCount * NumPatterns);
// Map versions that we want to write out onto the VerList array.
for (pkgCache::GrpIterator G = Cache->GrpBegin(); G.end() == false; ++G)
@@ -1389,6 +1389,7 @@ static bool Search(CommandLine &CmdL)
}
delete [] DFList;
+ delete [] PatternMatch;
for (unsigned I = 0; I != NumPatterns; I++)
regfree(&Patterns[I]);
if (ferror(stdout))
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 05785ec54..0be33dc30 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -953,18 +953,19 @@ static bool DoSource(CommandLine &CmdL)
else
{
// Call dpkg-source
- char S[500];
- snprintf(S,sizeof(S),"%s -x %s",
+ std::string const sourceopts = _config->Find("DPkg::Source-Options", "-x");
+ std::string S;
+ strprintf(S, "%s %s %s",
_config->Find("Dir::Bin::dpkg-source","dpkg-source").c_str(),
- Dsc[I].Dsc.c_str());
- if (system(S) != 0)
+ sourceopts.c_str(), Dsc[I].Dsc.c_str());
+ if (system(S.c_str()) != 0)
{
- fprintf(stderr,_("Unpack command '%s' failed.\n"),S);
- fprintf(stderr,_("Check if the 'dpkg-dev' package is installed.\n"));
+ fprintf(stderr, _("Unpack command '%s' failed.\n"), S.c_str());
+ fprintf(stderr, _("Check if the 'dpkg-dev' package is installed.\n"));
_exit(1);
- }
+ }
}
-
+
// Try to compile it with dpkg-buildpackage
if (_config->FindB("APT::Get::Compile",false) == true)
{
@@ -980,20 +981,20 @@ static bool DoSource(CommandLine &CmdL)
buildopts.append(_config->Find("DPkg::Build-Options","-b -uc"));
// Call dpkg-buildpackage
- char S[500];
- snprintf(S,sizeof(S),"cd %s && %s %s",
+ std::string S;
+ strprintf(S, "cd %s && %s %s",
Dir.c_str(),
_config->Find("Dir::Bin::dpkg-buildpackage","dpkg-buildpackage").c_str(),
buildopts.c_str());
-
- if (system(S) != 0)
+
+ if (system(S.c_str()) != 0)
{
- fprintf(stderr,_("Build command '%s' failed.\n"),S);
+ fprintf(stderr, _("Build command '%s' failed.\n"), S.c_str());
_exit(1);
- }
- }
+ }
+ }
}
-
+
_exit(0);
}
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
index b0edafcbd..dd43ea1bc 100644
--- a/cmdline/apt-helper.cc
+++ b/cmdline/apt-helper.cc
@@ -16,6 +16,7 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/proxy.h>
#include <apt-private/acqprogress.h>
#include <apt-private/private-output.h>
@@ -29,6 +30,19 @@
#include <apti18n.h>
/*}}}*/
+static bool DoAutoDetectProxy(CommandLine &CmdL)
+{
+ if (CmdL.FileSize() != 2)
+ return _error->Error(_("Need one URL as argument"));
+ URI ServerURL(CmdL.FileList[1]);
+ AutoDetectProxy(ServerURL);
+ std::string SpecificProxy = _config->Find("Acquire::"+ServerURL.Access+"::Proxy::" + ServerURL.Host);
+ ioprintf(std::cout, "Using proxy '%s' for URL '%s'\n",
+ SpecificProxy.c_str(), std::string(ServerURL).c_str());
+
+ return true;
+}
+
static bool DoDownloadFile(CommandLine &CmdL)
{
if (CmdL.FileSize() <= 2)
@@ -70,6 +84,7 @@ static bool ShowHelp(CommandLine &)
"\n"
"Commands:\n"
" download-file - download the given uri to the target-path\n"
+ " auto-detect-proxy - detect proxy using apt.conf\n"
"\n"
" This APT helper has Super Meep Powers.\n");
return true;
@@ -80,6 +95,7 @@ int main(int argc,const char *argv[]) /*{{{*/
{
CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp},
{"download-file", &DoDownloadFile},
+ {"auto-detect-proxy", &DoAutoDetectProxy},
{0,0}};
std::vector<CommandLine::Args> Args = getCommandArgs(
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index e4cdf6381..5fda7b6a0 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -24,9 +24,11 @@
#include <apt-pkg/depcache.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/cacheiterators.h>
+#include <apt-private/private-output.h>
#include <string.h>
#include <iostream>
+#include <sstream>
#include <list>
#include <string>
#include <unistd.h>
@@ -168,18 +170,20 @@ int main(int argc,const char *argv[]) /*{{{*/
EDSP::WriteProgress(60, "Call problemresolver on current scenario…", output);
+ std::string failure;
if (upgrade == true) {
- if (pkgAllUpgrade(CacheFile) == false) {
- EDSP::WriteError("ERR_UNSOLVABLE_UPGRADE", "An upgrade error occurred", output);
- return 0;
- }
+ if (pkgAllUpgrade(CacheFile) == false)
+ failure = "ERR_UNSOLVABLE_UPGRADE";
} else if (distUpgrade == true) {
- if (pkgDistUpgrade(CacheFile) == false) {
- EDSP::WriteError("ERR_UNSOLVABLE_DIST_UPGRADE", "An dist-upgrade error occurred", output);
- return 0;
- }
- } else if (Fix.Resolve() == false) {
- EDSP::WriteError("ERR_UNSOLVABLE", "An error occurred", output);
+ if (pkgDistUpgrade(CacheFile) == false)
+ failure = "ERR_UNSOLVABLE_DIST_UPGRADE";
+ } else if (Fix.Resolve() == false)
+ failure = "ERR_UNSOLVABLE";
+
+ if (failure.empty() == false) {
+ std::ostringstream broken;
+ ShowBroken(broken, CacheFile, false);
+ EDSP::WriteError(failure.c_str(), broken.str(), output);
return 0;
}
diff --git a/cmdline/makefile b/cmdline/makefile
index c4a249cd6..b7c35ddd1 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -8,49 +8,49 @@ include ../buildlib/defaults.mak
# The apt program
PROGRAM=apt
SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
SOURCE = apt.cc
include $(PROGRAM_H)
# The apt-cache program
PROGRAM=apt-cache
SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
SOURCE = apt-cache.cc
include $(PROGRAM_H)
# The apt-get program
PROGRAM=apt-get
SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
SOURCE = apt-get.cc
include $(PROGRAM_H)
# The apt-config program
PROGRAM=apt-config
SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
SOURCE = apt-config.cc
include $(PROGRAM_H)
# The apt-cdrom program
PROGRAM=apt-cdrom
SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
SOURCE = apt-cdrom.cc
include $(PROGRAM_H)
# The apt-mark program
PROGRAM=apt-mark
SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
SOURCE = apt-mark.cc
include $(PROGRAM_H)
# The apt-helper
PROGRAM=apt-helper
SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
SOURCE = apt-helper.cc
include $(PROGRAM_H)
@@ -75,14 +75,14 @@ include $(PROGRAM_H)
# The apt-extracttemplates program
PROGRAM=apt-extracttemplates
SLIBS = -lapt-pkg -lapt-inst $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile
SOURCE = apt-extracttemplates.cc
include $(PROGRAM_H)
# The internal solver acting as an external
PROGRAM=apt-internal-solver
-SLIBS = -lapt-pkg $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
SOURCE = apt-internal-solver.cc
include $(PROGRAM_H)