Skip to content

Commit 229d84a

Browse files
committed
Added a patch to patch.py to not change directories during patching.
- Legacy-Id: 14755
1 parent 89470de commit 229d84a

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

ietf/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ def skip_unreadable_post(record):
946946
'patch/fix-unidecode-argument-warning.patch',
947947
'patch/fix-faker-provider-ro-RO-string.patch',
948948
'patch/add-patch-already-patched-flag.patch',
949+
'patch/fix-patch-no-chdir.patch',
949950
]
950951

951952
STATS_NAMES_LIMIT = 25

patch/fix-patch-no-chdir.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--- patch.py.old 2018-03-09 07:53:37.586201595 -0800
2+
+++ patch.py 2018-03-09 09:17:25.017418754 -0800
3+
@@ -804,10 +804,10 @@
4+
5+
def findfile(self, old, new):
6+
""" return name of file to be patched or None """
7+
- if exists(old):
8+
- return old
9+
- elif exists(new):
10+
+ if exists(new):
11+
return new
12+
+ elif exists(old):
13+
+ return old
14+
else:
15+
# [w] Google Code generates broken patches with its online editor
16+
debug("broken patch from Google Code, stripping prefixes..")
17+
18+
@@ -827,9 +827,6 @@
19+
from file paths. `root` parameter specifies working dir.
20+
return True on success
21+
"""
22+
- if root:
23+
- prevdir = os.getcwd()
24+
- os.chdir(root)
25+
26+
total = len(self.items)
27+
errors = 0
28+
29+
@@ -854,6 +851,8 @@
30+
new = pathstrip(p.target, strip)
31+
else:
32+
old, new = p.source, p.target
33+
+ old = os.path.join(root, old)
34+
+ new = os.path.join(root, new)
35+
36+
filename = self.findfile(old, new)
37+
38+
39+
@@ -956,9 +955,6 @@
40+
# todo: proper rejects
41+
shutil.move(backupname, filename)
42+
43+
- if root:
44+
- os.chdir(prevdir)
45+
-
46+
# todo: check for premature eof
47+
return (errors == 0)

0 commit comments

Comments
 (0)