From 9b1e61c9d87ed00e4bf20f4590dc641224f7d2e8 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Sun, 12 Jan 2014 22:04:14 +0800 Subject: [PATCH] if a .sig file changes, the coressponding package should be re-added --- archrepo2/repomon.py | 12 ++++++++++-- setup.py | 0 2 files changed, 10 insertions(+), 2 deletions(-) mode change 100644 => 100755 setup.py diff --git a/archrepo2/repomon.py b/archrepo2/repomon.py index 410f424..61d15bc 100755 --- a/archrepo2/repomon.py +++ b/archrepo2/repomon.py @@ -302,7 +302,7 @@ class EventHandler(pyinotify.ProcessEvent): def dispatch(self, path, action): if path.endswith('.sig'): act = ActionInfo(path, action, pkgpath=path[:-4]) - callback = self._record_signatures + callback = self._signature_changed else: act = ActionInfo(path, action) callback = self._real_dispatch @@ -390,10 +390,18 @@ class EventHandler(pyinotify.ProcessEvent): act.callback = callback self.repomans[d].add_action(act) - def _record_signatures(self, d, action): + def _signature_changed(self, d, action): path = action.path action = action.action logger.info('%s signature %s.', action, path) + + # Touch the pacakge file so that we'll repo-add it again to include the + # sig change later. + pkg = path[:-4] + if os.path.exists(pkg): + logger.info('touching %s.', pkg) + os.close(os.open(pkg, os.O_WRONLY)) + if action == 'add': self._db.execute('''insert or replace into sigfiles (filename, pkgrepo) values (?, ?)''', diff --git a/setup.py b/setup.py old mode 100644 new mode 100755