Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: man/, pym/portage/dbapi/, pym/portage/
Date: Sat, 24 Dec 2011 11:17:50
Message-Id: 770bb7ae204643be1968f0fd0379706b6ce017c0.zmedico@gentoo
1 commit: 770bb7ae204643be1968f0fd0379706b6ce017c0
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 24 11:17:26 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 24 11:17:26 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=770bb7ae
7
8 Add FEATURES=config-protect-if-modified support.
9
10 This causes the CONFIG_PROTECT behavior to be skipped for files
11 that have not been modified since they were installed.
12
13 ---
14 man/make.conf.5 | 4 ++++
15 pym/portage/const.py | 1 +
16 pym/portage/dbapi/vartree.py | 15 ++++++++++++++-
17 3 files changed, 19 insertions(+), 1 deletions(-)
18
19 diff --git a/man/make.conf.5 b/man/make.conf.5
20 index 8a66c21..33f4e45 100644
21 --- a/man/make.conf.5
22 +++ b/man/make.conf.5
23 @@ -260,6 +260,10 @@ Log file names have an extension that is appropriate for the compression
24 type. Currently, only \fBgzip\fR(1) compression is supported, so build
25 logs will have a '.gz' extension when this feature is enabled.
26 .TP
27 +.B config\-protect\-if\-modified
28 +This causes the \fBCONFIG_PROTECT\fR behavior to be skipped for files
29 +that have not been modified since they were installed.
30 +.TP
31 .B digest
32 Autogenerate digests for packages when running the
33 \fBemerge\fR(1), \fBebuild\fR(1), or \fBrepoman\fR(1) commands. If
34
35 diff --git a/pym/portage/const.py b/pym/portage/const.py
36 index 77c68eb..5fcb24f 100644
37 --- a/pym/portage/const.py
38 +++ b/pym/portage/const.py
39 @@ -89,6 +89,7 @@ SUPPORTED_FEATURES = frozenset([
40 "assume-digests", "binpkg-logs", "buildpkg", "buildsyspkg", "candy",
41 "ccache", "chflags", "clean-logs",
42 "collision-protect", "compress-build-logs",
43 + "config-protect-if-modified",
44 "digest", "distcc", "distcc-pump", "distlocks", "ebuild-locks", "fakeroot",
45 "fail-clean", "force-mirror", "force-prefix", "getbinpkg",
46 "installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror",
47
48 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
49 index b9ef583..a66316b 100644
50 --- a/pym/portage/dbapi/vartree.py
51 +++ b/pym/portage/dbapi/vartree.py
52 @@ -4056,6 +4056,10 @@ class dblink(object):
53 destroot = normalize_path(destroot).rstrip(sep) + sep
54 calc_prelink = "prelink-checksums" in self.settings.features
55
56 + protect_if_modified = \
57 + "config-protect-if-modified" in self.settings.features and \
58 + self._installed_instance is not None
59 +
60 # this is supposed to merge a list of files. There will be 2 forms of argument passing.
61 if isinstance(stufftomerge, basestring):
62 #A directory is specified. Figure out protection paths, listdir() it and process it.
63 @@ -4297,9 +4301,18 @@ class dblink(object):
64 # now, config file management may come into play.
65 # we only need to tweak mydest if cfg file management is in play.
66 if protected:
67 + destmd5 = perform_md5(mydest, calc_prelink=calc_prelink)
68 + if protect_if_modified:
69 + contents_key = \
70 + self._installed_instance._match_contents(myrealdest)
71 + if contents_key:
72 + inst_info = self._installed_instance.getcontents()[contents_key]
73 + if inst_info[0] == "obj" and inst_info[2] == destmd5:
74 + protected = False
75 +
76 + if protected:
77 # we have a protection path; enable config file management.
78 cfgprot = 0
79 - destmd5 = perform_md5(mydest, calc_prelink=calc_prelink)
80 if mymd5 == destmd5:
81 #file already in place; simply update mtimes of destination
82 moveme = 1