Kaydet (Commit) bb92f9ec authored tarafından Ozan Çağlayan's avatar Ozan Çağlayan

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.
üst 94f85db8
...@@ -117,6 +117,7 @@ suck anyway --> ...@@ -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 -->
......
...@@ -1521,6 +1521,14 @@ ...@@ -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>
......
...@@ -204,7 +204,7 @@ class Install(AtomicOperation): ...@@ -204,7 +204,7 @@ class Install(AtomicOperation):
return True return True
return not pkg in map(lambda x:x.package, self.pkginfo.conflicts) return not pkg in map(lambda x:x.package, self.pkginfo.conflicts)
# check file conflicts # check file conflicts
file_conflicts = [] file_conflicts = []
for f in self.files.list: for f in self.files.list:
...@@ -390,8 +390,8 @@ class Install(AtomicOperation): ...@@ -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
...@@ -530,7 +530,7 @@ class Remove(AtomicOperation): ...@@ -530,7 +530,7 @@ class Remove(AtomicOperation):
if fileinfo.permanent and not remove_permanent: if fileinfo.permanent and not remove_permanent:
return return
fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path) fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path)
historydb = pisi.db.historydb.HistoryDB() historydb = pisi.db.historydb.HistoryDB()
......
...@@ -29,6 +29,7 @@ class FileInfo: ...@@ -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,
......
...@@ -127,6 +127,7 @@ class Path: ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment