Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH v2] Add an emaint module that can scan for failed merges and that can fix failed merges.
Date: Sat, 22 Feb 2014 19:03:59
Message-Id: 20140222105928.28f3f99e.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2] Add an emaint module that can scan for failed merges and that can fix failed merges. by Pavel Kazakov
1 On Fri, 21 Feb 2014 16:34:47 -0800
2 Pavel Kazakov <nullishzero@g.o> wrote:
3
4 > ---
5 > pym/portage/emaint/main.py | 6 +-
6 > pym/portage/emaint/modules/merges/__init__.py | 19 ++++
7 > pym/portage/emaint/modules/merges/merges.py | 121 ++++++++++++++++++++++++++
8 > 3 files changed, 144 insertions(+), 2 deletions(-)
9 > create mode 100644 pym/portage/emaint/modules/merges/__init__.py
10 > create mode 100644 pym/portage/emaint/modules/merges/merges.py
11 >
12
13 ...
14
15 > + results = []
16 > + msg = 'Re-Emerging packages that failed to merge...\n'
17 > + if module_output:
18 > + module_output.write(msg)
19 > + else:
20 > + module_output = subprocess.PIPE
21 > + results.append(msg)
22 > + proc = subprocess.Popen(emerge_cmd + tuple(pkg_atoms), env=env,
23 > + stdout=module_output, stderr=sys.stderr)
24 > + output = proc.communicate()[0]
25 > + if output:
26 > + results.append(output)
27 > + if proc.returncode != os.EX_OK:
28 > + finish = "Failed to emerge '%s'" % (' '.join(pkg_atoms))
29 > + else:
30 > + finish = "Successfully emerged '%s'" % (' '.join(pkg_atoms))
31 > + results.append(finish)
32 > + return results
33
34 With IRC being crapped out with netsplits...
35
36 Sorry, but I didn't notice this until reviewing this v2 submission.
37 Even though I gave you the thumbs up from the last paste. This code is
38 not cleaning up the tracking file used for safety backup. What' more, a
39 second run will trounce the first file saved, even if emerge totally
40 failed in the first.
41
42 So, it needs this additional work, to be complete (sorry):
43
44 1) check for the existence of the tracking file in both
45 check() and fix()
46 2) add those pkgs to the list reported in check()
47 3) add them to a fix() run.
48 4) at the end of the emerge run in fix(), re-scan for -MERGING- pkgs
49 again. list any new ones.
50 5) reload portage for it to see the new vardb
51 6) check for the pkgs re-emerged to ensure they were successful
52 ie: vardb = ...
53 vardb.cpv_exists(pkg)
54 7) remove any sucessful pkgs from the tracking file.
55
56 8) I also think we should add the date/time info when they ere
57 added to the tracking file and cleaned from the filesystem
58
59 P.S. I can help with this if you like.
60
61 --
62 Brian Dolbec <dolsen>