commit a65bc1a1278ab494eabcfeaa57d7ae7d9b49cd84
parent ae99aa1f36da29f6b0388e540e227a19e3363ea3
Author: parazyd <parazyd@dyne.org>
Date: Fri, 7 Jul 2017 00:35:59 +0200
implement a module to hold global states
Diffstat:
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/amprolla_merge.py b/amprolla_merge.py
@@ -10,6 +10,7 @@ from multiprocessing import Pool
from time import time
+import lib.globalvars as globalvars
from lib.config import (aliases, arches, banpkgs, categories, cpunm, mergedir,
mergesubdir, pkgfiles, repos, repo_order, signrelease,
spooldir, srcfiles, suites)
@@ -145,6 +146,7 @@ def main_merge(packages_file):
to_merge = prepare_merge_dict()
for suite in to_merge:
+ globalvars.suite = suite
pkg_list = []
for rep in to_merge[suite]:
if rep:
diff --git a/amprolla_update.py b/amprolla_update.py
@@ -10,6 +10,7 @@ from multiprocessing import Pool
from time import time
import requests
+import lib.globalvars as globalvars
from amprolla_merge import gen_release, merge, prepare_merge_dict
from lib.config import aliases, cpunm, repos, repo_order, spooldir
from lib.log import info
@@ -40,6 +41,7 @@ def perform_update(suite, paths):
"""
info('Checking for updates in %s' % suite)
# print(paths)
+ globalvars.suite = suite
needsmerge = {}
needsmerge['downloads'] = [] # all files that have to be downloaded
diff --git a/lib/globalvars.py b/lib/globalvars.py
@@ -0,0 +1,8 @@
+# see LICENSE file for copyright and license details
+
+"""
+amprolla globals to pass around
+"""
+
+# state for the current suite we're in
+suite = ""
diff --git a/lib/package.py b/lib/package.py
@@ -10,6 +10,7 @@ from gzip import open as gzip_open
from lzma import open as lzma_open
from shutil import copyfile
+import lib.globalvars as globalvars
from lib.config import mergedir, packages_keys, sources_keys, spooldir, logdir
from lib.log import logtofile
from lib.parse import parse_dependencies, parse_packages
@@ -127,9 +128,10 @@ def merge_packages(pkg1, pkg2, name1, name2, banned_packages=set(),
new_pkgs[pkg] = pkg1_pkg
if package_newer(pkg1_pkg, pkg2_pkg):
logtofile('oldpackages.txt',
- '%s,%s,%s\n' % (pkg1_pkg.get('Package'),
- pkg1_pkg.get('Version'),
- pkg2_pkg.get('Version')))
+ '%s,%s,%s,%s\n' % (globalvars.suite,
+ pkg1_pkg.get('Package'),
+ pkg1_pkg.get('Version'),
+ pkg2_pkg.get('Version')))
elif pkg1_pkg:
if not package_banned(pkg1_pkg, banned_packages):
if rewriter: