]> git.saurik.com Git - apt.git/commitdiff
add a tiny dump solver to quickly output a scenario
authorDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 3 May 2011 15:27:11 +0000 (17:27 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 3 May 2011 15:27:11 +0000 (17:27 +0200)
cmdline/apt-dump-solver.cc [new file with mode: 0644]
cmdline/makefile
debian/apt-utils.install
debian/apt.dirs
debian/rules

diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc
new file mode 100644 (file)
index 0000000..5bcfe4f
--- /dev/null
@@ -0,0 +1,50 @@
+// -*- mode: cpp; mode: fold -*-
+// Description                                                         /*{{{*/
+/* #####################################################################
+
+   dummy solver to get quickly a scenario file out of APT
+
+   ##################################################################### */
+                                                                       /*}}}*/
+// Include Files                                                       /*{{{*/
+#include <apt-pkg/edsp.h>
+
+#include <config.h>
+
+#include <cstdio>
+                                                                       /*}}}*/
+
+// ShowHelp - Show a help screen                                       /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool ShowHelp() {
+
+       std::cout <<
+               PACKAGE " " VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl <<
+               "Usage: apt-dump-resolver\n"
+               "\n"
+               "apt-dump-resolver is a dummy solver who just dumps its input to the\n"
+               "file /tmp/dump.edsp and exists with a proper EDSP error.\n"
+               "\n"
+               "                       This dump has lost Super Cow Powers.\n";
+       return true;
+}
+                                                                       /*}}}*/
+int main(int argc,const char *argv[])                                  /*{{{*/
+{
+       if (argc > 1 && (strcmp(argv[1], "--help") == 0 || strcmp(argv[1],"-h") == 0 ||
+           strcmp(argv[1],"-v") == 0 || strcmp(argv[1],"--version") == 0)) {
+               ShowHelp();
+               return 0;
+       }
+
+       FILE* input = fdopen(STDIN_FILENO, "r");
+       FILE* output = fopen("/tmp/dump.edsp", "w");
+       char buffer[400];
+       while (fgets(buffer, sizeof(buffer), input) != NULL)
+               fputs(buffer, output);
+       fclose(output);
+       fclose(input);
+
+       EDSP::WriteError("I am too dumb, i can just dump!", stdout);
+}
index 4462ccaf4e72b23753bc167e7e3edf4ed0471bb7..aea5d1db55257028aaa1b20af44caadbf32b2f3a 100644 (file)
@@ -71,3 +71,10 @@ SLIBS = -lapt-pkg $(INTLLIBS)
 LIB_MAKES = apt-pkg/makefile
 SOURCE = apt-internal-solver.cc
 include $(PROGRAM_H)
+
+# The internal solver acting as an external
+PROGRAM=apt-dump-solver
+SLIBS = -lapt-pkg $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile
+SOURCE = apt-dump-solver.cc
+include $(PROGRAM_H)
index d947f26d4b0bfdafc5173eba66461432d863fdfa..0c72bfdc80726d1e54638a8e23d1d2f5e8153593 100644 (file)
@@ -1 +1,2 @@
 bin/libapt-inst*.so.* usr/lib/
+bin/apt-dump-solver usr/lib/apt/solvers/dump
index 2770d79bb630f6c7d50ec7fd1604937465ca4dc2..f9c0b6c3e54b7487d0a09cff219d691424c2558b 100644 (file)
@@ -1,5 +1,6 @@
 usr/bin
 usr/lib/apt/methods
+usr/lib/apt/solvers
 usr/lib/dpkg/methods/apt
 etc/apt
 etc/apt/apt.conf.d
index c8aefee639a720f1ce3367ac21d6319d13200627..77a7b4fdb8c89e0d7335d0514360a1cb076cc0ce 100755 (executable)
@@ -182,7 +182,7 @@ apt: build build-doc
        dh_install -p$@ --sourcedir=$(BLD)
 
        # Remove the bits that are in apt-utils
-       rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS))
+       rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver)
 
        # https has its own package
        rm debian/$@/usr/lib/apt/methods/https