コード例 #1
0
def main():

    try:
        opts, args = getopt.getopt(sys.argv[1:], "s:d:i:j:o:h")
    except getopt.GetoptError as err:
        # print help information and exit:
        print str(err) # will print something like "option -a not recognized"
        usage()
        sys.exit(2)
        
    system = debian
    distrib = "squeeze"
    firstinput = ""
    secondinput = ""
    output = "Security-update-analysis"
    
    for o, a in opts:
        if o in ("-h"):
            usage()
            sys.exit()
        elif o in ("-s"):
            system = get_system_link(a)
        elif o in ("-d"):
            distrib = a
        elif o in ("-i"):
            firstinput = a
        elif o in ("-j"):
            secondinput = a
        elif o in ("-o"):
            output = a
        else:
            usage()
            sys.exit()

    if cache.init_cache_folders(system, distrib) is False:
        print "Error with cache function"
        return 1

    if not firstinput or not secondinput:
        print "Params i and j are mandatory"
        usage()
        sys.exit()

    packet_list_to_update = functions.get_update_list(firstinput)
    packet_list_to_update = system.clean(packet_list_to_update)
    
    packet_list = functions.get_packet_dict(secondinput)

    packet_update_info = []
    for packet in packet_list_to_update:
    #for packet in packet_list:
        packet_update_info.append(functions.analyse_packet(system, distrib, packet[0], packet_list[packet[0]], packet[1]))

    source_packet_update_info = functions.get_update_packet_list_by_source_packet(system, distrib, packet_update_info)

    return report.export_to_html(source_packet_update_info, output)
コード例 #2
0
def main():
    packet_list_to_update = get_update_list("upgrade.txt")
    
    packet_list = get_packet_dict("dpkg.txt")

    packet_update_info = []
    for packet in packet_list_to_update:
        #anayse_packet(packet_name, version, update_version)
        packet_update_info.append(analyse_packet(packet[0], packet_list[packet[0]], packet[1]))

    source_packet_update_info = get_update_packet_list_by_source_packet(packet_update_info)

    return report.export_to_html(source_packet_update_info)