Browse Source

Initial commit

tags/0.1
Johann Schmitz 5 years ago
commit
b09f8a2171
Signed by: ercpe <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 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.idea

# Rope
.ropeproject

# Django stuff:
*.log
*.pot

# Sphinx documentation
docs/_build/

.idea/

+ 50
- 0
src/check_updates.py View File

@@ -0,0 +1,50 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import argparse
import sys
from gentoolkit.query import Query


def do_test(packages, debug):
for cp in packages:
q = Query(cp)

packages = q.find_installed()

if not len(packages):
continue

for installed in packages:
slot = installed.environment(('SLOT'))

query = Query('>%s:%s' % (installed.cpv, slot))
updates = sorted(query.smart_find(in_installed=True,
in_overlay=False,
include_masked=False,
no_matches_fatal=False,
show_progress=debug))
if len(updates):
yield updates[-1]



if __name__ == '__main__':
description="Checks that the given packages are always up-to-date (that there is no newer stable version in the same slot)"
parser = argparse.ArgumentParser(description=description)
parser.add_argument('-d', '--debug', action='store_true', default=False, help="Enable debug output")
parser.add_argument('--java', action='store_true', default=False, help='Injects Icedtea/Oracle JRE and JDK into the list of packages')
parser.add_argument('packages', nargs='*', help='category/package to test')

args = parser.parse_args()

if args.java:
args.packages.extend(['dev-java/icedtea-bin', 'dev-java/oracle-jdk-bin', 'dev-java/oracle-jre-bin'])

updates = list(do_test(set(args.packages), args.debug))

if len(updates):
print("%s updates available: %s" % (len(updates), ', '.join((str(x) for x in updates))))
sys.exit(1)
else:
print("No updates available")

Loading…
Cancel
Save