Skip to content

Commit

Permalink
Remove unused functionality, deprecate "delorean" as a script
Browse files Browse the repository at this point in the history
The dlrn-compare binary has not been used for a long time, so we
can remove it. Same goes for scripts/run.sh.

Also, we are deprecating usage of "delorean" as a
script name, but still keeping the functionality.

Change-Id: I1efcea1650bd6c69be28a0af7b97f0db987c7723
  • Loading branch information
gbraad committed Jan 23, 2017
1 parent d586b9c commit 5a5b34a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 65 deletions.
54 changes: 8 additions & 46 deletions dlrn/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from functools import partial

from prettytable import PrettyTable
import sh
from six.moves import configparser

Expand Down Expand Up @@ -65,6 +64,14 @@
}


def deprecation():
# We will still call main, but will indicate that this way of calling
# the application will be deprecated.
print("Using the 'delorean' command has been deprecated. Please use 'dlrn'"
" instead.")
main()


def main():
parser = argparse.ArgumentParser()
# Some of the non-positional arguments are required, so change the text
Expand Down Expand Up @@ -495,51 +502,6 @@ def process_build_result(status, packages, session, dev_mode=False,
return exit_code


def compare():
parser = argparse.ArgumentParser()
parser.add_argument('--info-repo',
help="use a local rdoinfo repo instead of "
"fetching the default one using rdopkg. Only"
"applies when pkginfo_driver is rdoinfo in"
"projects.ini")
config_options = getConfigOptions()
options, args = parser.parse_known_args(sys.argv[1:])
pkginfo_driver = config_options.pkginfo_driver
pkginfo_object = import_object(pkginfo_driver, cfg_options=config_options)
packages = pkginfo_object.getpackages(local_info_repo=options.info_repo,
tags=config_options.tags)

compare_details = {}
# Each argument is a ":" seperate filename:title, this filename is the
# sqlite db file and the title is whats used in the dable being displayed
table_header = ["Name", "Out of Sync"]
for dbdetail in args:
dbfilename, dbtitle = dbdetail.split(":")
table_header.extend((dbtitle + " upstream", dbtitle + " spec"))

session = getSession('sqlite:///%s' % dbfilename)

for package in packages:
package_name = package["name"]
compare_details.setdefault(package_name, [package_name, " "])
last_success = getCommits(session, project=package_name,
with_status="SUCCESS").first()
if last_success:
compare_details[package_name].extend(
(last_success.commit_hash[:8],
last_success.distro_hash[:8]))
else:
compare_details[package_name].extend(("None", "None"))
session.close()

table = PrettyTable(table_header)
for name, compare_detail in compare_details.items():
if len(set(compare_detail)) > 4:
compare_detail[1] = "*"
table.add_row(compare_detail)
print(table)


def post_build(status, packages, session):
config_options = getConfigOptions()
commit = status[0]
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ SQLAlchemy
PyYAML
pycparser==2.14
rdopkg>=0.34
PrettyTable
alembic
renderspec
pymod2pkg>=0.5.5
Expand Down
16 changes: 0 additions & 16 deletions scripts/run.sh

This file was deleted.

3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@ output_file = dlrn/locale/dlrn.pot
[entry_points]
console_scripts =
dlrn = dlrn.shell:main
delorean = dlrn.shell:main
delorean-compare = dlrn.shell:compare
delorean = dlrn.shell:deprecation
dlrn-purge = dlrn.purge:purge

0 comments on commit 5a5b34a

Please sign in to comment.