[Piuparts-devel] [Git][debian/piuparts][master] 12 commits: Start 1.4.3 development

Nicolas Dandrimont (@olasd) gitlab at salsa.debian.org
Tue Jun 25 15:37:06 BST 2024



Nicolas Dandrimont pushed to branch master at Debian / piuparts


Commits:
e41cb827 by Nicolas Dandrimont at 2024-05-06T22:57:11+02:00
Start 1.4.3 development

- - - - -
160354cc by Nicolas Dandrimont at 2024-05-14T13:21:38+02:00
Run autopkgtest on all supported Python versions

- - - - -
f6216a2f by Nicolas Dandrimont at 2024-05-14T13:24:42+02:00
Add more tar ignore patterns to debian/source/options

- - - - -
958c35ab by Nicolas Dandrimont at 2024-05-14T13:24:58+02:00
Remove use of deprecated configparser.SafeConfigParser

This was deprecated back in 3.2 and finally got removed in 3.12.

Closes: #1067938

- - - - -
38f61053 by Nicolas Dandrimont at 2024-05-14T13:24:58+02:00
d/t/all-python-versions: turn on the CPython dev mode

This should enable all warnings

- - - - -
663e4c40 by Nicolas Dandrimont at 2024-05-14T13:24:58+02:00
run(): ensure that fds are properly closed under all circumstances

This removes a ResourceWarning in dev mode

- - - - -
36cca1b2 by Nicolas Dandrimont at 2024-05-14T12:16:41+00:00
Merge branch 'mr/python3.12' into 'develop'

python 3.12 support

See merge request debian/piuparts!59
- - - - -
066cab54 by Jochen Sprickerhof at 2024-05-18T17:05:03+02:00
make piuparts.py executable from git

- - - - -
22d4b577 by Nicolas Dandrimont at 2024-05-18T15:29:50+00:00
Merge branch 'exec' into 'develop'

make piuparts.py executable from git

See merge request debian/piuparts!61
- - - - -
9d2a4e4a by Carlos Henrique Lima Melara at 2024-05-22T13:46:23-03:00
docs: fix some typos in README.txt

Closes: #1071621

- - - - -
57c64fd8 by Nicolas Dandrimont at 2024-05-22T17:30:21+00:00
Merge branch 'charles/fix-typos-in-readme' into 'develop'

docs: fix some typos in README.txt

See merge request debian/piuparts!62
- - - - -
c11be505 by Nicolas Dandrimont at 2024-06-25T16:07:52+02:00
Release piuparts 1.4.3

- - - - -


9 changed files:

