]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blob - pakfire/patches/0008-Fixes-for-removing-files-and-configfiles.patch
Merge remote-tracking branch 'arne_f/autoconf'
[people/arne_f/ipfire-3.x.git] / pakfire / patches / 0008-Fixes-for-removing-files-and-configfiles.patch
1 From d38612fe50395a35d6fdc0774d56c7c2ddc58cf7 Mon Sep 17 00:00:00 2001
2 From: Michael Tremer <michael.tremer@ipfire.org>
3 Date: Sun, 22 Apr 2012 14:48:10 +0200
4 Subject: [PATCH 8/8] Fixes for removing files (and configfiles).
5
6 There were some problems when the user removed those
7 files earlier.
8 ---
9 python/pakfire/packages/base.py | 12 ++++++++++++
10 1 files changed, 12 insertions(+), 0 deletions(-)
11
12 diff --git a/python/pakfire/packages/base.py b/python/pakfire/packages/base.py
13 index e27c3f7..9162536 100644
14 --- a/python/pakfire/packages/base.py
15 +++ b/python/pakfire/packages/base.py
16 @@ -516,6 +516,12 @@ class Package(object):
17
18 # Rename configuration files.
19 if _file.is_config():
20 + # Skip already removed config files.
21 + try:
22 + os.lstat(file)
23 + except OSError:
24 + continue
25 +
26 file_save = "%s%s" % (file, CONFIG_FILE_SUFFIX_SAVE)
27
28 try:
29 @@ -530,6 +536,7 @@ class Package(object):
30
31 # Handle regular files and symlinks.
32 if os.path.isfile(file) or os.path.islink(file):
33 + log.debug("Removing %s..." % _file)
34 try:
35 os.remove(file)
36 except OSError:
37 @@ -545,6 +552,11 @@ class Package(object):
38 except OSError:
39 pass
40
41 + # Handle files that have already been removed
42 + # by somebody else.
43 + elif not os.path.exists(file):
44 + pass
45 +
46 # Log all unhandled types.
47 else:
48 log.warning("Cannot remove file: %s. Filetype is unhandled." % file)
49 --
50 1.7.7.6
51