Merge branch 'dev' of github.com:lilydjwg/archrepo2 into dev

This commit is contained in:
lilydjwg 2014-01-12 22:05:18 +08:00
commit 241f9e7eb9
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,3 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
__version__ = '0.3.2' __version__ = '0.3.3dev'

View file

@ -26,7 +26,7 @@ from . import dbutil
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# handles only x86_64, i686 and any arch packages # handles only x86_64, i686 and any arch packages
_pkgfile_pat = re.compile(r'(?:^|/)[a-z0-9_+-]+-[^-]+-\d+-(?:x86_64|i686|any)\.pkg\.tar\.xz(?:\.sig)?$') _pkgfile_pat = re.compile(r'(?:^|/).+-[^-]+-\d+-(?:x86_64|i686|any)\.pkg\.tar\.xz(?:\.sig)?$')
class ActionInfo(archpkg.PkgNameInfo): class ActionInfo(archpkg.PkgNameInfo):
def __new__(cls, path, action, four=None, five=None, pkgpath=None): def __new__(cls, path, action, four=None, five=None, pkgpath=None):
@ -194,7 +194,10 @@ class RepoMan:
del actiondict[act.name] del actiondict[act.name]
else: else:
# take the later action, but record the former # take the later action, but record the former
try:
actiondict[act.name].callback(state=0) actiondict[act.name].callback(state=0)
except:
logger.exception('failed to run action %r.', actiondict[act.name])
actiondict[act.name] = act actiondict[act.name] = act
toadd = [(x.path, x.callback) for x in actiondict.values() if x.action == 'add'] toadd = [(x.path, x.callback) for x in actiondict.values() if x.action == 'add']
toremove = [(x.name, x.callback) for x in actiondict.values() if x.action == 'remove'] toremove = [(x.name, x.callback) for x in actiondict.values() if x.action == 'remove']
@ -234,7 +237,10 @@ class EventHandler(pyinotify.ProcessEvent):
dirs = [os.path.join(base, x) for x in ('any', 'i686', 'x86_64')] dirs = [os.path.join(base, x) for x in ('any', 'i686', 'x86_64')]
self.files = files = set() self.files = files = set()
for d in dirs: for d in dirs:
files.update(os.path.join(d, f) for f in os.listdir(d)) for f in os.listdir(d):
p = os.path.join(d, f)
if os.path.exists(p): # filter broken symlinks
files.add(p)
wm.add_watch(d, pyinotify.ALL_EVENTS) wm.add_watch(d, pyinotify.ALL_EVENTS)
self.repomans[d] = RepoMan(config, d, self._ioloop) self.repomans[d] = RepoMan(config, d, self._ioloop)
self.name = self.repomans[d].name self.name = self.repomans[d].name
@ -372,6 +378,7 @@ class EventHandler(pyinotify.ProcessEvent):
(filename, pkgrepo, pkgname, pkgarch, pkgver, forarch, state, owner, mtime, info) values (filename, pkgrepo, pkgname, pkgarch, pkgver, forarch, state, owner, mtime, info) values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''', (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
(act.path, self.name, act.name, act.arch, act.fullversion, arch, state, owner, mtime, info)) (act.path, self.name, act.name, act.arch, act.fullversion, arch, state, owner, mtime, info))
logger.info('Action %r done.', act)
else: else:
res = self._db.execute( res = self._db.execute(