mirror of
https://github.com/lilydjwg/archrepo2.git
synced 2025-03-10 12:02:43 +00:00
add all new files to the info database when starting
This commit is contained in:
parent
5cf869439a
commit
71d00a73b5
1 changed files with 4 additions and 3 deletions
|
@ -193,7 +193,8 @@ class RepoMan:
|
||||||
# same package, opposite actions, do nothing
|
# same package, opposite actions, do nothing
|
||||||
del actiondict[act.name]
|
del actiondict[act.name]
|
||||||
else:
|
else:
|
||||||
# take the later action
|
# take the later action, but record the former
|
||||||
|
actiondict[act.name].callback(state=0)
|
||||||
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']
|
||||||
|
@ -347,7 +348,7 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
def _real_dispatch(self, d, act):
|
def _real_dispatch(self, d, act):
|
||||||
if act.action == 'add':
|
if act.action == 'add':
|
||||||
arch = os.path.split(d)[1]
|
arch = os.path.split(d)[1]
|
||||||
def callback():
|
def callback(state=1):
|
||||||
self._db.execute(
|
self._db.execute(
|
||||||
'update pkginfo set state = 0 where pkgname = ? and forarch = ? and pkgrepo = ?',
|
'update pkginfo set state = 0 where pkgname = ? and forarch = ? and pkgrepo = ?',
|
||||||
(act.name, arch, self.name)
|
(act.name, arch, self.name)
|
||||||
|
@ -370,7 +371,7 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
'''insert or replace into pkginfo
|
'''insert or replace into pkginfo
|
||||||
(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, 1, owner, mtime, info))
|
(act.path, self.name, act.name, act.arch, act.fullversion, arch, state, owner, mtime, info))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
res = self._db.execute(
|
res = self._db.execute(
|
||||||
|
|
Loading…
Add table
Reference in a new issue