mirror of
https://github.com/lilydjwg/archrepo2.git
synced 2025-03-10 12:02:43 +00:00
filter package filename with regex and some other fixes
This commit is contained in:
parent
c3ec2f419f
commit
81cbd9cbb1
1 changed files with 8 additions and 4 deletions
12
archreposrv
12
archreposrv
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
import configparser
|
import configparser
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import queue
|
import queue
|
||||||
|
@ -17,6 +18,9 @@ import archpkg
|
||||||
from myutils import enable_pretty_logging
|
from myutils import enable_pretty_logging
|
||||||
enable_pretty_logging(logging.DEBUG)
|
enable_pretty_logging(logging.DEBUG)
|
||||||
|
|
||||||
|
# handles only x86_64, i686 and any arch packages
|
||||||
|
_pkgfile_pat = re.compile(r'(?:^|/)[a-z0-9_-]+-[a-z0-9_.]+-\d+-(?:x86_64|i686|any)\.pkg\.tar\.xz$')
|
||||||
|
|
||||||
class ActionInfo(archpkg.PkgNameInfo):
|
class ActionInfo(archpkg.PkgNameInfo):
|
||||||
def __new__(cls, path, action, four=None, five=None):
|
def __new__(cls, path, action, four=None, five=None):
|
||||||
if four is not None:
|
if four is not None:
|
||||||
|
@ -112,8 +116,8 @@ class RepoMan:
|
||||||
actiondict[act.name] = act
|
actiondict[act.name] = act
|
||||||
else:
|
else:
|
||||||
oldact = actiondict[act.name]
|
oldact = actiondict[act.name]
|
||||||
if oldact.pkginfo == act.pkginfo:
|
if oldact == act and oldact.action != act.action:
|
||||||
# same package, 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
|
||||||
|
@ -242,7 +246,7 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
# the file isn't in repo database, ignoring
|
# the file isn't in repo database, ignoring
|
||||||
return
|
return
|
||||||
def callback():
|
def callback():
|
||||||
self._db.execute('delete from pkginfo where pkgfile = ?', (act.path,))
|
self._db.execute('delete from pkginfo where filename = ?', (act.path,))
|
||||||
|
|
||||||
act.callback = callback
|
act.callback = callback
|
||||||
self.repomans[d].add_action(act)
|
self.repomans[d].add_action(act)
|
||||||
|
@ -251,7 +255,7 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
# print(event)
|
# print(event)
|
||||||
|
|
||||||
def filterPkg(event):
|
def filterPkg(event):
|
||||||
return not event.pathname.endswith('.pkg.tar.xz')
|
return not _pkgfile_pat.search(event.pathname)
|
||||||
|
|
||||||
def main(conffile):
|
def main(conffile):
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
|
|
Loading…
Add table
Reference in a new issue