main.cfg: use a REPOS configuration structure to provide different paths and dbnames
This commit is contained in:
parent
c9c45aa9ae
commit
52ffaab7e4
@ -31,9 +31,10 @@ def _cursorRowToDict(cursor, row):
|
|||||||
|
|
||||||
def latest():
|
def latest():
|
||||||
response = {}
|
response = {}
|
||||||
for repo in app.config['SEARCH_REPOS']:
|
for repo in app.config['REPOS']:
|
||||||
response[repo] = []
|
response[repo] = []
|
||||||
REPO_SOURCES_DB = "file:" + app.config['REPO_BASEDIR'] + f"{repo}-sources.db?mode=ro"
|
REPO_SOURCES_DB = "file:" + app.config['REPOS'][repo]['path'] + f"{app.config['REPOS'][repo]['dbname']}-sources.db?mode=ro"
|
||||||
|
logger.info(REPO_SOURCES_DB)
|
||||||
conn = sqlite3.connect(REPO_SOURCES_DB, uri=True)
|
conn = sqlite3.connect(REPO_SOURCES_DB, uri=True)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
@ -48,9 +49,9 @@ def query(qs):
|
|||||||
logger.info(f"Query of {qs}")
|
logger.info(f"Query of {qs}")
|
||||||
|
|
||||||
response = {}
|
response = {}
|
||||||
for repo in app.config['SEARCH_REPOS']:
|
for repo in app.config['REPOS']:
|
||||||
response[repo] = []
|
response[repo] = []
|
||||||
REPO_SOURCES_DB = "file:" + app.config['REPO_BASEDIR'] + f"{repo}-sources.db?mode=ro"
|
REPO_SOURCES_DB = "file:" + app.config['REPOS'][repo]['path'] + f"{app.config['REPOS'][repo]['dbname']}-sources.db?mode=ro"
|
||||||
conn = sqlite3.connect(REPO_SOURCES_DB, uri=True)
|
conn = sqlite3.connect(REPO_SOURCES_DB, uri=True)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#
|
#
|
||||||
# WebDist main configuration file
|
# WebDist main configuration file
|
||||||
#
|
#
|
||||||
REPO_BASEDIR = "/var/webbuild/db/"
|
REPOS = {
|
||||||
SEARCH_REPOS = [ 'devel', 'devel-makedist', 'devel-autodist' ]
|
'openmamba-rolling': { 'dbname': 'devel', 'path': '/var/autodist/db/' },
|
||||||
|
'openmamba-testing': { 'dbname': 'devel-makedist', 'path': '/var/autodist/db/' },
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user