[Piuparts-devel] [Git][debian/piuparts][develop] 10 commits: piuparts-slave: run isort

Nicolas Dandrimont (@olasd) gitlab at salsa.debian.org
Wed Jan 11 12:32:16 GMT 2023



Nicolas Dandrimont pushed to branch develop at Debian / piuparts


Commits:
3331b140 by Nicolas Dandrimont at 2023-01-11T11:35:00+01:00
piuparts-slave: run isort

- - - - -
ad7e30b3 by Nicolas Dandrimont at 2023-01-11T11:59:39+01:00
piuparts-slave: replace pipes.quote with shlex.quote

- - - - -
b9ca98d1 by Nicolas Dandrimont at 2023-01-11T11:59:52+01:00
piuparts.py: run isort

- - - - -
fc0047c9 by Nicolas Dandrimont at 2023-01-11T11:59:52+01:00
piuparts.py: replace pipes.quote with shlex.quote

- - - - -
2cfae2aa by Nicolas Dandrimont at 2023-01-11T12:00:00+01:00
test_piuparts: replace mox3 with unittest.mock

Closes: #1028453

- - - - -
2fd10804 by Nicolas Dandrimont at 2023-01-11T12:05:53+01:00
Migrate lintian overrides to pointed hints

- - - - -
cd45cc8f by Nicolas Dandrimont at 2023-01-11T13:19:53+01:00
Simplify docs install in Makefile

- - - - -
224e9beb by Nicolas Dandrimont at 2023-01-11T13:25:39+01:00
Use sphinxdoc dh plugin

- - - - -
0ac90edf by Nicolas Dandrimont at 2023-01-11T13:25:39+01:00
Update changelog

- - - - -
fbca117e by Nicolas Dandrimont at 2023-01-11T13:31:48+01:00
Release to unstable

- - - - -


8 changed files:

- Makefile
- debian/changelog
- debian/control
- debian/piuparts.lintian-overrides
- debian/rules
- piuparts-slave.py
- piuparts.py
- tests/test_piuparts.py


Changes:

=====================================
Makefile
=====================================
@@ -83,42 +83,7 @@ install-doc: build-stamp
 	install -d $(DESTDIR)$(docdir)/
 	install -m 0644 docs/README.txt docs/README_server.txt $(DESTDIR)$(docdir)/
 	# html
