setup.py and directory structure change

and README switched to rst
This commit is contained in:
lilydjwg 2013-08-23 12:19:53 +08:00
parent 1f206e12d4
commit 051427c7b1
12 changed files with 122 additions and 41 deletions

View file

@ -1,25 +0,0 @@
USAGE
====
Edit a copy of `archrepo.ini` and then run `./archreposrv <config>`.
DEPENDENCIES
====
* Python, &gt;= 3.3, with sqlite support
* distribute
* tornado, > 2.4.1
* pyinotify, tested with 0.9.4
* winterpy (add `pylib` to `$PYTHONPATH`)
NOTE
====
* relative symlinks may be broken when moving to the right architecture directory
TODO
====
* [high] adding and then removing it before adding complete will result in not-in-database removing
* [high] remove winterpy dependency
* [middle] `setup.py` support
* [middle] disable "any" architecture via config
* [low] use one common command queue (now one each repo)
* [low] verify packages

36
README.rst Normal file
View file

@ -0,0 +1,36 @@
USAGE
=====
Install::
python3 setup.py install
Edit a copy of ``archrepo.ini.example`` and then run
``archreposrv <config>``.
DEPENDENCIES
============
- Python, >= 3.3, with sqlite support
- distribute
- tornado, > 2.4.1
- pyinotify, tested with 0.9.4
- winterpy (add ``pylib`` to ``$PYTHONPATH``)
NOTE
====
- relative symlinks may be broken when moving to the right architecture
directory
TODO
====
- [high] adding and then removing it before adding complete will result
in not-in-database removing
- [high] remove winterpy dependency
- [middle] disable "any" architecture via config
- [low] fork to background
- [low] use one common command queue (now one each repo)
- [low] verify packages

46
archrepo.ini Normal file
View file

@ -0,0 +1,46 @@
[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
# You can specify a "info-db" here to have them all in the same repo
#info-db: /home/lilydjwg/tmpfs/test/pkginfo.db
[repository]
# Name of the repository. In below example the Pacman repository db file name
# will be archlinuxcn.db.tar.gz
name: archlinuxcn
# Path to the repository - directory should normally contain any, i686 and
# x86_64. The server will monitor files in it with inotify. If you have lots of
# files in this directory, remember to update the configuration of inotify.
path: /home/lilydjwg/tmpfs/test
# A database to store package info. Default to ${path}/pkginfo.db
#info-db: /home/lilydjwg/tmpfs/test/pkginfo.db
# Specify where to find these commands
#command-add: repo-add
#command-remove: repo-remove
# By enabling auto-rename, the server will automatically rename the package
# files according to .PKGINFO, and move them under the correct architecture
# directory. Default is on.
#auto-rename: on
# Seconds before actually running the command. 10s by default.
#wait-time: 10
wait-time: 3
# Notification type to use when done. Currently available: simple-udp, null
notification-type: simple-udp
notification-address: 127.0.0.1:9900
notification-secret: JiUHuGY987G76djItfOskOj
# If for any reason, you don't want actual database creation or update:
#without-db: true
# vim: se ft=dosini:

3
archrepo2/__init__.py Normal file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env python3
__version__ = '0.3.1'

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
import sys
import configparser
@ -10,7 +9,9 @@ from tornado.ioloop import IOLoop
from myutils import enable_pretty_logging
enable_pretty_logging(logging.DEBUG)
from repomon import repomon
from .repomon import repomon
logger = logging.getLogger(__name__)
def check_and_get_repos(config):
repos = config['multi'].get('repos', 'repository')
@ -26,7 +27,8 @@ def check_and_get_repos(config):
return repos
def main(conffile):
def main():
conffile = sys.argv[1]
config = configparser.ConfigParser(default_section='multi')
config.read(conffile)
repos = check_and_get_repos(config)
@ -34,12 +36,14 @@ def main(conffile):
notifiers = [repomon(config[repo]) for repo in repos]
ioloop = IOLoop.instance()
logger.info('starting archreposrv.')
try:
ioloop.start()
except KeyboardInterrupt:
ioloop.close()
for notifier in notifiers:
notifier.stop()
print()
if __name__ == '__main__':
main(sys.argv[1])
main()

View file

@ -20,8 +20,8 @@ from tornado.ioloop import IOLoop
import tornado.process
import archpkg
import pkgreader
import dbutil
from . import pkgreader
from . import dbutil
logger = logging.getLogger(__name__)

View file

@ -4,7 +4,7 @@
from subprocess import getoutput
allpkgs = getoutput(r"locate -be --regex '\.pkg\.tar\.xz$'").split('\n')
from pkgreader import readpkg
from archrepo2.pkgreader import readpkg
for p in allpkgs:
print('reading package:', p)
d = readpkg(p)

View file

@ -10,11 +10,8 @@ import logging
from myutils import enable_pretty_logging
enable_pretty_logging(logging.DEBUG)
top_dir = os.path.normpath(os.path.join(__file__, '../..'))
sys.path.append(top_dir)
import pkgreader
from dbutil import *
import archrepo2.pkgreader
from archrepo2.dbutil import *
def main(conffile):
config = configparser.ConfigParser()

View file

@ -9,10 +9,7 @@ import logging
from myutils import enable_pretty_logging
enable_pretty_logging(logging.DEBUG)
top_dir = os.path.normpath(os.path.join(__file__, '../..'))
sys.path.append(top_dir)
from dbutil import *
from archrepo2.dbutil import *
def main(dbname, reponame):
db = sqlite3.connect(dbname, isolation_level=None)

23
setup.py Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env python3
from setuptools import setup, find_packages
import archrepo2
setup(
name = 'archrepo2',
version = archrepo2.__version__,
packages = find_packages(),
install_requires = ['tornado>2.4.1', 'pyinotify'],
entry_points = {
'console_scripts': [
'archreposrv = archrepo2.archreposrv:main',
],
},
author = 'lilydjwg',
author_email = 'lilydjwg@gmail.com',
description = 'Arch Linux repository manager',
license = 'MIT',
keywords = 'archlinux linux',
url = 'https://github.com/lilydjwg/archrepo2',
)