Browse Source

Initial commit

tags/0.1
Johann Schmitz 5 years ago
commit
b09f8a2171
Signed by: Johann Schmitz <johann@j-schmitz.net> GPG Key ID: A084064277C501ED
2 changed files with 106 additions and 0 deletions
  1. 56
    0
      .gitignore
  2. 50
    0
      src/check_updates.py

+ 56
- 0
.gitignore View File

@@ -0,0 +1,56 @@
1
+# Byte-compiled / optimized / DLL files
2
+__pycache__/
3
+*.py[cod]
4
+
5
+# C extensions
6
+*.so
7
+
8
+# Distribution / packaging
9
+.Python
10
+env/
11
+bin/
12
+build/
13
+develop-eggs/
14
+dist/
15
+eggs/
16
+lib/
17
+lib64/
18
+parts/
19
+sdist/
20
+var/
21
+*.egg-info/
22
+.installed.cfg
23
+*.egg
24
+
25
+# Installer logs
26
+pip-log.txt
27
+pip-delete-this-directory.txt
28
+
29
+# Unit test / coverage reports
30
+htmlcov/
31
+.tox/
32
+.coverage
33
+.cache
34
+nosetests.xml
35
+coverage.xml
36
+
37
+# Translations
38
+*.mo
39
+
40
+# Mr Developer
41
+.mr.developer.cfg
42
+.project
43
+.pydevproject
44
+.idea
45
+
46
+# Rope
47
+.ropeproject
48
+
49
+# Django stuff:
50
+*.log
51
+*.pot
52
+
53
+# Sphinx documentation
54
+docs/_build/
55
+
56
+.idea/

+ 50
- 0
src/check_updates.py View File

@@ -0,0 +1,50 @@
1
+#!/usr/bin/env python3
2
+# -*- coding: utf-8 -*-
3
+
4
+import argparse
5
+import sys
6
+from gentoolkit.query import Query
7
+
8
+
9
+def do_test(packages, debug):
10
+	for cp in packages:
11
+		q = Query(cp)
12
+
13
+		packages = q.find_installed()
14
+
15
+		if not len(packages):
16
+			continue
17
+
18
+		for installed in packages:
19
+			slot = installed.environment(('SLOT'))
20
+
21
+			query = Query('>%s:%s' % (installed.cpv, slot))
22
+			updates = sorted(query.smart_find(in_installed=True,
23
+											in_overlay=False,
24
+											include_masked=False,
25
+											no_matches_fatal=False,
26
+											show_progress=debug))
27
+			if len(updates):
28
+				yield updates[-1]
29
+
30
+
31
+
32
+if __name__ == '__main__':
33
+	description="Checks that the given packages are always up-to-date (that there is no newer stable version in the same slot)"
34
+	parser = argparse.ArgumentParser(description=description)
35
+	parser.add_argument('-d', '--debug', action='store_true', default=False, help="Enable debug output")
36
+	parser.add_argument('--java', action='store_true', default=False, help='Injects Icedtea/Oracle JRE and JDK into the list of packages')
37
+	parser.add_argument('packages', nargs='*', help='category/package to test')
38
+
39
+	args = parser.parse_args()
40
+
41
+	if args.java:
42
+		args.packages.extend(['dev-java/icedtea-bin', 'dev-java/oracle-jdk-bin', 'dev-java/oracle-jre-bin'])
43
+
44
+	updates = list(do_test(set(args.packages), args.debug))
45
+
46
+	if len(updates):
47
+		print("%s updates available: %s" % (len(updates), ', '.join((str(x) for x in updates))))
48
+		sys.exit(1)
49
+	else:
50
+		print("No updates available")

Loading…
Cancel
Save