mirror of
https://github.com/lilydjwg/archrepo2.git
synced 2025-03-10 12:02:43 +00:00
auto-rename and symlink-any can be turned off now
This commit is contained in:
parent
da2e89df66
commit
4070b63315
3 changed files with 17 additions and 4 deletions
|
@ -28,6 +28,7 @@ TODO
|
||||||
- [high] adding and then removing it before adding complete will result
|
- [high] adding and then removing it before adding complete will result
|
||||||
in not-in-database removing
|
in not-in-database removing
|
||||||
- [middle] disable "any" architecture via config
|
- [middle] disable "any" architecture via config
|
||||||
|
- [middle] some attributes should be set on the EventHandler
|
||||||
- [low] fork to background
|
- [low] fork to background
|
||||||
- [low] use one common command queue (now one each repo)
|
- [low] use one common command queue (now one each repo)
|
||||||
- [low] verify packages
|
- [low] verify packages
|
||||||
|
|
|
@ -27,10 +27,15 @@ path: /home/lilydjwg/tmpfs/test
|
||||||
#command-remove: repo-remove
|
#command-remove: repo-remove
|
||||||
|
|
||||||
# By enabling auto-rename, the server will automatically rename the package
|
# By enabling auto-rename, the server will automatically rename the package
|
||||||
# files according to .PKGINFO, and move them under the correct architecture
|
# files according to filenames, and move them under the correct architecture
|
||||||
# directory. Default is on.
|
# directory. Default is on.
|
||||||
#auto-rename: on
|
#auto-rename: on
|
||||||
|
|
||||||
|
# By enabling symlink-any, the server will automatically symlink the package
|
||||||
|
# files of 'any' architecture to 'i686' and 'x86_64'
|
||||||
|
# Default is on.
|
||||||
|
#symlink-any: on
|
||||||
|
|
||||||
# Seconds before actually running the command. 10s by default.
|
# Seconds before actually running the command. 10s by default.
|
||||||
#wait-time: 10
|
#wait-time: 10
|
||||||
wait-time: 3
|
wait-time: 3
|
||||||
|
|
|
@ -59,6 +59,8 @@ class RepoMan:
|
||||||
self._command_remove = config.get('command-remove', 'repo-remove')
|
self._command_remove = config.get('command-remove', 'repo-remove')
|
||||||
self._wait_time = config.getint('wait-time', 10)
|
self._wait_time = config.getint('wait-time', 10)
|
||||||
self._without_db = config.getboolean('without-db', False)
|
self._without_db = config.getboolean('without-db', False)
|
||||||
|
self._auto_rename = config.getboolean('auto-rename', True)
|
||||||
|
self._symlink_any = config.getboolean('symlink-any', True)
|
||||||
|
|
||||||
notification_type = config.get('notification-type', 'null')
|
notification_type = config.get('notification-type', 'null')
|
||||||
if notification_type != 'null':
|
if notification_type != 'null':
|
||||||
|
@ -235,6 +237,8 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
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
|
||||||
|
self._auto_rename = self.repomans[d]._auto_rename
|
||||||
|
self._symlink_any = self.repomans[d]._symlink_any
|
||||||
|
|
||||||
self._initial_update(files)
|
self._initial_update(files)
|
||||||
|
|
||||||
|
@ -306,7 +310,7 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
base, arch = os.path.split(d)
|
base, arch = os.path.split(d)
|
||||||
|
|
||||||
# rename if a packager has added to a wrong directory
|
# rename if a packager has added to a wrong directory
|
||||||
if action == 'add' and act.arch != arch:
|
if self._auto_rename and action == 'add' and act.arch != arch:
|
||||||
newd = os.path.join(base, act.arch)
|
newd = os.path.join(base, act.arch)
|
||||||
newpath = os.path.join(newd, file)
|
newpath = os.path.join(newd, file)
|
||||||
os.rename(path, newpath)
|
os.rename(path, newpath)
|
||||||
|
@ -316,8 +320,11 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
arch = act.arch
|
arch = act.arch
|
||||||
d = newd
|
d = newd
|
||||||
|
|
||||||
if arch == 'any':
|
if self._symlink_any and act.arch == 'any':
|
||||||
for newarch in ('i686', 'x86_64'):
|
for newarch in ('i686', 'x86_64', 'any'):
|
||||||
|
if newarch == arch:
|
||||||
|
# this file itself
|
||||||
|
continue
|
||||||
newd = os.path.join(base, newarch)
|
newd = os.path.join(base, newarch)
|
||||||
newpath = os.path.join(newd, file)
|
newpath = os.path.join(newd, file)
|
||||||
if action == 'add':
|
if action == 'add':
|
||||||
|
|
Loading…
Add table
Reference in a new issue