summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/revdep-rebuild7
-rwxr-xr-xbin/revdep-rebuild.sh2
-rw-r--r--pym/gentoolkit/revdep_rebuild/analyse.py12
-rw-r--r--pym/gentoolkit/revdep_rebuild/assign.py6
-rw-r--r--pym/gentoolkit/revdep_rebuild/cache.py14
-rw-r--r--pym/gentoolkit/revdep_rebuild/collect.py4
-rw-r--r--pym/gentoolkit/revdep_rebuild/rebuild.py39
-rw-r--r--pym/gentoolkit/revdep_rebuild/settings.py2
-rw-r--r--pym/gentoolkit/revdep_rebuild/stuff.py6
9 files changed, 60 insertions, 32 deletions
diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild
index a4c8e11..cd7be0b 100755
--- a/bin/revdep-rebuild
+++ b/bin/revdep-rebuild
@@ -6,10 +6,9 @@
#
# $Header$
-"""'analyse' is a flexible utility for Gentoo linux which can display various
-information about installed packages, such as the USE flags used and the
-packages that use them. It can also be used to help rebuild /etc/portage/package.*
-files in the event of corruption, and possibly more.
+"""'revdep-rebuild' scans libraries and binaries for missing shared library dependencies and attempts to fix them by re-emerging
+those broken binaries and shared libraries. It is useful when an upgraded package breaks other software packages that are
+dependent upon the upgraded package.
"""
from __future__ import print_function
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index f00b791..abeed6b 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -17,7 +17,7 @@
unset GREP_OPTIONS
# Readonly variables:
-declare -r APP_NAME="${0##*/}" # The name of this application
+declare -r APP_NAME="revdep-rebuild" # # The name of this application
declare -r VERSION="svn"
declare -r OIFS="$IFS" # Save the IFS
declare -r ENV_FILE=0_env.rr # Contains environment variables
diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py
index 69651ca..5494270 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -1,5 +1,9 @@
#!/usr/bin/python
+"""Analysis module"""
+
+from __future__ import print_function
+
import os
import re
import platform
@@ -7,10 +11,10 @@ import glob
from portage.output import bold, red, blue, yellow, green, nocolor
-from stuff import scan
-from collect import prepare_search_dirs, parse_revdep_config, collect_libraries_from_dir, collect_binaries_from_dir
-from assign import assign_packages
-from cache import save_cache
+from .stuff import scan
+from .collect import prepare_search_dirs, parse_revdep_config, collect_libraries_from_dir, collect_binaries_from_dir
+from .assign import assign_packages
+from .cache import save_cache
def prepare_checks(files_to_check, libraries, bits, cmd_max_args):
diff --git a/pym/gentoolkit/revdep_rebuild/assign.py b/pym/gentoolkit/revdep_rebuild/assign.py
index 5ed938e..bbe409b 100644
--- a/pym/gentoolkit/revdep_rebuild/assign.py
+++ b/pym/gentoolkit/revdep_rebuild/assign.py
@@ -1,5 +1,11 @@
#!/usr/bin/python
+"""Assign module
+Functions used for determining the package the broken lib belongs to.
+"""
+
+from __future__ import print_function
+
import os
import re
diff --git a/pym/gentoolkit/revdep_rebuild/cache.py b/pym/gentoolkit/revdep_rebuild/cache.py
index ef46314..7dc9a8d 100644
--- a/pym/gentoolkit/revdep_rebuild/cache.py
+++ b/pym/gentoolkit/revdep_rebuild/cache.py
@@ -1,10 +1,16 @@
#!/bin/bash
+"""Caching module
+Functions for reading, saving and verifying the data caches
+"""
+
+from __future__ import print_function
+
import os
import time
from portage.output import red
-from settings import DEFAULTS
+from .settings import DEFAULTS
def read_cache(temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
@@ -17,7 +23,7 @@ def read_cache(temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
ret = {'libraries':[], 'la_libraries':[], 'libraries_links':[], 'binaries':[]}
try:
- for key,val in ret.iteritems():
+ for key,val in list(ret.items()):
f = open(os.path.join(temp_path, key))
for line in f.readlines():
val.append(line.strip())
@@ -43,7 +49,7 @@ def save_cache(logger, to_save={}, temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
f.write(str(int(time.time())))
f.close()
- for key,val in to_save.iteritems():
+ for key,val in list(to_save.items()):
f = open(os.path.join(temp_path, key), 'w')
for line in val:
f.write(line + '\n')
@@ -86,7 +92,7 @@ def check_temp_files(temp_path=DEFAULTS['DEFAULT_TMP_DIR'], max_delay=3600):
if __name__ == '__main__':
print('Preparing cache ... ')
- from collect import *
+ from .collect import *
import logging
bin_dirs, lib_dirs = prepare_search_dirs()
diff --git a/pym/gentoolkit/revdep_rebuild/collect.py b/pym/gentoolkit/revdep_rebuild/collect.py
index d1b23c0..8239feb 100644
--- a/pym/gentoolkit/revdep_rebuild/collect.py
+++ b/pym/gentoolkit/revdep_rebuild/collect.py
@@ -2,6 +2,8 @@
"""Data collection module"""
+from __future__ import print_function
+
import re
import os
import glob
@@ -19,7 +21,7 @@ def parse_conf(conf_file, visited=None, logger=None):
lib_dirs = set()
to_parse = set()
- if isinstance(conf_file, basestring):
+ if isinstance(conf_file, str):
conf_file = [conf_file]
for conf in conf_file:
diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py b/pym/gentoolkit/revdep_rebuild/rebuild.py
index 04fb96c..b529f37 100644
--- a/pym/gentoolkit/revdep_rebuild/rebuild.py
+++ b/pym/gentoolkit/revdep_rebuild/rebuild.py
@@ -2,26 +2,33 @@
# -*- coding: utf-8 -*-
-# Author: SÅ‚awomir Lis <lis.slawek@gmail.com>
-# revdep-rebuild original author: Stanislav Brabec
-# revdep-rebuild original rewrite Author: Michael A. Smith
-# Current Maintainer: Paul Varner <fuzzyray@gentoo.org>
+""" Rebuild module
-# Creation date: 2010/10/17
-# License: BSD
+Main program, cli parsing and api program control and operation
+Author: SÅ‚awomir Lis <lis.slawek@gmail.com>
+ revdep-rebuild original author: Stanislav Brabec
+ revdep-rebuild original rewrite Author: Michael A. Smith
+Current Maintainer: Paul Varner <fuzzyray@gentoo.org>
+Creation date: 2010/10/17
+License: BSD
+"""
+
+from __future__ import print_function
+
+import subprocess
import os
import sys
import getopt
import logging
from portage.output import bold, red, blue, yellow, green, nocolor
-from analyse import analyse
-from stuff import exithandler, get_masking_status
-from cache import check_temp_files, read_cache
-from assign import get_slotted_cps
-from settings import DEFAULTS
-from gentoolkit.revdep_rebuild import __version__
+from .analyse import analyse
+from .stuff import exithandler, get_masking_status
+from .cache import check_temp_files, read_cache
+from .assign import get_slotted_cps
+from .settings import DEFAULTS
+from . import __version__
APP_NAME = sys.argv[0]
@@ -35,13 +42,13 @@ __productname__ = "revdep-ng"
def print_usage():
"""Outputs the help message"""
print( APP_NAME + ': (' + VERSION +')')
- print
+ print()
print('This is free software; see the source for copying conditions.')
- print
+ print()
print('Usage: ' + APP_NAME + ' [OPTIONS] [--] [EMERGE_OPTIONS]')
- print
+ print()
print('Broken reverse dependency rebuilder, python implementation.')
- print
+ print()
print('Available options:')
print('''
-C, --nocolor Turn off colored output
diff --git a/pym/gentoolkit/revdep_rebuild/settings.py b/pym/gentoolkit/revdep_rebuild/settings.py
index b56f812..c0e5aa7 100644
--- a/pym/gentoolkit/revdep_rebuild/settings.py
+++ b/pym/gentoolkit/revdep_rebuild/settings.py
@@ -2,6 +2,8 @@
"""Default settings"""
+from __future__ import print_function
+
import os
import sys
diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py b/pym/gentoolkit/revdep_rebuild/stuff.py
index 163cc7d..bffb936 100644
--- a/pym/gentoolkit/revdep_rebuild/stuff.py
+++ b/pym/gentoolkit/revdep_rebuild/stuff.py
@@ -3,6 +3,8 @@
"""Utilities submodule"""
+from __future__ import print_function
+
import subprocess
import portage
@@ -10,11 +12,11 @@ import portage
# util. functions
def call_program(args):
- ''' Calls program with specified parameters and returns stdout '''
+ ''' Calls program with specified parameters and returns stdout as a str object '''
subp = subprocess.Popen(args, stdout=subprocess.PIPE, \
stderr=subprocess.PIPE)
stdout, stderr = subp.communicate()
- return stdout
+ return str(stdout)
def scan(params, files, max_args):