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 sys
|
||||
import re
|
||||
import configparser
|
||||
from functools import partial
|
||||
import queue
|
||||
|
@ -17,6 +18,9 @@ import archpkg
|
|||
from myutils import enable_pretty_logging
|
||||
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):
|
||||
def __new__(cls, path, action, four=None, five=None):
|
||||
if four is not None:
|
||||
|
@ -112,8 +116,8 @@ class RepoMan:
|
|||
actiondict[act.name] = act
|
||||
else:
|
||||
oldact = actiondict[act.name]
|
||||
if oldact.pkginfo == act.pkginfo:
|
||||
# same package, do nothing
|
||||
if oldact == act and oldact.action != act.action:
|
||||
# same package, opposite actions, do nothing
|
||||
del actiondict[act.name]
|
||||
else:
|
||||
# take the later action
|
||||
|
@ -242,7 +246,7 @@ class EventHandler(pyinotify.ProcessEvent):
|
|||
# the file isn't in repo database, ignoring
|
||||
return
|
||||
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
|
||||
self.repomans[d].add_action(act)
|
||||
|
@ -251,7 +255,7 @@ class EventHandler(pyinotify.ProcessEvent):
|
|||
# print(event)
|
||||
|
||||
def filterPkg(event):
|
||||
return not event.pathname.endswith('.pkg.tar.xz')
|
||||
return not _pkgfile_pat.search(event.pathname)
|
||||
|
||||
def main(conffile):
|
||||
config = configparser.ConfigParser()
|
||||
|
|
Loading…
Add table
Reference in a new issue