Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/
Date: Wed, 30 Mar 2022 23:11:57
Message-Id: 1648681903.94dad3d64599f7e2c0c28e90ec4bee883746e385.sam@gentoo
1 commit: 94dad3d64599f7e2c0c28e90ec4bee883746e385
2 Author: Kenneth Raplee <kenrap <AT> kennethraplee <DOT> com>
3 AuthorDate: Wed Mar 30 22:47:33 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 30 23:11:43 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=94dad3d6
7
8 dispatch_conf: fix arguments
9
10 Closes: https://bugs.gentoo.org/836447
11 Signed-off-by: Kenneth Raplee <kenrap <AT> kennethraplee.com>
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 lib/portage/dispatch_conf.py | 7 ++++---
15 1 file changed, 4 insertions(+), 3 deletions(-)
16
17 diff --git a/lib/portage/dispatch_conf.py b/lib/portage/dispatch_conf.py
18 index 6dbb1885e..fc130c9af 100644
19 --- a/lib/portage/dispatch_conf.py
20 +++ b/lib/portage/dispatch_conf.py
21 @@ -28,14 +28,15 @@ RCS_GET = "co"
22 _ARCHIVE_ROTATE_MAX = 9
23
24
25 -def diffstatusoutput(cmd, file1, file2):
26 +def diffstatusoutput(file1, file2):
27 """
28 Execute the string cmd in a shell with getstatusoutput() and return a
29 2-tuple (status, output).
30 """
31 # Use Popen to emulate getstatusoutput(), since getstatusoutput() may
32 # raise a UnicodeDecodeError which makes the output inaccessible.
33 - args = shlex_split(cmd % (file1, file2))
34 + cmd = f"diff -aq '{file1}' '{file2}'"
35 + args = shlex_split(cmd)
36
37 args = (portage._unicode_encode(x, errors="strict") for x in args)
38 proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
39 @@ -340,7 +341,7 @@ def file_archive(archive, curconf, newconf, mrgconf):
40 # Archive the current config file if it isn't already saved
41 if (
42 os.path.lexists(archive)
43 - and len(diffstatusoutput_mixed(f"diff -aq '{curconf}' '{archive}'")[1]) != 0
44 + and len(diffstatusoutput_mixed(curconf, archive)[1]) != 0
45 ):
46 _file_archive_rotate(archive)