1 |
Only warn if utime fails due to the Manifest parent directory |
2 |
being owned by a different user, since it's not a problem |
3 |
unless the repo is being prepared for distribution via rsync. |
4 |
|
5 |
X-Gentoo-bug: 582388 |
6 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=582388 |
7 |
--- |
8 |
pym/portage/manifest.py | 17 ++++++++++++++--- |
9 |
1 file changed, 14 insertions(+), 3 deletions(-) |
10 |
|
11 |
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py |
12 |
index f696f84..fe4166c 100644 |
13 |
--- a/pym/portage/manifest.py |
14 |
+++ b/pym/portage/manifest.py |
15 |
@@ -1,10 +1,11 @@ |
16 |
-# Copyright 1999-2014 Gentoo Foundation |
17 |
+# Copyright 1999-2016 Gentoo Foundation |
18 |
# Distributed under the terms of the GNU General Public License v2 |
19 |
|
20 |
from __future__ import unicode_literals |
21 |
|
22 |
import errno |
23 |
import io |
24 |
+import logging |
25 |
import re |
26 |
import stat |
27 |
import sys |
28 |
@@ -15,7 +16,7 @@ portage.proxy.lazyimport.lazyimport(globals(), |
29 |
'portage.checksum:hashfunc_map,perform_multiple_checksums,' + \ |
30 |
'verify_all,_apply_hash_filter,_filter_unaccelarated_hashes', |
31 |
'portage.repository.config:_find_invalid_path_char', |
32 |
- 'portage.util:write_atomic', |
33 |
+ 'portage.util:write_atomic,writemsg_level', |
34 |
) |
35 |
|
36 |
from portage import os |
37 |
@@ -387,7 +388,17 @@ class Manifest(object): |
38 |
|
39 |
if max_mtime is not None: |
40 |
for path in preserved_stats: |
41 |
- os.utime(path, (max_mtime, max_mtime)) |
42 |
+ try: |
43 |
+ os.utime(path, (max_mtime, max_mtime)) |
44 |
+ except OSError as e: |
45 |
+ # Even though we have write permission, utime fails |
46 |
+ # with EPERM if path is owned by a different user. |
47 |
+ # Only warn in this case, since it's not a problem |
48 |
+ # unless this repo is being prepared for distribution |
49 |
+ # via rsync. |
50 |
+ writemsg_level('!!! utime(\'%s\', (%s, %s)): %s\n' % |
51 |
+ (path, max_mtime, max_mtime, e), |
52 |
+ level=logging.WARNING, noiselevel=-1) |
53 |
|
54 |
def sign(self): |
55 |
""" Sign the Manifest """ |
56 |
-- |
57 |
2.7.4 |