Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/distroot/
Date: Thu, 29 Aug 2013 12:36:49
Message-Id: 1377779486.dc32952a22c40f03be7f25ba1be425f8faf5dfa7.dywi@gentoo
1 commit: dc32952a22c40f03be7f25ba1be425f8faf5dfa7
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Thu Aug 29 12:31:26 2013 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Thu Aug 29 12:31:26 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=dc32952a
7
8 mirror directory: set_distfile_owner() (TODO)
9
10 method stub for declaring distfile "owners" (=PackageDir objects owning a
11 distfile).
12
13 ---
14 roverlay/overlay/pkgdir/distroot/distroot.py | 40 +++++++++++++++++++++-------
15 1 file changed, 31 insertions(+), 9 deletions(-)
16
17 diff --git a/roverlay/overlay/pkgdir/distroot/distroot.py b/roverlay/overlay/pkgdir/distroot/distroot.py
18 index 650ea15..86a4d76 100644
19 --- a/roverlay/overlay/pkgdir/distroot/distroot.py
20 +++ b/roverlay/overlay/pkgdir/distroot/distroot.py
21 @@ -19,6 +19,7 @@ import tempfile
22 import roverlay.db.distmap
23 import roverlay.overlay.pkgdir.distroot.distdir
24 import roverlay.util.hashpool
25 +import roverlay.util.objects
26
27
28 class DistrootBase ( object ):
29 @@ -91,6 +92,7 @@ class DistrootBase ( object ):
30 self.distmap.write ( force=False )
31 # --- end of finalize (...) ---
32
33 + @roverlay.util.objects.abstractmethod
34 def _add ( self, src, dest ):
35 """Adds src to the distroot.
36
37 @@ -100,8 +102,7 @@ class DistrootBase ( object ):
38 * src --
39 * dest --
40 """
41 - # derived classes have to implement this
42 - raise NotImplementedError()
43 + pass
44 # --- end of _add (...) ---
45
46 def _add_symlink ( self, src, dest, filter_exceptions=False ):
47 @@ -355,6 +356,11 @@ class DistrootBase ( object ):
48 raise Exception ( "check_integrity() needs a distmap." )
49 # --- end of check_integrity (...) ---
50
51 + @roverlay.util.objects.abstractmethod
52 + def set_distfile_owner ( self, backref, distfile ):
53 + pass
54 + # --- end of set_distfile_owner (...) ---
55 +
56 # --- end of DistrootBase ---
57
58
59 @@ -379,6 +385,10 @@ class TemporaryDistroot ( DistrootBase ):
60 shutil.rmtree ( self._root )
61 # --- end of _cleanup (...) ---
62
63 + def set_distfile_owner ( self, *args, **kwargs ):
64 + return True
65 + # --- end of set_distfile_owner (...) ---
66 +
67 # --- end of TemporaryDistroot ---
68
69
70 @@ -440,15 +450,27 @@ class PersistentDistroot ( DistrootBase ):
71 self.USE_COPY : self._add_file,
72 }
73
74 -
75 - if verify and self.distmap is not None:
76 - # expensive task, print a message
77 - print (
78 - "Checking distroot file integrity, this may take some time ... "
79 - )
80 - self.check_integrity()
81 + if self.distmap is not None:
82 + self.set_distfile_owner = self._set_distfile_owner_distmap
83 + if verify:
84 + # expensive task, print a message
85 + print (
86 + "Checking distroot file integrity, this may take some time ... "
87 + )
88 + self.check_integrity()
89 + else:
90 + self.set_distfile_owner = self._set_distfile_owner_nop
91 # --- end of __init__ (...) ---
92
93 + def _set_distfile_owner_nop ( self, backref, distfile ):
94 + return True
95 + # --- end of _set_distfile_owner_nop (...) ---
96 +
97 + @roverlay.util.objects.not_implemented
98 + def _set_distfile_owner_distmap ( self, backref, distfile ):
99 + pass
100 + # --- end of _set_distfile_owner_distmap (...) ---
101 +
102 def _add ( self, src, dest ):
103 # race condition when accessing self._supported_modes
104 # * this can result in repeated log messages