diff --git a/patches/add-replace-attribute-to-path-element.patch b/patches/add-replace-attribute-to-path-element.patch new file mode 100644 index 00000000..b4fe8f2a --- /dev/null +++ b/patches/add-replace-attribute-to-path-element.patch @@ -0,0 +1,105 @@ +Index: pisi-spec.rng +=================================================================== +--- pisi-spec.rng (revision 25920) ++++ pisi-spec.rng (revision 25922) +@@ -1521,6 +1521,14 @@ + + + ++ ++ ++ ++ false ++ true ++ ++ ++ + + + +Index: pisi/specfile.py +=================================================================== +--- pisi/specfile.py (revision 25920) ++++ pisi/specfile.py (revision 25922) +@@ -127,6 +127,7 @@ + s_Path = [autoxml.String, autoxml.mandatory] + a_fileType = [autoxml.String, autoxml.optional] + a_permanent = [autoxml.String, autoxml.optional] ++ a_replace = [autoxml.String, autoxml.optional] + + def __str__(self): + s = self.path +Index: pisi/operations/delta.py +=================================================================== +--- pisi/operations/delta.py (revision 25920) ++++ pisi/operations/delta.py (revision 25922) +@@ -106,8 +106,11 @@ + + files_new = set(map(lambda x:x.hash, newfiles.list)) + files_old = set(map(lambda x:x.hash, oldfiles.list)) +- files_delta = files_new - files_old ++ files_delta = list(files_new - files_old) + ++ # Add to-be-replaced config files to delta package regardless of its state ++ files_delta.extend([f.hash for f in newfiles.list if f.type=='config' and f.replace]) ++ + deltas = [] + for h in files_delta: + deltas.extend(hashto_files[h]) +Index: pisi/files.py +=================================================================== +--- pisi/files.py (revision 25920) ++++ pisi/files.py (revision 25922) +@@ -29,6 +29,7 @@ + t_Mode = [ autoxml.String, autoxml.optional ] + t_Hash = [ autoxml.String, autoxml.optional, "SHA1Sum" ] + t_Permanent = [ autoxml.String, autoxml.optional ] ++ t_Replace = [ autoxml.String, autoxml.optional ] + + def __str__(self): + s = "/%s, type: %s, size: %s, sha1sum: %s" % (self.path, self.type, +Index: pisi/atomicoperations.py +=================================================================== +--- pisi/atomicoperations.py (revision 25920) ++++ pisi/atomicoperations.py (revision 25922) +@@ -204,7 +204,7 @@ + return True + + return not pkg in map(lambda x:x.package, self.pkginfo.conflicts) +- ++ + # check file conflicts + file_conflicts = [] + for f in self.files.list: +@@ -390,8 +390,8 @@ + Remove.remove_file(old_fileinfo[path], self.pkginfo.name) + + if self.reinstall(): +- # get 'config' typed file objects +- new = filter(lambda x: x.type == 'config', self.files.list) ++ # get 'config' typed file objects if replace is not set ++ 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) + + # get config path lists +@@ -530,7 +530,7 @@ + + if fileinfo.permanent and not remove_permanent: + return +- ++ + fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path) + + historydb = pisi.db.historydb.HistoryDB() +Index: pisi-spec.dtd +=================================================================== +--- pisi-spec.dtd (revision 25920) ++++ pisi-spec.dtd (revision 25922) +@@ -117,6 +117,7 @@ + (executable|library|data|config|doc|man|info|localedata|header) + #REQUIRED> + ++ + + + diff --git a/pisi-spec.dtd b/pisi-spec.dtd index cd54f52d..9dd53354 100644 --- a/pisi-spec.dtd +++ b/pisi-spec.dtd @@ -117,7 +117,6 @@ suck anyway --> (executable|library|data|config|doc|man|info|localedata|header) #REQUIRED> - diff --git a/pisi-spec.rng b/pisi-spec.rng index eb09c011..85c17d96 100644 --- a/pisi-spec.rng +++ b/pisi-spec.rng @@ -1521,14 +1521,6 @@ - - - - false - true - - - diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index 970bdc08..0d5c2316 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -204,7 +204,7 @@ class Install(AtomicOperation): return True return not pkg in map(lambda x:x.package, self.pkginfo.conflicts) - + # check file conflicts file_conflicts = [] for f in self.files.list: @@ -390,8 +390,8 @@ class Install(AtomicOperation): Remove.remove_file(old_fileinfo[path], self.pkginfo.name) if self.reinstall(): - # get 'config' typed file objects if replace is not set - new = filter(lambda x: x.type == 'config' and not x.replace, self.files.list) + # get 'config' typed file objects + new = filter(lambda x: x.type == 'config', self.files.list) old = filter(lambda x: x.type == 'config', self.old_files.list) # get config path lists @@ -530,7 +530,7 @@ class Remove(AtomicOperation): if fileinfo.permanent and not remove_permanent: return - + fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path) historydb = pisi.db.historydb.HistoryDB() diff --git a/pisi/files.py b/pisi/files.py index 93bee71d..67560e3a 100644 --- a/pisi/files.py +++ b/pisi/files.py @@ -29,7 +29,6 @@ class FileInfo: t_Mode = [ autoxml.String, autoxml.optional ] t_Hash = [ autoxml.String, autoxml.optional, "SHA1Sum" ] t_Permanent = [ autoxml.String, autoxml.optional ] - t_Replace = [ autoxml.String, autoxml.optional ] def __str__(self): s = "/%s, type: %s, size: %s, sha1sum: %s" % (self.path, self.type, diff --git a/pisi/operations/delta.py b/pisi/operations/delta.py index 268e8933..c6dc98e4 100644 --- a/pisi/operations/delta.py +++ b/pisi/operations/delta.py @@ -106,10 +106,7 @@ def find_delta(oldfiles, newfiles): files_new = set(map(lambda x:x.hash, newfiles.list)) files_old = set(map(lambda x:x.hash, oldfiles.list)) - files_delta = list(files_new - files_old) - - # Add to-be-replaced config files to delta package regardless of its state - files_delta.extend([f.hash for f in newfiles.list if f.type=='config' and f.replace]) + files_delta = files_new - files_old deltas = [] for h in files_delta: diff --git a/pisi/specfile.py b/pisi/specfile.py index 82ba920b..94a4315f 100644 --- a/pisi/specfile.py +++ b/pisi/specfile.py @@ -127,7 +127,6 @@ class Path: s_Path = [autoxml.String, autoxml.mandatory] a_fileType = [autoxml.String, autoxml.optional] a_permanent = [autoxml.String, autoxml.optional] - a_replace = [autoxml.String, autoxml.optional] def __str__(self): s = self.path