Check AUR package for existence and add “deleted” message

This commit is contained in:
coderkun 2017-04-22 10:56:24 +02:00
commit 15843ce6e4
2 changed files with 13 additions and 1 deletions

View file

@ -20,6 +20,7 @@ class Styling:
NEEDS_UPDATE = '\x1b[38;2;200;0;0m'
FLAGGED = '\x1b[38;2;200;200;0m'
NEEDS_DOWNGRADE = '\x1b[38;2;0;0;200m'
DELETED = '\x1b[38;2;200;0;0m'
URL = '\x1b[38;2;200;200;200m'
@ -35,6 +36,7 @@ class AURChecker:
STATUS_UPTODATE = "uptodate"
STATUS_NEEDS_UPDATE = "needs update"
STATUS_NEEDS_DOWNGRADE = "needs downgrade"
STATUS_DELETED = "deleted"
def check(directory):
@ -49,12 +51,16 @@ class AURChecker:
print(Styling.BOLD + "# repository {}".format(database.get_name()) + Styling.ENDC)
for package in database.get_packages():
aur_package = AURPackage(package.get_name())
status = AURChecker.compare(package, aur_package)
if aur_package.exists():
status = AURChecker.compare(package, aur_package)
else:
status = AURChecker.STATUS_DELETED
status_messages = {}
status_messages[AURChecker.STATUS_UPTODATE] = Styling.UPTODATE + "up-do-date" + Styling.ENDC
status_messages[AURChecker.STATUS_NEEDS_UPDATE] = Styling.NEEDS_UPDATE + "needs update to {}\n".format(aur_package.get_version()) + Styling.URL + " {}{}".format(AURPackage.AUR_URL, aur_package.get_url_path()) + Styling.ENDC
status_messages[AURChecker.STATUS_NEEDS_DOWNGRADE] = Styling.NEEDS_DOWNGRADE + "local is newer" + Styling.ENDC
status_messages[AURChecker.STATUS_DELETED] = Styling.DELETED + "deleted" + Styling.ENDC
message = " {} {}: {}".format(package.get_name(), package.get_version(), status_messages[status])
if aur_package.get_out_of_date():