aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2010-07-02 20:32:08 +0300
committerPriit Laes <plaes@plaes.org>2010-07-02 20:32:08 +0300
commit152e0ef0bf52d2434097ef85f0e6f3ccdac4c0ef (patch)
tree04184fdb91fa52b03eb5360f8c5d35b8d3d3fa3e /utils/grumpy_sync.py
parentHandle updates to the package update file and update settings after sync (diff)
downloadgsoc2010-grumpy-152e0ef0bf52d2434097ef85f0e6f3ccdac4c0ef.tar.gz
gsoc2010-grumpy-152e0ef0bf52d2434097ef85f0e6f3ccdac4c0ef.tar.bz2
gsoc2010-grumpy-152e0ef0bf52d2434097ef85f0e6f3ccdac4c0ef.zip
Added logic for case when new update files appear in portage
Diffstat (limited to 'utils/grumpy_sync.py')
-rwxr-xr-xutils/grumpy_sync.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/utils/grumpy_sync.py b/utils/grumpy_sync.py
index 3a4da26..268778a 100755
--- a/utils/grumpy_sync.py
+++ b/utils/grumpy_sync.py
@@ -58,13 +58,25 @@ def main(path, initial_sync):
if line[0] == 'move' and \
line[1] not in update_data['moves'].keys():
pkg_moves[line[1]] = line[2]
- # Do it after sync has completed successfully...
- #x['moves'] = copy(moves)
- #x['mtime'] = mtime
+ # New updates file has been added
else:
- # New file has appeared..
- print "New file(s) in the list!"
- raise NotImplementedError
+ # First, get the rules from previous update file...
+ # FIXME: Should we check whether file exists?
+ # ...but these files should never disappear...
+ for line in iter_read_bash( \
+ os.path.join(movedir, update_data['file'])):
+ line = line.split()
+ if line[0] == 'move' and \
+ line[1] not in update_data['moves'].keys():
+ pkg_moves[line[1]] = line[2]
+ # Now read moves from newer files
+ # FIXME: What about duplicate keys?
+ # ...common sense says it should not happen...
+ for file in move_files[move_files.index(update_data['file']):]:
+ for line in iter_read_bash(os.path.join(movedir, file)):
+ line = line.split()
+ if line[0] == 'move':
+ pkg_moves[line[1]] = line[2]
def extract_version(pkg, cpv):
"""..."""
@@ -215,7 +227,7 @@ def main(path, initial_sync):
print "DEBUG: package has been moved:", pkg
raise NotImplementedError
else:
- print "DEBUG: package has been (re)moved:", pkg
+ print "DEBUG: package has been removed:", pkg
package = Package.query.filter_by(cat=cat).filter_by(pkg=pkg).one()
session.delete(package)
session.commit()