Add replace attribute to Path:

A new build which sets 'replace' for a config file will overwrite the file
installed on the system regardless of its status:

<Path fileType="config" replace="true">/etc/hede.conf</Path>

Tested on a simple install/reinstall, works well.
Should test further with delta updates before applying.
This commit is contained in:
Ozan Çağlayan
2009-10-15 18:17:10 +00:00
parent 94f85db8f1
commit bb92f9ec74
5 changed files with 15 additions and 4 deletions
+1
View File
@@ -117,6 +117,7 @@ suck anyway -->
(executable|library|data|config|doc|man|info|localedata|header) (executable|library|data|config|doc|man|info|localedata|header)
#REQUIRED> #REQUIRED>
<!ATTLIST Path permanent (false|true) #IMPLIED> <!ATTLIST Path permanent (false|true) #IMPLIED>
<!ATTLIST Path replace (false|true) #IMPLIED>
<!-- History Section --> <!-- History Section -->
+8
View File
@@ -1521,6 +1521,14 @@
</choice> </choice>
</attribute> </attribute>
</optional> </optional>
<optional>
<attribute name="replace">
<choice>
<value>false</value>
<value>true</value>
</choice>
</attribute>
</optional>
</group> </group>
</define> </define>
+2 -2
View File
@@ -390,8 +390,8 @@ class Install(AtomicOperation):
Remove.remove_file(old_fileinfo[path], self.pkginfo.name) Remove.remove_file(old_fileinfo[path], self.pkginfo.name)
if self.reinstall(): if self.reinstall():
# get 'config' typed file objects # get 'config' typed file objects if replace is not set
new = filter(lambda x: x.type == 'config', self.files.list) new = filter(lambda x: x.type == 'config' and not x.replace, self.files.list)
old = filter(lambda x: x.type == 'config', self.old_files.list) old = filter(lambda x: x.type == 'config', self.old_files.list)
# get config path lists # get config path lists
+1
View File
@@ -29,6 +29,7 @@ class FileInfo:
t_Mode = [ autoxml.String, autoxml.optional ] t_Mode = [ autoxml.String, autoxml.optional ]
t_Hash = [ autoxml.String, autoxml.optional, "SHA1Sum" ] t_Hash = [ autoxml.String, autoxml.optional, "SHA1Sum" ]
t_Permanent = [ autoxml.String, autoxml.optional ] t_Permanent = [ autoxml.String, autoxml.optional ]
t_Replace = [ autoxml.String, autoxml.optional ]
def __str__(self): def __str__(self):
s = "/%s, type: %s, size: %s, sha1sum: %s" % (self.path, self.type, s = "/%s, type: %s, size: %s, sha1sum: %s" % (self.path, self.type,
+1
View File
@@ -127,6 +127,7 @@ class Path:
s_Path = [autoxml.String, autoxml.mandatory] s_Path = [autoxml.String, autoxml.mandatory]
a_fileType = [autoxml.String, autoxml.optional] a_fileType = [autoxml.String, autoxml.optional]
a_permanent = [autoxml.String, autoxml.optional] a_permanent = [autoxml.String, autoxml.optional]
a_replace = [autoxml.String, autoxml.optional]
def __str__(self): def __str__(self):
s = self.path s = self.path