- debian/changelog
- debian/source/options
- + debian/tests/all-python-versions
- + debian/tests/common.sh
- debian/tests/control
- debian/tests/smoke-test
- docs/README.txt
- piuparts.py
- piupartslib/conf.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,20 @@
+piuparts (1.4.3) unstable; urgency=medium
+
+  [ Nicolas Dandrimont ]
+  * Remove use of deprecated configparser.SafeConfigParser (Closes: #1067938)
+  * Run autopkgtest on all supported Python versions
+  * Add more tar ignore patterns to debian/source/options
+  * d/t/all-python-versions: turn on the CPython dev mode
+  * run(): ensure that fds are properly closed under all circumstances
+
+  [ Jochen Sprickerhof ]
+  * make piuparts.py executable from git
+
+  [ Carlos Henrique Lima Melara ]
+  * docs: fix some typos in README.txt (Closes: #1071621)
+
+ -- Nicolas Dandrimont <olasd at debian.org>  Tue, 25 Jun 2024 16:07:49 +0200
+
 piuparts (1.4.2) unstable; urgency=medium
 
   [ Helmut Grohne ]


=====================================
debian/source/options
=====================================
@@ -1 +1 @@
-tar-ignore = .git
+tar-ignore = .git,.tox,.mypy_cache,__pycache__


=====================================
debian/tests/all-python-versions
=====================================
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -eu
+
+. "$(dirname "$0")/common.sh"
+
+echo running "$0"
+
+test_this piuparts --version
+
+cd "$AUTOPKGTEST_TMP"
+
+create_packages
+
+for pyvers in $(py3versions -vi); do
+    test_this "python$pyvers" -X dev /usr/sbin/piuparts t.deb
+done
+
+exit 0


=====================================
debian/tests/common.sh
=====================================
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+set -e
+
+test_this() {
+	echo
+	echo "running $@"
+	$@
+}
+
+create_packages () {
+    # set up a very simple test package
+
+    mkdir -p t/DEBIAN t/usr t/etc
+    cat >t/DEBIAN/control <<EOF
+Package: t
+Version: 4
+Maintainer: Piu Parts <piuparts-devel at alioth-lists.debian.net>
+Priority: optional
+Architecture: all
+Installed-Size: 0
+Description: Auto Package Test Dummy
+ Extremely simple binary package for piuparts testing
+EOF
+
+    dpkg-deb -b t
+
+    rm -r t/
+
+    # another simple package, but set up for failure
+
+    mkdir -p f/DEBIAN f/usr f/etc
+    cat >f/DEBIAN/control <<EOF
+Package: f
+Version: 4
+Maintainer: Piu Parts <piuparts-devel at alioth-lists.debian.net>
+Priority: optional
+Architecture: all
+Installed-Size: 0
+Description: Auto Package Test Fail Dummy
+ Extremely simple binary package for piuparts testing - fail version
+EOF
+
+    cat >f/DEBIAN/postinst <<EOF
+#! /bin/sh
+mkdir -p /etc/f/
+touch /etc/f/ailure
+EOF
+
+    chmod +x f/DEBIAN/postinst
+
+    dpkg-deb -b f
+
+    rm -r f/
+}


=====================================
debian/tests/control
=====================================
@@ -1,3 +1,7 @@
 Tests: smoke-test
-Depends: @
+Depends: piuparts
+Restrictions: needs-root
+
+Tests: all-python-versions
+Depends: piuparts, python3-all
 Restrictions: needs-root


=====================================
debian/tests/smoke-test
=====================================
@@ -1,66 +1,20 @@
 #!/bin/sh
 
-set -e
+set -eu
 
-echo running $0
+. "$(dirname "$0")/common.sh"
 
-test_this() {
-	echo
-	echo "running $@"
-	$@
-}
+echo running "$0"
 
 test_this piuparts --version
 
-WORKDIR=$(mktemp -d)
-trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
-cd $WORKDIR
+cd "$AUTOPKGTEST_TMP"
 
-
-# set up a very simple test package
-
-mkdir -p t/DEBIAN t/usr t/etc
-cat >t/DEBIAN/control <<EOF
-Package: t
-Version: 4
-Maintainer: Piu Parts <piuparts-devel at alioth-lists.debian.net>
-Priority: optional
-Architecture: all
-Installed-Size: 0
-Description: Auto Package Test Dummy
- Extremely simple binary package for piuparts testing
-EOF
-
-dpkg-deb -b t
+create_packages
 
 # this should always succeed
 test_this piuparts t.deb
 
-
-# another simple package, but set up for failure
-
-mkdir -p f/DEBIAN f/usr f/etc
-cat >f/DEBIAN/control <<EOF
-Package: f
-Version: 4
-Maintainer: Piu Parts <piuparts-devel at alioth-lists.debian.net>
-Priority: optional
-Architecture: all
-Installed-Size: 0
-Description: Auto Package Test Fail Dummy
- Extremely simple binary package for piuparts testing - fail version
-EOF
-
-cat >f/DEBIAN/postinst <<EOF
-#! /bin/sh
-mkdir -p /etc/f/
-touch /etc/f/ailure
-EOF
-
-chmod +x f/DEBIAN/postinst
-
-dpkg-deb -b f
-
 # it is an error if this succeeds
 test_this piuparts f.deb && false
 


=====================================
docs/README.txt
=====================================
@@ -256,11 +256,11 @@ the chroot was recorded for later comparison.
 'is_testable\_' - before *installing* your package. If this script
 returns a non-zero return value, the installation of the package
 will be skipped. With a return value of 1 the test will be reported
-as successful, but with a return value if 2 it will be reported as
+as successful, but with a return value of 2 it will be reported as
 failed.
-Use this to flag packages that cannot be be tested with piuparts
+Use this to flag packages that cannot be tested with piuparts
 by design (e.g. usrmerge), require not publicly available external
-ressources (e.g. some downloader packages) or are broken beyond
+resources (e.g. some downloader packages) or are broken beyond
 repair (e.g. buggy packages in archived releases). Use the return
 value of 2 for seriously broken packages that can break piuparts.
 


=====================================
piuparts.py
=====================================
@@ -49,6 +49,7 @@ import time
 import traceback
 import uuid
 from collections import namedtuple
+from contextlib import ExitStack
 from signal import SIGALRM, SIGKILL, SIGTERM, alarm, signal
 from typing import Dict
 
@@ -549,59 +550,62 @@ def run(command, ignore_errors=False, timeout=0):
             p.kill()
         p.wait()
 
-    assert isinstance(command, type([]))
+    assert isinstance(command, list)
     logging.debug("Starting command: %s" % command)
     env = get_clean_environment()
-    devnull = open("/dev/null", "r")
-    p = subprocess.Popen(
-        command,
-        env=env,
-        stdin=devnull,
-        stdout=subprocess.PIPE,
-        stderr=subprocess.STDOUT,
-        universal_newlines=True,
-        errors="backslashreplace",
-    )
-    output = ""
-    excessive_output = False
-    if timeout > 0:
-        signal(SIGALRM, alarm_handler)
-        alarm(timeout)
-    try:
-        while p.poll() is None:
-            """Read 64 KB chunks, but depending on the output buffering behavior
-            of the command we may get less even if more output is coming later.
-            Abort after reading max_command_output_size bytes."""
-            output += p.stdout.read(1 << 16)
-            if len(output) > settings.max_command_output_size:
-                excessive_output = True
-                ignore_errors = False
-                alarm(0)
-                kill_subprocess(p, "excessive output")
-                output += "\n\n***** Command was terminated after exceeding output limit (%.2f MB) *****\n" % (
-                    settings.max_command_output_size / 1024.0 / 1024.0
-                )
-                break
-        if not excessive_output:
-            output += p.stdout.read(settings.max_command_output_size)
-        alarm(0)
-    except Alarm:
-        ignore_errors = False
-        kill_subprocess(p, "excessive runtime")
-        output += "\n\n***** Command was terminated after exceeding runtime limit (%s s) *****\n" % timeout
-    devnull.close()
-
-    if output:
-        dump("\n" + indent_string(output.rstrip("\n")))
-
-    if p.returncode == 0:
-        logging.debug("Command ok: %s" % repr(command))
-    elif ignore_errors:
-        logging.debug("Command failed (status=%d), but ignoring error: %s" % (p.returncode, repr(command)))
-    else:
-        logging.error("Command failed (status=%d): %s\n%s" % (p.returncode, repr(command), indent_string(output)))
-        panic()
-    return p.returncode, output
+    with ExitStack() as s:
+        devnull = s.enter_context(open("/dev/null", "r"))
+
+        p = s.enter_context(
+            subprocess.Popen(
+                command,
+                env=env,
+                stdin=devnull,
+                stdout=subprocess.PIPE,
+                stderr=subprocess.STDOUT,
+                universal_newlines=True,
+                errors="backslashreplace",
+            )
+        )
+        output = ""
+        excessive_output = False
+        if timeout > 0:
+            signal(SIGALRM, alarm_handler)
+            alarm(timeout)
+        try:
+            while p.poll() is None:
+                """Read 64 KB chunks, but depending on the output buffering behavior
+                of the command we may get less even if more output is coming later.
+                Abort after reading max_command_output_size bytes."""
+                output += p.stdout.read(1 << 16)
+                if len(output) > settings.max_command_output_size:
+                    excessive_output = True
+                    ignore_errors = False
+                    alarm(0)
+                    kill_subprocess(p, "excessive output")
+                    output += "\n\n***** Command was terminated after exceeding output limit (%.2f MB) *****\n" % (
+                        settings.max_command_output_size / 1024.0 / 1024.0
+                    )
+                    break
+            if not excessive_output:
+                output += p.stdout.read(settings.max_command_output_size)
+            alarm(0)
+        except Alarm:
+            ignore_errors = False
+            kill_subprocess(p, "excessive runtime")
+            output += "\n\n***** Command was terminated after exceeding runtime limit (%s s) *****\n" % timeout
+
+        if output:
+            dump("\n" + indent_string(output.rstrip("\n")))
+
+        if p.returncode == 0:
+            logging.debug("Command ok: %s" % repr(command))
+        elif ignore_errors:
+            logging.debug("Command failed (status=%d), but ignoring error: %s" % (p.returncode, repr(command)))
+        else:
+            logging.error("Command failed (status=%d): %s\n%s" % (p.returncode, repr(command), indent_string(output)))
+            panic()
+        return p.returncode, output
 
 
 def create_temp_file():


=====================================
piupartslib/conf.py
=====================================
@@ -156,7 +156,7 @@ class DistroConfig(UserDict):
             "depends": None,
             "candidates": None,
         }
-        cp = configparser.SafeConfigParser()
+        cp = configparser.ConfigParser()
         cp.read(filename)
         for section in cp.sections():
             self[section] = dict(self._defaults)



View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/7eb2f02df786f8697f5b45f1146e07fd581ae080...c11be5054ae46a3ab093b52633d2f373b14f53c5

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/7eb2f02df786f8697f5b45f1146e07fd581ae080...c11be5054ae46a3ab093b52633d2f373b14f53c5
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20240625/430ac708/attachment-0001.htm>


More information about the Piuparts-devel mailing list