#!/usr/bin/python3 # # This script is licensed under GPL v3 or higher # # Author: Angel Berlanas Vicente # angel.berlanas@gmail.com # import urllib.request import os import sys # Some values of default LLIUREX_CURRENT_URL="http://lliurex.net/platinum/conf/llx1406_filterList.txt" LLIUREX_GENERATED_FILE="last/llx1406_pool-unico-list.txt" class Pooldiff: """ The mod module """ def set_pre_platinum(): LLIUREX_CURRENT_URL="http://lliurex.net/pre-platinum/conf/llx1406_filterList.txt" def main(): """ The all the operations """ s_packages_current = set() s_packages_generated = set() # First get the package list from lliurex.net try: current= urllib.request.urlopen(LLIUREX_CURRENT_URL) lines = current.readlines() current.close() for line in lines: try: s_packages_current.add(line.split()[0].decode("utf-8")) except IndexError as e: pass except Exception as e: print("Error : "+str(e)) # Now is time for local file, generated by this software previously if not os.path.isfile(LLIUREX_GENERATED_FILE): print("Working area is empty: "+ LLIUREX_GENERATED_FILE + " is not present") sys.exit(1) generated = open(LLIUREX_GENERATED_FILE) lines = generated.readlines() generated.close() for line in lines: s_packages_generated.add(line.split()[0]) # Some operations # This need be optimized generated_minus_current = s_packages_generated - s_packages_current print("### ## # Generated Not in Current # ## ###") for package in generated_minus_current: print(package+"\tinstall") if __name__ == "__main__": """ The main module """ try: if len(sys.argv) != 1 and sys.argv[1] == "pre-platinum": set_pre_platinum() else: pass except Exception as e: print("Error : "+ str(e)) pass Pooldiff.main()