[Piuparts-commits] [piuparts] 01/09: add several debug commands to the master-slave protocol

Holger Levsen holger at moszumanska.debian.org
Mon Feb 10 13:03:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit ef65f88c0f3d8e7d3856dbb17a204528eda6f17a
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Feb 9 22:10:24 2014 +0100

    add several debug commands to the master-slave protocol
    
    for manual use only, undocumented and unstable interface :-)
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 piuparts-master-backend.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/piuparts-master-backend.py b/piuparts-master-backend.py
index cb7b677..0613c06 100644
--- a/piuparts-master-backend.py
+++ b/piuparts-master-backend.py
@@ -139,6 +139,13 @@ class Master(Protocol):
             "pass": self._pass,
             "fail": self._fail,
             "untestable": self._untestable,
+
+            # debug commands, unstable and undocumented interface
+            "_state": self._state,
+            "_depends": self._depends,
+            "_recursive-depends": self._recursive_depends,
+            "_depcycle": self._depcycle,
+            "_list": self._list,
         }
         self._section = None
         self._lock = None
@@ -357,6 +364,46 @@ class Master(Protocol):
                          % ("untestable", args[0], args[1]))
         self._short_response("ok")
 
+    # debug command
+    def _state(self, command, args):
+        self._check_args(1, command, args)
+        self._short_response("ok", self._binary_db.get_package_state(args[0]),
+                             self._binary_db.get_package(args[0])["Version"])
+
+    # debug command
+    def _depends(self, command, args):
+        self._check_args(1, command, args)
+        if self._binary_db.has_package(args[0]):
+            package = self._binary_db.get_package(args[0])
+            self._short_response("ok", *package.dependencies())
+        else:
+            self._short_response("error")
+
+    # debug command
+    def _recursive_depends(self, command, args):
+        self._check_args(1, command, args)
+        if self._binary_db.has_package(args[0]):
+            package = self._binary_db.get_package(args[0])
+            self._short_response("ok", *self._binary_db._get_recursive_dependencies(package))
+        else:
+            self._short_response("error")
+
+    # debug command
+    def _depcycle(self, command, args):
+        self._check_args(1, command, args)
+        if self._binary_db.has_package(args[0]):
+            self._short_response("ok", *self._binary_db._get_dependency_cycle(args[0]))
+        else:
+            self._short_response("error")
+
+    # debug command
+    def _list(self, command, args):
+        self._check_args(1, command, args)
+        if args[0] in self._binary_db.get_states():
+            self._short_response("ok", *self._binary_db.get_pkg_names_in_state(args[0]))
+        else:
+            self._short_response("error")
+
 
 def main():
     setup_logging(logging.INFO, None)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list