-	install -d $(DESTDIR)$(docdir)/html/
-	install -m 0644 docs/build/*.html $(DESTDIR)$(docdir)/html/
-	install -m 0644 docs/build/searchindex.js $(DESTDIR)$(docdir)/html/
-	install -m 0644 docs/build/objects.inv $(DESTDIR)$(docdir)/html/
-	install -d $(DESTDIR)$(docdir)/html/_static/
-	install -m 0644 docs/build/_static/* $(DESTDIR)$(docdir)/html/_static
-	install -d $(DESTDIR)$(docdir)/html/piuparts/
-	install -m 0644 docs/build/piuparts/index.html $(DESTDIR)$(docdir)/html/piuparts/
-	install -m 0644 docs/build/piuparts/piuparts.1.html $(DESTDIR)$(docdir)/html/piuparts/
-	install -d $(DESTDIR)$(docdir)/html/piuparts_slave_run/
-	install -m 0644 docs/build/piuparts_slave_run/index.html $(DESTDIR)$(docdir)/html/piuparts_slave_run/
-	install -m 0644 docs/build/piuparts_slave_run/piuparts_slave_run.8.html $(DESTDIR)$(docdir)/html/piuparts_slave_run/
-	install -d $(DESTDIR)$(docdir)/html/piuparts_slave_join/
-	install -m 0644 docs/build/piuparts_slave_join/index.html $(DESTDIR)$(docdir)/html/piuparts_slave_join/
-	install -m 0644 docs/build/piuparts_slave_join/piuparts_slave_join.8.html $(DESTDIR)$(docdir)/html/piuparts_slave_join/
-	install -d $(DESTDIR)$(docdir)/html/piuparts_slave_stop/
-	install -m 0644 docs/build/piuparts_slave_stop/index.html $(DESTDIR)$(docdir)/html/piuparts_slave_stop/
-	install -m 0644 docs/build/piuparts_slave_stop/piuparts_slave_stop.8.html $(DESTDIR)$(docdir)/html/piuparts_slave_stop/
-	install -d $(DESTDIR)$(docdir)/html/
-	install -m 0644 docs/build/*.html $(DESTDIR)$(docdir)/html/
-	install -m 0644 docs/build/searchindex.js $(DESTDIR)$(docdir)/html/
-	install -m 0644 docs/build/objects.inv $(DESTDIR)$(docdir)/html/
-	install -d $(DESTDIR)$(docdir)/html/_static/
-	install -m 0644 docs/build/_static/* $(DESTDIR)$(docdir)/html/_static
-	install -d $(DESTDIR)$(docdir)/html/piuparts/
-	install -m 0644 docs/build/piuparts/index.html $(DESTDIR)$(docdir)/html/piuparts/
-	install -m 0644 docs/build/piuparts/piuparts.1.html $(DESTDIR)$(docdir)/html/piuparts/
-	install -d $(DESTDIR)$(docdir)/html/piuparts_slave_run/
-	install -m 0644 docs/build/piuparts_slave_run/index.html $(DESTDIR)$(docdir)/html/piuparts_slave_run/
-	install -m 0644 docs/build/piuparts_slave_run/piuparts_slave_run.8.html $(DESTDIR)$(docdir)/html/piuparts_slave_run/
-	install -d $(DESTDIR)$(docdir)/html/piuparts_slave_join/
-	install -m 0644 docs/build/piuparts_slave_join/index.html $(DESTDIR)$(docdir)/html/piuparts_slave_join/
-	install -m 0644 docs/build/piuparts_slave_join/piuparts_slave_join.8.html $(DESTDIR)$(docdir)/html/piuparts_slave_join/
-	install -d $(DESTDIR)$(docdir)/html/piuparts_slave_stop/
-	install -m 0644 docs/build/piuparts_slave_stop/index.html $(DESTDIR)$(docdir)/html/piuparts_slave_stop/
-	install -m 0644 docs/build/piuparts_slave_stop/piuparts_slave_stop.8.html $(DESTDIR)$(docdir)/html/piuparts_slave_stop/
+	cp -r docs/build/ $(DESTDIR)$(docdir)/html/
 	# manpages
 	install -d $(DESTDIR)$(man1dir)
 	install -m 0644 piuparts.1 $(DESTDIR)$(man1dir)/


=====================================
debian/changelog
=====================================
@@ -1,3 +1,33 @@
+piuparts (1.1.6) unstable; urgency=medium
+
+  [ David Steele ]
+  * Remove oldold*stable dists from json summary
+
+  [ Holger Levsen ]
+  * custom-scripts/scripts/pre_test_root_password: fix grammar in comment
+
+  [ Luca Boccassi ]
+  * piuparts: detect files moving between / and /usr on upgrade
+  * piuparts: detect files moving between / and /usr on dist-upgrade
+  * p.conf: enable --warn-on-usr-move for bullseye/bookworm
+  * custom_scripts: ensure usr-is-merged/usrmerge does not fail the
+    migration test
+
+  [ David Steele ]
+  * Add Stable Release tasks to README_pejacevic.txt
+
+  [ Nicolas Dandrimont ]
+  * piuparts-slave: run isort
+  * piuparts-slave: replace pipes.quote with shlex.quote
+  * piuparts.py: run isort
+  * piuparts.py: replace pipes.quote with shlex.quote
+  * test_piuparts: replace mox3 with unittest.mock (Closes: #1028453)
+  * Migrate lintian overrides to pointed hints
+  * Simplify docs install in Makefile
+  * Use sphinxdoc dh plugin
+
+ -- Nicolas Dandrimont <olasd at debian.org>  Wed, 11 Jan 2023 13:31:41 +0100
+
 piuparts (1.1.5) unstable; urgency=medium
 
   [ Nicolas Dandrimont ]
@@ -10,8 +40,8 @@ piuparts (1.1.5) unstable; urgency=medium
   * Remove oldstable results from summary.json.
 
   [ Athos Ribeiro ]
-  * d/rules: set GO111MODULE to auto to maintain pre Go 1.16 behavior. Closes: #991970.
-    (MR: debian/piuparts!35)
+  * d/rules: set GO111MODULE to auto to maintain pre Go 1.16 behavior.
+    Closes: #991970. (MR: debian/piuparts!35)
 
  -- Holger Levsen <holger at debian.org>  Thu, 14 Oct 2021 15:23:26 +0200
 


=====================================
debian/control
=====================================
@@ -15,7 +15,6 @@ Build-Depends:
  python3-debian,
  python3-debianbts (>= 2.10.0),
  python3-distro-info,
- python3-mox3,
  python3-nose,
  python3-six,
  python3-sphinx,
@@ -35,13 +34,13 @@ Depends:
 # keep this list in sync with piuparts-slave-from-git-deps
  debootstrap (>= 1.0.89~),
  debsums (>= 2.2.2~),
- libjs-sphinxdoc,
  lsb-release,
  lsof,
  mount,
  python3-debian,
  ${python3:Depends},
  ${misc:Depends},
+ ${sphinxdoc:Depends}
 Recommends:
  adequate
 Suggests:


=====================================
debian/piuparts.lintian-overrides
=====================================
@@ -1,6 +1,6 @@
 # it is impossible not to do this without losing compatibility with ancient releases
-uses-dpkg-database-directly etc/piuparts/scripts-debug-purge/post_remove_postrm_set-x
-uses-dpkg-database-directly etc/piuparts/scripts-debug-remove/pre_remove_prerm_postrm_set-x
-uses-dpkg-database-directly etc/piuparts/scripts/post_remove_exceptions
-uses-dpkg-database-directly etc/piuparts/scripts/pre_remove_40_find_missing_md5sums
-uses-dpkg-database-directly usr/sbin/piuparts
+uses-dpkg-database-directly [etc/piuparts/scripts-debug-purge/post_remove_postrm_set-x]
+uses-dpkg-database-directly [etc/piuparts/scripts-debug-remove/pre_remove_prerm_postrm_set-x]
+uses-dpkg-database-directly [etc/piuparts/scripts/post_remove_exceptions]
+uses-dpkg-database-directly [etc/piuparts/scripts/pre_remove_40_find_missing_md5sums]
+uses-dpkg-database-directly [usr/sbin/piuparts]


=====================================
debian/rules
=====================================
@@ -7,7 +7,7 @@ export GOCACHE := $(CURDIR)/.gocache
 export GO111MODULE := auto
 
 %:
-	dh $@ --with python3
+	dh $@ --with python3,sphinxdoc
 
 override_dh_auto_build:
 	$(MAKE) prefix=/usr build build-doc


=====================================
piuparts-slave.py
=====================================
@@ -24,17 +24,18 @@ Lars Wirzenius <liw at iki.fi>
 """
 from __future__ import print_function
 
+import fcntl
+import logging
 import os
-import sys
+import random
+import shlex
 import stat
-import time
-import logging
-from signal import alarm, signal, SIGALRM, SIGINT, SIGKILL, SIGHUP, SIGUSR1
 import subprocess
-import fcntl
-import random
+import sys
+import time
+from signal import SIGALRM, SIGHUP, SIGINT, SIGKILL, SIGUSR1, alarm, signal
+
 import apt_pkg
-import pipes
 
 import piupartslib.conf
 import piupartslib.packagesdb
@@ -851,7 +852,7 @@ def log_name(package, version):
 
 def command2string(command):
     """Quote s.t. copy+paste from the logfile gives a runnable command in the shell."""
-    return " ".join([pipes.quote(arg) for arg in command])
+    return " ".join([shlex.quote(arg) for arg in command])
 
 
 def run_test_with_timeout(cmd, maxwait, kill_all=True):


=====================================
piuparts.py
=====================================
@@ -35,39 +35,38 @@ from __future__ import print_function
 VERSION = "__PIUPARTS_VERSION__"
 
 
-import distro_info
-import time
+import json
 import logging
 import optparse
-import sys
-import tempfile
-import shutil
 import os
-import tarfile
-import stat
-import re
-import json
+import pathlib
 import pickle
+import re
+import shlex
+import shutil
+import stat
 import subprocess
+import sys
+import tarfile
+import tempfile
+import time
 import traceback
 import uuid
-import apt_pkg
-import pipes
-import pathlib
 from collections import namedtuple
-from signal import alarm, signal, SIGALRM, SIGTERM, SIGKILL
+from signal import SIGALRM, SIGKILL, SIGTERM, alarm, signal
+
+import apt_pkg
+import distro_info
 
 try:
     from debian import deb822
 except ImportError:
     from debian_bundle import deb822
 
-import piupartslib.conf
-
-from six.moves import urllib
-
 import six
+from six.moves import urllib
 
+import piupartslib.conf
 
 apt_pkg.init_system()
 
@@ -506,7 +505,7 @@ def indent_string(str):
 
 def command2string(command):
     """Quote s.t. copy+paste from the logfile gives a runnable command in the shell."""
-    return " ".join([pipes.quote(arg) for arg in command])
+    return " ".join([shlex.quote(arg) for arg in command])
 
 
 def unqualify(packages):


=====================================
tests/test_piuparts.py
=====================================
@@ -1,63 +1,69 @@
-import unittest
-from mox3 import mox
 import os
 import shutil
+import unittest
+from unittest.mock import patch
+
 import piuparts
 from piuparts import is_broken_symlink
 
 
 class DefaultsFactoryTests(unittest.TestCase):
-
     def setUp(self):
-        self.mox = mox.Mox()
         self.df = piuparts.DefaultsFactory()
         piuparts.settings = piuparts.Settings()
 
-    def tearDown(self):
-        self.mox.UnsetStubs()
-
     def test_new_defaults_return_debian_defaults(self):
         # mock the guess_flavor function as it runs lsb_release in a subprocess
-        self.mox.StubOutWithMock(self.df, 'guess_flavor')
-        self.df.guess_flavor().AndReturn('debian')
-        self.mox.ReplayAll()
-
-        defaults = self.df.new_defaults()
-        self.mox.VerifyAll()
-
-        self.assertEqual(defaults.get_keyring(), '/usr/share/keyrings/debian-archive-keyring.gpg')
+        with patch.object(
+            self.df, "guess_flavor", return_value="debian"
+        ) as guess_flavor_mock:
+            defaults = self.df.new_defaults()
+            guess_flavor_mock.assert_called_once()
+
+        self.assertEqual(
+            defaults.get_keyring(), "/usr/share/keyrings/debian-archive-keyring.gpg"
+        )
         self.assertEqual(defaults.get_components(), ["main", "contrib", "non-free"])
-        self.assertEqual(defaults.get_mirror(), [("http://deb.debian.org/debian", ["main", "contrib", "non-free"])])
-        self.assertEqual(defaults.get_distribution(), ['sid'])
+        self.assertEqual(
+            defaults.get_mirror(),
+            [("http://deb.debian.org/debian", ["main", "contrib", "non-free"])],
+        )
+        self.assertEqual(defaults.get_distribution(), ["sid"])
 
     def test_new_defaults_return_ubuntu_defaults(self):
-        # mock the guess_flavor function as it runs lsb_release in a subprocess
-        self.mox.StubOutWithMock(self.df, 'guess_flavor')
-        self.df.guess_flavor().AndReturn('ubuntu')
-        self.mox.ReplayAll()
-
-        defaults = self.df.new_defaults()
-        self.mox.VerifyAll()
-
-        self.assertEqual(defaults.get_keyring(), '/usr/share/keyrings/ubuntu-archive-keyring.gpg')
-        self.assertEqual(defaults.get_components(), ["main", "universe", "restricted", "multiverse"])
-        self.assertEqual(defaults.get_mirror(), [("http://archive.ubuntu.com/ubuntu", ["main", "universe", "restricted", "multiverse"])])
+        with patch.object(
+            self.df, "guess_flavor", return_value="ubuntu"
+        ) as guess_flavor_mock:
+            defaults = self.df.new_defaults()
+            guess_flavor_mock.assert_called_once()
+
+        self.assertEqual(
+            defaults.get_keyring(), "/usr/share/keyrings/ubuntu-archive-keyring.gpg"
+        )
+        self.assertEqual(
+            defaults.get_components(), ["main", "universe", "restricted", "multiverse"]
+        )
+        self.assertEqual(
+            defaults.get_mirror(),
+            [
+                (
+                    "http://archive.ubuntu.com/ubuntu",
+                    ["main", "universe", "restricted", "multiverse"],
+                )
+            ],
+        )
 
     def test_new_defaults_panics_with_unknown_flavor(self):
-        # mock the guess_flavor function as it runs lsb_release in a subprocess
-        # and the panic function as it would use sys.exit()
-        self.mox.StubOutWithMock(self.df, 'guess_flavor')
-        self.df.guess_flavor().AndReturn('centos')
-        self.mox.StubOutWithMock(piuparts, 'panic')
-        piuparts.panic().AndReturn('Oh dear! Its CentOS!')
-        self.mox.ReplayAll()
-
-        defaults = self.df.new_defaults()
-        self.mox.VerifyAll()
-
-        # panic() would cause sys.exit() so no Defaults object would
-        # ever be returned
-        self.assertEqual(defaults, None)
+        with patch.object(
+            self.df, "guess_flavor", return_value="centos"
+        ) as guess_flavor_mock, patch.object(
+            piuparts, "panic", side_effect=SystemExit
+        ) as panic_mock:
+            with self.assertRaises(SystemExit):
+                self.df.new_defaults()
+
+            guess_flavor_mock.assert_called_once()
+            panic_mock.assert_called_once()
 
 
 class IsBrokenSymlinkTests(unittest.TestCase):



View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/67a85a4fce4e8780e57d46fae484bfddfeb41ff4...fbca117e15ad105e1560abd1fdc77e63864f00e5

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/67a85a4fce4e8780e57d46fae484bfddfeb41ff4...fbca117e15ad105e1560abd1fdc77e63864f00e5
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/20230111/ebe8f505/attachment-0001.htm>


More information about the Piuparts-devel mailing list