mirror of
https://github.com/lilydjwg/archrepo2.git
synced 2025-03-10 12:02:43 +00:00
add multiple repositories support
This commit is contained in:
parent
dd26517106
commit
c1fd025c82
2 changed files with 14 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
[multi]
|
||||||
|
# Names of repository config sections, if you have multiple repositories.
|
||||||
|
# The names should be delimited by commas. And this value is default to
|
||||||
|
# "repository".
|
||||||
|
# config names are the same as below, and will act as default if not specified
|
||||||
|
# in that repository config.
|
||||||
|
repos: repository
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
# Name of the repository. In below example the Pacman repository db file name
|
# Name of the repository. In below example the Pacman repository db file name
|
||||||
# will be archlinuxcn.db.tar.gz
|
# will be archlinuxcn.db.tar.gz
|
||||||
|
|
|
@ -13,17 +13,20 @@ enable_pretty_logging(logging.DEBUG)
|
||||||
from repomon import repomon
|
from repomon import repomon
|
||||||
|
|
||||||
def main(conffile):
|
def main(conffile):
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser(default_section='multi')
|
||||||
config.read(conffile)
|
config.read(conffile)
|
||||||
|
|
||||||
notifier = repomon(config['repository'])
|
repos = config['multi'].get('repos', 'repository')
|
||||||
|
repos = [repo.strip() for repo in repos.split(',')]
|
||||||
|
notifiers = [repomon(config[repo]) for repo in repos]
|
||||||
|
|
||||||
ioloop = IOLoop.instance()
|
ioloop = IOLoop.instance()
|
||||||
try:
|
try:
|
||||||
ioloop.start()
|
ioloop.start()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
ioloop.close()
|
ioloop.close()
|
||||||
notifier.stop()
|
for notifier in notifiers:
|
||||||
|
notifier.stop()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(sys.argv[1])
|
main(sys.argv[1])
|
||||||
|
|
Loading…
Add table
Reference in a new issue