$ gbp import-orig --uscan gbp:info: Launching uscan... gbp:info: Using uscan downloaded tarball ../mirakuru_2.3.0.orig.tar.gz What is the upstream version? [2.3.0] gbp:info: Importing '../mirakuru_2.3.0.orig.tar.gz' to branch 'debian/upstream'... gbp:info: Source package is mirakuru gbp:info: Upstream version is 2.3.0 gbp:info: Replacing upstream source on 'debian/unstable-swh' gbp:info: Successfully imported version 2.3.0 of ../mirakuru_2.3.0.orig.tar.gz $ gbp buildpackage --git-builder='sbuild -As' gbp:info: Tarballs 'mirakuru_2.1.0.orig.tar.gz' not found at '/home/tony/debian/tarballs/' gbp:info: Exporting 'HEAD' to '/home/tony/debian/build-area/mirakuru-tmp' gbp:info: Moving '/home/tony/debian/build-area/mirakuru-tmp' to '/home/tony/debian/build-area/mirakuru-2.1.0' gbp:info: Performing the build dh clean --with python3 --buildsystem=pybuild dh_auto_clean -O--buildsystem=pybuild I: pybuild base:217: python3.7 setup.py clean running clean removing '/home/tony/debian/build-area/mirakuru-2.1.0/.pybuild/cpython3_3.7_mirakuru/build' (and everything under it) 'build/bdist.linux-amd64' does not exist -- can't clean it 'build/scripts-3.7' does not exist -- can't clean it dh_autoreconf_clean -O--buildsystem=pybuild dh_clean -O--buildsystem=pybuild dpkg-source: info: using source format '3.0 (quilt)' dpkg-source: info: building mirakuru using existing ./mirakuru_2.1.0.orig.tar.gz dpkg-source: info: using patch list from debian/patches/series dpkg-source: error: cannot represent change to logo.png: binary file contents changed dpkg-source: error: add logo.png in debian/source/include-binaries if you want to store the modified binary in the debian tarball dpkg-source: warning: file mirakuru-2.1.0/requirements-lint.txt has no final newline (either original or modified version) dpkg-source: error: unrepresentable changes to source E: Failed to package source directory /home/tony/debian/build-area/mirakuru-2.1.0 gbp:error: 'sbuild -As' failed: it exited with 1 $ em debian/source/include-binaries + /nix/store/5j7hnf6yh6c48dqdfk09yarikm4hgygb-emacs-27.1/bin/emacsclient --create-frame -nw debian/source/include-binaries $ gbp buildpackage --git-builder='sbuild -As' gbp:info: Tarballs 'mirakuru_2.1.0.orig.tar.gz' not found at '/home/tony/debian/tarballs/' gbp:info: Exporting 'HEAD' to '/home/tony/debian/build-area/mirakuru-tmp' gbp:info: Moving '/home/tony/debian/build-area/mirakuru-tmp' to '/home/tony/debian/build-area/mirakuru-2.1.0' gbp:info: Performing the build dh clean --with python3 --buildsystem=pybuild dh_auto_clean -O--buildsystem=pybuild I: pybuild base:217: python3.7 setup.py clean running clean removing '/home/tony/debian/build-area/mirakuru-2.1.0/.pybuild/cpython3_3.7_mirakuru/build' (and everything under it) 'build/bdist.linux-amd64' does not exist -- can't clean it 'build/scripts-3.7' does not exist -- can't clean it dh_autoreconf_clean -O--buildsystem=pybuild dh_clean -O--buildsystem=pybuild dpkg-source: info: using source format '3.0 (quilt)' dpkg-source: info: building mirakuru using existing ./mirakuru_2.1.0.orig.tar.gz dpkg-source: info: using patch list from debian/patches/series dpkg-source: warning: file mirakuru-2.1.0/requirements-lint.txt has no final newline (either original or modified version) dpkg-source: info: local changes detected, the modified files are: mirakuru-2.1.0/.bumpversion.cfg mirakuru-2.1.0/.travis.yml mirakuru-2.1.0/AUTHORS.rst mirakuru-2.1.0/CHANGES.rst mirakuru-2.1.0/README.rst mirakuru-2.1.0/logo.svg mirakuru-2.1.0/mypy.ini mirakuru-2.1.0/requirements-lint.txt mirakuru-2.1.0/requirements-test.txt mirakuru-2.1.0/setup.py mirakuru-2.1.0/src/mirakuru/__init__.py mirakuru-2.1.0/src/mirakuru/base.py mirakuru-2.1.0/src/mirakuru/base_env.py mirakuru-2.1.0/src/mirakuru/exceptions.py mirakuru-2.1.0/src/mirakuru/http.py mirakuru-2.1.0/src/mirakuru/output.py mirakuru-2.1.0/tests/executors/test_executor.py mirakuru-2.1.0/tests/executors/test_executor_kill.py mirakuru-2.1.0/tests/executors/test_tcp_executor.py dpkg-source: info: you can integrate the local changes with dpkg-source --commit dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/mirakuru_2.1.0-2~~swh1.diff.ei5huP E: Failed to package source directory /home/tony/debian/build-area/mirakuru-2.1.0 gbp:error: 'sbuild -As' failed: it exited with 1 $ cat /tmp/mirakuru_2.1.0-2~~swh1.diff.ei5huP Description: <short summary of the patch> TODO: Put a short summary on the line above and replace this paragraph with a longer explanation of this change. Complete the meta-information with other relevant fields (see below for details). To make it easier, the information below has been extracted from the changelog. Adjust it or drop it. . mirakuru (2.1.0-2~~swh1) unstable-swh; urgency=medium . * Remove .coverage from installed directory Author: Nicolas Dandrimont <olasd@debian.org> --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: <vendor|upstream|other>, <url of original patch> Bug: <url in upstream bugtracker> Bug-Debian: https://bugs.debian.org/<bugnumber> Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber> Forwarded: <no|not-needed|url proving that it has been forwarded> Reviewed-By: <name and email of someone who approved the patch> Last-Update: 2021-03-17 --- mirakuru-2.1.0.orig/.bumpversion.cfg +++ mirakuru-2.1.0/.bumpversion.cfg @@ -2,7 +2,7 @@ commit = True tag = True message = "Release {new_version}" -current_version = 2.1.0 +current_version = 2.3.0 [bumpversion:file:setup.py] search = version='{current_version}' --- mirakuru-2.1.0.orig/.travis.yml +++ mirakuru-2.1.0/.travis.yml @@ -2,9 +2,10 @@ dist: xenial language: python conditions: v1 python: -- 3.6 +- 3.8 - 3.7 -- 3.8-dev +- 3.6 +- nightly - pypy3 # blocklist branches branches: @@ -23,7 +24,6 @@ after_success: jobs: include: - stage: linters - python: 3.7 install: - pip install -r requirements-lint.txt script: @@ -43,7 +43,6 @@ jobs: script: - pytest - stage: deploy - python: 3.7 if: tag IS present script: skip deploy: --- mirakuru-2.1.0.orig/AUTHORS.rst +++ mirakuru-2.1.0/AUTHORS.rst @@ -12,5 +12,6 @@ mirakuru along its history. * Daniel O'Connell * Michał Pawłowski * Grégoire Détrez +* Lars Gohr Great thanks to `Mateusz Lenik <http://mlen.pl>`_ for original package! --- mirakuru-2.1.0.orig/CHANGES.rst +++ mirakuru-2.1.0/CHANGES.rst @@ -1,6 +1,31 @@ CHANGELOG ========= +2.3.0 +---------- + +- [enhancement] Ability to set up expected exit code for executor. In Java exit codes 1- 127 have + special meaning, and the regular exit codes are offset by those of special meaning. + +2.2.0 +---------- + +- [enhancement] If process is being closed and the shutdown won't be clean (won't return exit code 0) + mirakuru will now rise ProcessFinishedWithError exception with exit_code + +2.1.2 +---------- + +- [bugfix][macos] Fixed typing issue on macOS + +2.1.1 +---------- + +- [bug] Always close connection for HTTPExecutor after_start_check +- [enhancement] Log debug message if execption occured during + HTTPExecutor start check +- [ehnancement] adjust typing handling in HTTPExecutor + 2.1.0 ---------- --- mirakuru-2.1.0.orig/README.rst +++ mirakuru-2.1.0/README.rst @@ -1,3 +1,6 @@ +.. image:: https://raw.githubusercontent.com/ClearcodeHQ/mirakuru/master/logo.png + :height: 100px + mirakuru ======== @@ -12,8 +15,8 @@ This is where you should consider using :target: https://pypi.python.org/pypi/mirakuru/ :alt: Latest PyPI version -.. image:: https://readthedocs.org/projects/mirakuru/badge/?version=v2.1.0 - :target: http://mirakuru.readthedocs.io/en/v2.1.0/ +.. image:: https://readthedocs.org/projects/mirakuru/badge/?version=v2.3.0 + :target: http://mirakuru.readthedocs.io/en/v2.3.0/ :alt: Documentation Status .. image:: https://img.shields.io/pypi/wheel/mirakuru.svg @@ -31,18 +34,14 @@ This is where you should consider using Package status -------------- -.. image:: https://travis-ci.org/ClearcodeHQ/mirakuru.svg?branch=v2.1.0 +.. image:: https://travis-ci.org/ClearcodeHQ/mirakuru.svg?branch=v2.3.0 :target: https://travis-ci.org/ClearcodeHQ/mirakuru :alt: Tests -.. image:: https://coveralls.io/repos/ClearcodeHQ/mirakuru/badge.png?branch=v2.1.0 - :target: https://coveralls.io/r/ClearcodeHQ/mirakuru?branch=v2.1.0 +.. image:: https://coveralls.io/repos/ClearcodeHQ/mirakuru/badge.png?branch=v2.3.0 + :target: https://coveralls.io/r/ClearcodeHQ/mirakuru?branch=v2.3.0 :alt: Coverage Status -.. image:: https://requires.io/github/ClearcodeHQ/mirakuru/requirements.svg?tag=v2.1.0 - :target: https://requires.io/github/ClearcodeHQ/mirakuru/requirements/?tag=v2.1.0 - :alt: Requirements Status - About ----- --- /dev/null +++ mirakuru-2.1.0/logo.svg @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + id="svg8" + version="1.1" + viewBox="0 0 7.9375 26.458334" + height="100" + width="30"> + <defs + id="defs2" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + transform="translate(0,-270.54165)" + id="layer1"> + <path + id="path1092" + d="m 1.3735486,276.03259 h 5.1978876 v 18.33323 l -0.3346984,1.23505 -0.9839768,0.95613 -1.5127584,0.31849 -1.0761159,-0.32918 -0.9138996,-0.86195 -0.3855639,-1.32158 z" + style="fill:#ffffff;stroke:none;stroke-width:0.24841331px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + id="path940" + d="m 2.9415857e-5,272.82959 v 2.28822 A 3.9687465,2.2882217 0 0 0 3.9687647,277.40602 3.9687465,2.2882217 0 0 0 7.9375,275.11781 v -2.28822 H 3.9687647 Z" + style="opacity:1;fill:#bf146f;fill-opacity:1;stroke:none;stroke-width:0.08613154;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:18.72999954;stroke-opacity:1" /> + <ellipse + style="opacity:1;fill:#a71161;fill-opacity:1;stroke:none;stroke-width:0.08613154;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:18.72999954;stroke-opacity:1" + id="ellipse948" + cx="3.9687464" + cy="272.82962" + rx="3.9687464" + ry="2.2882216" /> + <path + id="path1002" + d="m 6.4481842,277.032 c -1.3313773,0.63961 -2.9225023,0.67603 -4.3280453,0.25771 -0.2482178,-0.0797 -0.4901326,-0.17872 -0.7207676,-0.2988 0,5.88528 0,11.77059 0,17.65589 0.3381409,0.77049 1.2371692,1.11085 2.0333418,1.21541 0.9847044,0.10262 2.0977166,-0.0679 2.8273813,-0.77271 0.2571822,-0.23894 0.3448378,-0.5659 0.2970851,-0.90198 0.00192,-5.7358 0.032283,-11.47171 -0.00192,-17.20746 -0.03555,0.0173 -0.071004,0.0347 -0.1065932,0.0519 z" + style="opacity:1;fill:#1b5e20;fill-opacity:1;stroke:none;stroke-width:0.08554611;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:18.72999954;stroke-opacity:1" /> + <path + id="path1012" + d="m 1.5973597,295.23191 c 0.1579586,0.33617 0.4329256,0.61024 0.7357468,0.83825 0.6171625,0.42274 1.4258642,0.5909 2.1762347,0.44629 0.781962,-0.13139 1.4962249,-0.61348 1.8391122,-1.28654 -0.6167301,0.5196 -1.459368,0.74244 -2.27689,0.75794 -0.7805209,0.0111 -1.5957177,-0.14132 -2.2385438,-0.57328 -0.087338,-0.0615 -0.1692865,-0.12962 -0.2456139,-0.20276 l 0.00673,0.0138 z" + style="opacity:1;fill:#41a445;fill-opacity:1;stroke:none;stroke-width:0.02955596;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:18.72999954;stroke-opacity:1" /> + <path + id="path1030" + d="m 1.2939111,279.01112 c 0.9206913,0.56628 1.9219326,0.74568 2.957094,0.76215 v 0.88051 c -0.9857413,-0.0404 -1.9906727,-0.15271 -2.957094,-0.75025 z" + style="fill:#ffffff;stroke:none;stroke-width:0.04598588px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + style="fill:#ffffff;stroke:none;stroke-width:0.04598588px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 1.2939111,280.71823 c 0.9206913,0.56628 1.9219326,0.74568 2.957094,0.76215 v 0.88052 c -0.9857413,-0.0404 -1.9906727,-0.15272 -2.957094,-0.75025 z" + id="path1032" /> + <path + id="path1034" + d="m 1.2939111,282.42534 c 0.9206913,0.56627 1.9219326,0.74568 2.957094,0.76213 v 0.88052 c -0.9857413,-0.0404 -1.9906727,-0.1527 -2.957094,-0.75024 z" + style="fill:#ffffff;stroke:none;stroke-width:0.04598588px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <rect + transform="matrix(0.97014975,0.24250661,-0.80003661,0.59995119,0,0)" + y="339.0007" + x="281.65463" + height="1.1627717" + width="4.7116351" + id="rect1036" + style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.05610566;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:18.72999954;stroke-opacity:1" /> + <path + d="m 1.7495117,279.74505 c -0.0ho272,0.0132 -0.0709,0.0359 0.0514,-0.0279 0.002,-10e-4 -0.005,0.003 -0.007,0.005 -0.008,0.005 -0.005,0.003 -0.0114,0.008 9e-4,-0.003 -0.003,0.003 -0.002,0.003 0.0123,0.003 0.0308,0.003 0.0433,0.004 0.0498,0.004 0.0992,-3.4e-4 0.1486502,-0.006 0.04,-0.005 0.0802,-0.007 0.1203602,-0.0102 0.0376,-0.003 0.0495,-0.0222 -0.0688,0.0507 -0.003,0.002 -0.007,0.002 -0.0111,0.003 -0.0134,0.005 -0.0148,0.006 -0.0279,0.0127 -0.0491,0.0254 0.0276,-0.0151 0.0418,-0.0221 0.005,-0.003 -0.0112,0.007 -0.0166,0.01 -0.015,0.009 -0.0296,0.0193 -0.0444,0.029 -0.004,0.003 -0.0359,0.0247 -0.03,0.0308 0.0213,0.004 0.0432,0.003 0.0647,0.003 0.0319,10e-4 0.0639,-6.7e-4 0.0958,3.3e-4 0.0127,3.4e-4 0.0407,0.002 0.0533,0.003 0.0436,0.005 0.0879,0.003 0.1313501,0.009 0.0179,0.004 0.0283,0.009 0.0279,0.0271 -0.001,0.01 -0.003,0.0199 -0.003,0.03 7.2e-4,0.002 7.2e-4,0.004 0.003,0.005 0.005,0.003 0.0198,0.002 0.026,0.003 0.038,5.1e-4 0.0763,-0.003 0.1140302,-0.007 0.0574,-0.007 0.1152401,-0.0107 0.1731102,-0.0128 0.0431,-0.001 0.0862,-0.002 0.1293102,-0.002 0.0187,10e-4 0.036,10e-4 0.0352,0.0229 -0.005,0.0153 -0.0198,0.0259 -0.0315,0.0372 -0.0131,0.0118 -0.0255,0.0239 -0.0342,0.0388 -0.004,0.01 -0.0107,0.0182 0.002,0.0242 0.0319,0.007 0.0654,0.006 0.098,0.006 0.0447,-5.1e-4 0.0894,-0.001 0.1338801,-0.006 0.0277,-0.003 0.0553,-0.007 0.083,-0.01 0.0894,-0.0107 0.1784503,-0.0233 0.2676904,-0.0349 0.0342,-0.005 0.0685,-0.008 0.1027801,-0.0119 0.0169,-0.002 0.0336,-0.004 0.0507,-0.004 0.0134,10e-4 0.0183,0.009 0.0204,0.0201 0,0 -0.0791,0.0386 -0.0791,0.0386 v 0 c -3.6e-4,-0.009 -0.002,-0.01 -0.0124,-0.0102 -0.0496,10e-4 -0.099,0.009 -0.1482702,0.0137 -0.0893,0.0114 -0.1783902,0.0239 -0.2677203,0.0348 -0.008,0.001 -0.075,0.009 -0.0838,0.0101 -0.0452,0.005 -0.0908,0.006 -0.1361801,0.006 -0.0183,-1.3e-4 -0.0302,-9e-5 -0.0481,-6.7e-4 -0.0153,-5e-4 -0.032,-5e-4 -0.0471,-0.005 -0.003,-8.4e-4 -0.005,-0.002 -0.009,-0.003 -0.0144,-0.0106 -0.0134,-0.0195 -0.007,-0.0347 0.007,-0.0162 0.0194,-0.0294 0.0333,-0.0414 0.0111,-0.0107 0.023,-0.0209 0.0328,-0.0328 5.3e-4,-6.7e-4 0.003,-0.004 0.002,-0.005 -0.003,-0.006 -0.0226,-0.005 -0.0278,-0.006 -0.0424,-3.4e-4 -0.0848,-1.7e-4 -0.1272302,10e-4 -0.0579,0.002 -0.1156502,0.006 -0.1729902,0.0136 -0.0389,0.004 -0.0781,0.008 -0.1173302,0.007 -0.0148,-10e-4 -0.0314,-0.002 -0.0362,-0.0173 -10e-4,-0.0104 7.2e-4,-0.0208 0.002,-0.0312 0.002,-0.0149 -0.004,-0.0131 -0.0195,-0.0173 -0.0428,-0.006 -0.0863,-0.006 -0.1292801,-0.01 -0.0499,-0.003 -0.0999,-0.003 -0.1500202,-0.002 -0.0159,-5e-5 -0.0511,0.002 -0.0655,-0.005 -0.002,-10e-4 -0.004,-0.003 -0.006,-0.004 -10e-4,-0.002 -0.003,-0.004 -0.003,-0.006 -0.004,-0.0147 0.0203,-0.03 0.0298,-0.0371 0.0541,-0.0354 0.1084602,-0.0704 0.1682002,-0.0975 0.0149,-0.007 0.0146,-0.007 0.0296,-0.0121 0.004,-10e-4 0.015,-0.006 0.0119,-0.003 -0.0622,0.0539 -0.0373,0.0476 -0.0726,0.0483 -0.0394,0.002 -0.0787,0.005 -0.1178902,0.009 -0.0502,0.005 -0.1004301,0.008 -0.1509102,0.005 -0.0129,-6.7e-4 -0.0505,0.001 -0.0536,-0.0163 -3.6e-4,-0.002 5.4e-4,-0.004 9e-4,-0.006 0.005,-0.007 0.0108,-0.0111 0.0187,-0.0154 0.033,-0.0182 0.0658,-0.0386 0.1009601,-0.0537 0,0 -0.07,0.0516 -0.07,0.0516 z" + id="path1064" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.08613154;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:18.72999954;stroke-opacity:1" /> + <path + d="m 1.8854719,281.54918 c 0.0309,0.002 0.0614,-0.002 0.092,-0.005 0.0235,-10e-4 0.0472,-0.005 0.0709,-0.005 0.009,9e-5 0.0207,0.002 0.0294,0.003 0.0209,0.003 0.0367,0.0125 0.0514,0.0256 0.01,0.0112 0.0196,0.0223 0.0289,0.0339 0.01,0.0107 0.0172,0.0218 0.0221,0.0349 0.003,0.0113 0.0131,0.0161 0.0244,0.0197 0.0299,0.005 0.0608,0.007 0.0912,0.008 0.0665,0.003 0.1330101,0.003 0.1995202,0.004 0.014,9e-5 0.028,1.4e-4 0.042,1.7e-4 0.0369,1.3e-4 0.052,6.7e-4 0.089,-0.001 0.0466,-0.002 0.0931,-0.007 0.1395102,-0.0113 0.0654,-0.008 0.1306802,-0.0172 0.1961802,-0.025 0.006,-0.002 0.0135,-9.9e-4 0.0198,-0.003 7.2e-4,-1.7e-4 0.002,-0.002 10e-4,-0.002 -0.0247,0.017 -0.0488,0.0347 -0.0739,0.0513 -10e-4,8.4e-4 -0.003,3.4e-4 -0.004,6.8e-4 -0.002,5e-4 -0.004,10e-4 -0.006,0.002 -0.002,8.4e-4 -0.005,0.002 -0.008,0.003 -0.01,0.004 -0.0189,0.009 -0.0157,0.008 0.1199302,-0.0639 0.0789,-0.0458 0.0551,-0.027 -0.01,0.008 -0.0153,0.0183 -0.0165,0.0303 0.002,0.016 0.0208,0.0235 0.0344,0.0301 0.0361,0.0161 0.0751,0.0252 0.1141902,0.0327 0.0683,0.0105 0.1377502,0.0114 0.2068103,0.0125 0.057,8.4e-4 0.1150701,0.001 0.1704402,-0.0135 0.009,-0.002 0.0166,-0.005 0.0249,-0.008 0.007,-0.003 0.0148,-0.005 0.022,-0.008 0.006,-0.003 0.0246,-0.0124 0.0186,-0.009 -0.0195,0.0106 -0.039,0.0214 -0.0591,0.0312 -0.004,0.002 0.009,-0.005 0.0126,-0.008 0.009,-0.007 0.01,-0.008 0.0169,-0.0158 0,0 0.0811,-0.0322 0.0811,-0.0322 v 0 c -0.009,0.0102 -0.0176,0.0205 -0.0295,0.0273 -0.0429,0.0242 -0.0833,0.0491 -0.1301802,0.0644 -0.009,0.002 -0.0165,0.005 -0.0249,0.007 -0.0557,0.0129 -0.1134602,0.0122 -0.1704002,0.0112 -0.07,-10e-4 -0.1402602,-0.002 -0.2094603,-0.0125 -0.0402,-0.008 -0.0804,-0.0166 -0.1175302,-0.0333 -0.0172,-0.008 -0.0364,-0.0181 -0.0404,-0.0375 -5.4e-4,-0.0136 0.004,-0.0262 0.0139,-0.0365 0.0332,-0.0307 0.0768,-0.0516 0.1211602,-0.065 0.002,-5e-4 0.005,-9.9e-4 0.007,-0.002 0.002,-3.4e-4 0.006,-0.002 0.005,-8.4e-4 -0.0659,0.0516 -0.0432,0.0483 -0.0889,0.0518 -0.0643,0.006 -0.1282802,0.0148 -0.1924103,0.0222 -0.0466,0.004 -0.0933,0.009 -0.1399902,0.011 -0.0342,0.002 -0.0554,0.001 -0.0896,0.001 -0.0141,2e-5 -0.0283,3e-5 -0.0424,4e-5 -0.0673,-1.3e-4 -0.1347501,1e-5 -0.2020802,-0.002 -0.0316,-0.002 -0.0642,-0.002 -0.095,-0.009 -0.0132,-0.005 -0.0244,-0.0124 -0.0288,-0.0258 -0.004,-0.0124 -0.0117,-0.0226 -0.0204,-0.0326 -0.009,-0.0112 -0.0185,-0.0219 -0.0281,-0.0327 -0.0137,-0.0118 -0.0284,-0.02 -0.0475,-0.0218 -0.0328,-0.003 -0.0655,-9e-5 -0.0982,0.003 -0.0314,0.003 -0.0628,0.006 -0.0945,0.005 0,0 0.0721,-0.0489 0.0721,-0.0489 z" + id="path1066" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.08613154;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:18.72999954;stroke-opacity:1" /> + <path + d="m 1.6404816,283.1146 c 0.0424,0.0208 0.0926,0.022 0.1394102,0.0252 0.0571,0.003 0.1143401,0.004 0.1713902,-6.7e-4 0.0331,-0.003 0.0618,-0.007 0.0949,-0.0111 0.0751,-0.009 0.1493502,-0.0225 0.2235603,-0.0362 0.0123,-0.001 0.0581,-0.0149 0.0554,0.011 -3.6e-4,0.003 -0.002,0.006 -0.003,0.009 -0.0162,0.0229 -0.0332,0.045 -0.0479,0.0688 -0.011,0.0194 -0.0196,0.0404 -0.0216,0.0624 10e-5,0.0128 0.009,0.015 0.0205,0.0162 0.0221,0.002 0.0442,10e-4 0.0661,-0.002 0.005,-8.4e-4 0.0107,-0.002 0.0153,-0.003 0.0113,-0.002 0.0241,-0.006 0.0353,-0.009 0.021,-0.005 0.0423,-0.01 0.0635,-0.0145 0.0431,-0.007 0.0851,-0.0179 0.1278801,-0.0263 0.009,-8.4e-4 0.0395,-0.0101 0.0434,0.002 7.2e-4,0.002 1.4e-4,0.005 1.9e-4,0.007 -0.001,0.002 -0.002,0.004 -0.004,0.006 -0.001,0.002 -0.012,0.0118 -0.0131,0.0129 -0.007,0.007 -0.0144,0.0149 -0.0214,0.0225 -0.0111,0.0115 -0.0186,0.0251 -0.0208,0.0404 3.6e-4,0.002 3.6e-4,0.003 0.001,0.004 0.004,0.008 0.0316,0.0138 0.0396,0.0155 0.0346,0.005 0.0696,0.008 0.1045001,0.009 0.0493,0.002 0.0987,0.002 0.1480302,0.003 0.0371,0.002 0.0742,10e-4 0.1111602,0.005 0.0123,0.001 0.0383,0.005 0.0509,0.006 0.029,0.003 0.0608,0.007 0.0816,0.0279 0.0108,0.0158 0.009,0.0329 0.004,0.0503 -0.008,0.0231 -0.0192,0.045 -0.0296,0.0671 -0.006,0.0161 -0.0139,0.0333 -0.0118,0.0508 7.1e-4,0.002 0.001,0.003 0.002,0.004 0.0117,0.0123 0.0504,0.0157 0.0659,0.0177 0.0768,0.003 0.1530102,-0.0108 0.2285703,-0.0219 0.1162001,-0.0157 0.2300203,-0.0425 0.3439304,-0.0685 0.0706,-0.0181 0.1416202,-0.0359 0.2108003,-0.0587 0.0295,-0.01 0.0431,-0.0154 0.0711,-0.0263 0.067,-0.0335 -0.0208,0.0124 -0.0317,0.0178 -0.006,0.003 0.012,-0.007 0.0179,-0.0144 0,0 0.081,-0.0352 0.081,-0.0352 v 0 c -3.7e-4,0.002 -1.9e-4,0.004 -10e-4,0.006 -0.003,0.005 -0.0123,0.0123 -0.0169,0.0148 -0.0803,0.045 -0.064,0.0371 -0.1151402,0.0598 -0.0906,0.0336 -0.1845402,0.0583 -0.2787803,0.0813 -0.1145602,0.0262 -0.2291404,0.0526 -0.3458905,0.0691 -0.0773,0.0117 -0.1552502,0.0264 -0.2339003,0.0227 -0.0213,-0.003 -0.0582,-0.005 -0.0729,-0.0229 -0.002,-0.002 -0.002,-0.005 -0.003,-0.007 -0.003,-0.019 0.004,-0.0375 0.0107,-0.0553 0.01,-0.0219 0.0215,-0.0432 0.0298,-0.0658 0.004,-0.0143 0.009,-0.0291 -3.6e-4,-0.0427 -0.0191,-0.0191 -0.0498,-0.0208 -0.0759,-0.0248 -0.017,-0.002 -0.0329,-0.005 -0.0502,-0.006 -0.0369,-0.003 -0.074,-0.003 -0.1109302,-0.005 -0.0496,-10e-4 -0.0993,-3.3e-4 -0.1489202,-0.003 -0.0357,-0.002 -0.0715,-0.004 -0.1067501,-0.01 -0.015,-0.004 -0.0376,-0.008 -0.0457,-0.0224 -10e-4,-0.002 -0.002,-0.005 -0.002,-0.007 5.4e-4,-0.0168 0.008,-0.0326 0.019,-0.0455 0.0123,-0.0133 0.024,-0.0276 0.0387,-0.0387 10e-4,4e-5 0.005,5e-4 0.004,8.3e-4 -10e-4,1.7e-4 -0.002,-1.6e-4 -0.003,-1.6e-4 -0.0109,1.3e-4 -0.0218,0.002 -0.0325,0.004 -0.0424,0.008 -0.0843,0.0184 -0.1269301,0.026 -0.0387,0.009 -0.0768,0.0197 -0.1158502,0.0266 -0.0228,0.002 -0.046,0.003 -0.0688,1.7e-4 -0.0164,-0.004 -0.025,-0.0102 -0.0269,-0.0267 10e-4,-0.0232 0.0107,-0.0456 0.0211,-0.0663 0.0142,-0.0236 0.0299,-0.0461 0.0469,-0.068 0.002,-0.002 0.003,-0.004 0.004,-0.006 7.2e-4,-8.3e-4 0.002,-8.3e-4 0.002,-0.002 -4e-5,-0.006 -0.0446,0.002 -0.0463,0.002 -0.0734,0.0126 -0.1467502,0.0256 -0.2209103,0.0339 -0.0347,0.004 -0.0602,0.008 -0.0953,0.0107 -0.0579,0.005 -0.1158701,0.004 -0.1737802,9.9e-4 -0.0493,-0.003 -0.1016002,-0.005 -0.1462802,-0.0265 0,0 0.0751,-0.0443 0.0751,-0.0443 z" + id="path1072" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.08613154;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:18.72999954;stroke-opacity:1" /> + <flowRoot + transform="matrix(0.10032144,0.02507718,-0.10032144,0.07523153,-20.706478,235.47382)" + style="font-style:normal;font-weight:normal;font-size:6.66666698px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none" + id="flowRoot1078" + xml:space="preserve"><flowRegion + style="font-size:6.66666698px" + id="flowRegion1080"><rect + style="font-size:6.66666698px" + y="304.84113" + x="540.53571" + height="41.363964" + width="79.64286" + id="rect1082" /></flowRegion><flowPara + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'" + id="flowPara1084">MIRAKURU</flowPara></flowRoot> </g> +</svg> --- mirakuru-2.1.0.orig/mypy.ini +++ mirakuru-2.1.0/mypy.ini @@ -1,5 +1,6 @@ [mypy] check_untyped_defs = True +show_error_codes = True mypy_path = src [mypy-mirakuru.*] --- mirakuru-2.1.0.orig/requirements-lint.txt +++ mirakuru-2.1.0/requirements-lint.txt @@ -1,8 +1,8 @@ # linters pycodestyle==2.5.0 -pydocstyle==4.0.1 -pylint==2.3.1 +pydocstyle==5.0.2 +pylint==2.5.2 pygments restructuredtext-lint==1.3.0 -mypy==0.720 +mypy==0.770 -r requirements-test.txt \ No newline at end of file --- mirakuru-2.1.0.orig/requirements-test.txt +++ mirakuru-2.1.0/requirements-test.txt @@ -1,8 +1,8 @@ # test runs requirements (versions we'll be testing against) - automatically updated -psutil==5.6.3 -pytest==5.1.2 # tests framework used -pytest-cov==2.7.1 # coverage reports to verify tests quality -coverage==4.5.4 # pytest-cov -python-daemon==2.2.3 # used in test for easy creation of daemons +psutil==5.7.0 +pytest==5.4.2 # tests framework used +pytest-cov==2.8.1 # coverage reports to verify tests quality +coverage==5.1 # pytest-cov +python-daemon==2.2.4 # used in test for easy creation of daemons docutils # needed for python-daemon -e .[tests] --- mirakuru-2.1.0.orig/setup.py +++ mirakuru-2.1.0/setup.py @@ -53,7 +53,7 @@ def read(fname): setup( name='mirakuru', - version='2.1.0', + version='2.3.0', description='Process executor for tests.', long_description=( read('README.rst') + '\n\n' + read('CHANGES.rst') @@ -76,6 +76,7 @@ setup( 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Testing', --- mirakuru-2.1.0.orig/src/mirakuru/__init__.py +++ mirakuru-2.1.0/src/mirakuru/__init__.py @@ -33,7 +33,7 @@ from mirakuru.exceptions import ( ProcessExitedWithError, ) -__version__ = '2.1.0' +__version__ = '2.3.0' __all__ = ( 'Executor', --- mirakuru-2.1.0.orig/src/mirakuru/base.py +++ mirakuru-2.1.0/src/mirakuru/base.py @@ -38,13 +38,13 @@ from mirakuru.base_env import processes_ from mirakuru.exceptions import ( AlreadyRunning, ProcessExitedWithError, + ProcessFinishedWithError, TimeoutExpired, ) from mirakuru.compat import SIGKILL log = logging.getLogger(__name__) # pylint: disable=invalid-name - ENV_UUID = 'mirakuru_uuid' """ Name of the environment variable used by mirakuru to mark its subprocesses. @@ -63,13 +63,14 @@ ExecutorType = TypeVar("ExecutorType", b @atexit.register def cleanup_subprocesses() -> None: """On python exit: find possibly running subprocesses and kill them.""" - # pylint: disable=redefined-outer-name, reimported + # pylint: disable=redefined-outer-name, reimported, import-outside-toplevel # atexit functions tends to loose global imports sometimes so reimport # everything what is needed again here: import os import errno from mirakuru.base_env import processes_with_env from mirakuru.compat import SIGKILL + # pylint: enable=redefined-outer-name, reimported, import-outside-toplevel pids = processes_with_env(ENV_UUID, str(os.getpid())) for pid in pids: @@ -92,6 +93,7 @@ class SimpleExecutor: # pylint:disable= sleep: float = 0.1, sig_stop: int = signal.SIGTERM, sig_kill: int = SIGKILL, + exp_sig: int = None, envvars: Optional[Dict[str, str]] = None, stdin: Union[None, int, IO[Any]] = subprocess.PIPE, stdout: Union[None, int, IO[Any]] = subprocess.PIPE, @@ -111,6 +113,8 @@ class SimpleExecutor: # pylint:disable= default is `signal.SIGTERM` :param int sig_kill: signal used to kill process run by the executor. default is `signal.SIGKILL` (`signal.SIGTERM` on Windows) + :param int exp_sig: expected exit code. + default is None as it will fall back to the stop signal :param dict envvars: Additional environment variables :param int stdin: file descriptor for stdin :param int stdout: file descriptor for stdout @@ -145,6 +149,7 @@ class SimpleExecutor: # pylint:disable= self._sleep = sleep self._sig_stop = sig_stop self._sig_kill = sig_kill + self._exp_sig = exp_sig self._envvars = envvars or {} self._stdin = stdin @@ -294,7 +299,11 @@ class SimpleExecutor: # pylint:disable= log.debug("Killed process %d.", pid) return pids - def stop(self: SimpleExecutorType, sig: int = None) -> SimpleExecutorType: + def stop( + self: SimpleExecutorType, + sig: int = None, + exp_sig: int = None + ) -> SimpleExecutorType: """ Stop process running. @@ -302,6 +311,8 @@ class SimpleExecutor: # pylint:disable= :param int sig: signal used to stop process run by executor. None for default. + :param int exp_sig: expected exit code. + None for default. :returns: itself :rtype: SimpleExecutor @@ -316,6 +327,9 @@ class SimpleExecutor: # pylint:disable= if sig is None: sig = self._sig_stop + if exp_sig is None: + exp_sig = self._exp_sig + try: os.killpg(self.process.pid, sig) except OSError as err: @@ -335,8 +349,25 @@ class SimpleExecutor: # pylint:disable= # at this moment, process got killed, pass + if self.process is None: + # the process has already been force killed and cleaned up by the + # `wait_for` above. + return self self._kill_all_kids(sig) + exit_code = self.process.wait() self._clear_process() + + # Did the process shut down cleanly? A an exit code of `-sig` means + # that it has terminated due to signal `sig`, which is intended. So + # don't treat that as an error. + # pylint: disable=invalid-unary-operand-type + expected_exit_code = -sig + if exp_sig is not None: + expected_exit_code = -exp_sig + + if exit_code and exit_code != expected_exit_code: + raise ProcessFinishedWithError(self, exit_code) + return self @contextmanager --- mirakuru-2.1.0.orig/src/mirakuru/base_env.py +++ mirakuru-2.1.0/src/mirakuru/base_env.py @@ -21,7 +21,7 @@ import errno import logging import re import subprocess -from typing import Set +from typing import Set, List try: import psutil @@ -79,7 +79,7 @@ def processes_with_env_ps(env_name: str, :rtype: set """ pids: Set[int] = set() - ps_xe = '' + ps_xe: List[bytes] = [] try: cmd = 'ps', 'xe', '-o', 'pid,cmd' ps_xe = subprocess.check_output(cmd).splitlines() @@ -96,9 +96,9 @@ def processes_with_env_ps(env_name: str, env = f'{env_name}={env_value}' for line in ps_xe: - line = str(line) - if env in line: - match = PS_XE_PID_MATCH.match(line) + sline = str(line) + if env in sline: + match = PS_XE_PID_MATCH.match(sline) # This always matches: all lines other than the header (not # containing our environment variable) have a PID required by the # reggex. Still check it for mypy. --- mirakuru-2.1.0.orig/src/mirakuru/exceptions.py +++ mirakuru-2.1.0/src/mirakuru/exceptions.py @@ -101,3 +101,12 @@ class ProcessExitedWithError(ExecutorErr """ return (f"The process invoked by the {self.executor} executor has " f"exited with a non-zero code: {self.exit_code}.") + + +class ProcessFinishedWithError(ProcessExitedWithError): + """ + Raised when the process invoked by the executor fails when stopping. + + When a process is stopped, it should shut down cleanly and return zero as + exit code. When is returns a non-zero exit code, this exception is raised. + """ --- mirakuru-2.1.0.orig/src/mirakuru/http.py +++ mirakuru-2.1.0/src/mirakuru/http.py @@ -19,12 +19,15 @@ import re import socket +from logging import getLogger from urllib.parse import urlparse, urlencode from http.client import HTTPConnection, HTTPException from typing import Union, List, Tuple, Optional, Dict, Any from mirakuru.tcp import TCPExecutor +LOG = getLogger(__name__) + class HTTPExecutor(TCPExecutor): """Http enabled process executor.""" @@ -74,6 +77,9 @@ class HTTPExecutor(TCPExecutor): It'll be used to check process status on. """ + if not self.url.hostname: + raise ValueError("Url provided does not contain hostname") + port = self.url.port if port is None: port = self.DEFAULT_PORT @@ -89,9 +95,9 @@ class HTTPExecutor(TCPExecutor): ) def after_start_check(self) -> bool: - """Check if defined URL returns expected status to a HEAD request.""" + """Check if defined URL returns expected status to a check request.""" + conn = HTTPConnection(self.host, self.port) try: - conn = HTTPConnection(self.host, self.port) body = urlencode(self.payload) if self.payload else None headers = self.headers if self.headers else {} conn.request( @@ -100,12 +106,18 @@ class HTTPExecutor(TCPExecutor): body, headers, ) - status = str(conn.getresponse().status) + try: + status = str(conn.getresponse().status) + finally: + conn.close() if status == self.status or self.status_re.match(status): - conn.close() return True return False - except (HTTPException, socket.timeout, socket.error): + except (HTTPException, socket.timeout, socket.error) as ex: + LOG.debug( + "Encounter %s while trying to check if service has started.", + ex + ) return False --- mirakuru-2.1.0.orig/src/mirakuru/output.py +++ mirakuru-2.1.0/src/mirakuru/output.py @@ -133,7 +133,7 @@ class OutputExecutor(SimpleExecutor): return True return False - def _wait_for_output(self, *polls: Tuple[select.poll, IO[Any]]) -> bool: + def _wait_for_output(self, *polls: Tuple['select.poll', IO[Any]]) -> bool: """ Check if output matches banner. --- mirakuru-2.1.0.orig/tests/executors/test_executor.py +++ mirakuru-2.1.0/tests/executors/test_executor.py @@ -59,6 +59,22 @@ def test_stop_custom_signal_stop(): assert executor.running() is False +def test_stop_custom_exit_signal_stop(): + """Start process and expect it to finish with custom signal.""" + executor = SimpleExecutor('false', shell=True) + executor.start() + # false exits instant, so there should not be a process to stop + executor.stop(sig=signal.SIGQUIT, exp_sig=3) + assert executor.running() is False + + +def test_stop_custom_exit_signal_context(): + """Start process and expect custom exit signal in context manager.""" + with SimpleExecutor('false', exp_sig=3, shell=True) as executor: + executor.stop(sig=signal.SIGQUIT) + assert executor.running() is False + + def test_running_context(): """Start process and shuts it down.""" executor = SimpleExecutor(SLEEP_300) @@ -229,14 +245,14 @@ def test_executor_methods_returning_self def test_mirakuru_cleanup(): """Test if cleanup_subprocesses is fired correctly on python exit.""" cmd = f''' - python3 -c 'from mirakuru import SimpleExecutor; - from time import sleep; - import gc; - gc.disable(); - ex = SimpleExecutor( - ("python3", "{SAMPLE_DAEMON_PATH}")).start(); - sleep(1); - ' + python -c 'from mirakuru import SimpleExecutor; + from time import sleep; + import gc; + gc.disable(); + ex = SimpleExecutor( + ("python", "{SAMPLE_DAEMON_PATH}")).start(); + sleep(1); + ' ''' check_output(shlex.split(cmd.replace('\n', ''))) assert SAMPLE_DAEMON_PATH not in ps_aux() --- mirakuru-2.1.0.orig/tests/executors/test_executor_kill.py +++ mirakuru-2.1.0/tests/executors/test_executor_kill.py @@ -8,10 +8,12 @@ import errno import os from unittest.mock import patch + import pytest from mirakuru import SimpleExecutor, HTTPExecutor from mirakuru.compat import SIGKILL +from mirakuru.exceptions import ProcessFinishedWithError from tests import SAMPLE_DAEMON_PATH, ps_aux, TEST_SERVER_PATH @@ -38,23 +40,20 @@ def test_kill_custom_signal_kill(): def test_already_closed(): """Check that the executor cleans after itself after it exited earlier.""" - with SimpleExecutor('python3') as executor: - assert executor.running() - os.killpg(executor.process.pid, SIGKILL) - - def process_stopped(): - """Return True only only when self.process is not running.""" - return executor.running() is False - executor.wait_for(process_stopped) - assert executor.process + with pytest.raises(ProcessFinishedWithError) as excinfo: + with SimpleExecutor('python') as executor: + assert executor.running() + os.killpg(executor.process.pid, SIGKILL) + + def process_stopped(): + """Return True only only when self.process is not running.""" + return executor.running() is False + executor.wait_for(process_stopped) + assert executor.process + assert excinfo.value.exit_code == -9 assert not executor.process -@pytest.mark.xfail( - condition=sys.version_info >= (3, 8), - reason='python-daemon 2.2.3 fails with ' - '<https://pagure.io/python-daemon/issue/34>; ' - 'unxfail when a newer version is used') def test_daemons_killing(): """ Test if all subprocesses of SimpleExecutor can be killed. @@ -63,7 +62,7 @@ def test_daemons_killing(): change the process group ID. This test verifies that daemon process is killed after executor's kill(). """ - executor = SimpleExecutor(('python3', SAMPLE_DAEMON_PATH), shell=True) + executor = SimpleExecutor(('python', SAMPLE_DAEMON_PATH), shell=True) executor.start() time.sleep(2) assert executor.running() is not True, \ --- mirakuru-2.1.0.orig/tests/executors/test_tcp_executor.py +++ mirakuru-2.1.0/tests/executors/test_tcp_executor.py @@ -18,7 +18,7 @@ HTTP_SERVER = f'{HTTP_SERVER_CMD} {PORT} def test_start_and_wait(): """Test if executor await for process to accept connections.""" - command = 'bash -c "sleep 2 && nc -l -p 3000"' + command = 'bash -c "sleep 2 && nc -l 3000"' executor = TCPExecutor(command, 'localhost', port=3000, timeout=5) executor.start() @@ -32,7 +32,7 @@ def test_start_and_wait(): def test_it_raises_error_on_timeout(): """Check if TimeoutExpired gets raised correctly.""" - command = 'bash -c "sleep 10 && nc -l -p 3000"' + command = 'bash -c "sleep 10 && nc -l 3000"' executor = TCPExecutor(command, host='localhost', port=3000, timeout=2) with pytest.raises(TimeoutExpired):