Пример #1
0
def process(rpm_to_dir, rpm_from_dir, mirror, dontcopy, verbose, recurse,
            progress):

    if verbose: print ">process(..)"

    error_log = []

    col = commands.getoutput("echo \"$COLUMNS\"")
    try:
        columns = int(col)
    except:
        columns = 60
    pb = progress_bar.pb("Progress: ", "-", columns, sys.stderr)

    rpm_from_files = grab_rpm_files(rpm_from_dir, recurse)
    rpm_to_files = grab_rpm_files(rpm_to_dir, recurse)
    rpmdiff_inst = rpmdiff_lib.rpmdiff(verbose, progress, pb)

    rpm_from_dict = rpmdiff_inst.generate_rpm_dict(rpm_from_files)
    rpm_to_dict = rpmdiff_inst.generate_rpm_dict(rpm_to_files)

    i = 0.0
    for rpm in rpm_from_dict.keys():
        i = i + 1.0
        if progress:
            percentage = i / len(rpm_from_dict.keys())
            pb.progress(percentage)

        # check if the update exists
        if not rpm_to_dict.has_key(rpm):
            # First, attempt to grab from mirror
            cmd = ("wget -nd -P \"%s\" \"%s/%s-*.rpm\"") % (rpm_to_dir, mirror,
                                                            rpm)
            if verbose: print ">> " + cmd
            output = commands.getoutput(cmd)
            if (not len(list_files(rpm_to_dir, ("%s-*.rpm" % rpm), False))):
                if not dontcopy:
                    # Okay, download didn't work, let's just copy the file over and log it
                    cmd = ("cp %s %s/.") % (rpm_from_dict[rpm]['filename'],
                                            rpm_to_dir)
                    if verbose:
                        print ">> File could not download, default to copy original"
                    output = commands.getoutput(cmd)
                else:
                    if verbose: print ">> File could not download"
                error_log.append(
                    "Problem with %s for %s arch. Could not find in mirror." %
                    (rpm, arch))

    if len(error_log):
        print >> sys.stderr, "ERRORS\n"
        i = 0
        for line in error_log:
            i += 1
            print "[%d] %s" % (i, line)
Пример #2
0
def process(rpm_to_dir, rpm_from_dir, mirror, dontcopy, verbose, recurse, progress):

    if verbose: print ">process(..)"

    error_log = []

    col = commands.getoutput("echo \"$COLUMNS\"")
    try:
        columns = int(col)
    except:
        columns = 60
    pb = progress_bar.pb("Progress: ", "-", columns, sys.stderr)

    rpm_from_files = grab_rpm_files(rpm_from_dir, recurse)
    rpm_to_files = grab_rpm_files(rpm_to_dir, recurse)
    rpmdiff_inst = rpmdiff_lib.rpmdiff(verbose, progress, pb)

    rpm_from_dict = rpmdiff_inst.generate_rpm_dict(rpm_from_files)
    rpm_to_dict = rpmdiff_inst.generate_rpm_dict(rpm_to_files)

    i = 0.0
    for rpm in rpm_from_dict.keys():
        i = i + 1.0
        if progress:
            percentage = i / len(rpm_from_dict.keys())
            pb.progress(percentage)

        # check if the update exists
        if not rpm_to_dict.has_key(rpm):
            # First, attempt to grab from mirror
            cmd = ("wget -nd -P \"%s\" \"%s/%s-*.rpm\"") % (rpm_to_dir, mirror, rpm)
            if verbose: print ">> " + cmd
            output = commands.getoutput(cmd)
            if (not len(list_files(rpm_to_dir, ("%s-*.rpm" % rpm), False))):
                if not dontcopy:
                    # Okay, download didn't work, let's just copy the file over and log it
                    cmd = ("cp %s %s/.") % (rpm_from_dict[rpm]['filename'], rpm_to_dir)
                    if verbose: print">> File could not download, default to copy original"
                    output = commands.getoutput(cmd)
                else:
                    if verbose: print">> File could not download"
                error_log.append("Problem with %s for %s arch. Could not find in mirror." % (rpm, arch))

    if len(error_log):
        print >> sys.stderr, "ERRORS\n"
        i = 0
        for line in error_log:
            i += 1
            print "[%d] %s" % (i, line)
Пример #3
0
def process(rpm_to_dir, rpm_from_dir, mirror, arch, verbose, recurse, progress):

    if verbose: print ">process(..)"

    error_log = []

    col = commands.getoutput("echo \"$COLUMNS\"")
    try:
        columns = int(col)
    except:
        columns = 60
    pb = progress_bar.pb("Progress: ", "-", columns, sys.stderr)

    rpm_from_files = grab_rpm_files(rpm_from_dir, recurse)
    rpm_to_files = grab_rpm_files(rpm_to_dir, recurse)
    rpmdiff_inst = rpmdiff_lib.rpmdiff(verbose, progress, pb)

    rpm_from_dict = rpmdiff_inst.generate_rpm_dict(rpm_from_files)
    rpm_to_dict = rpmdiff_inst.generate_rpm_dict(rpm_to_files)

    i = 0.0
    for rpm in rpm_from_dict.keys():
        i = i + 1.0
        if progress:
            percentage = i / len(rpm_from_dict.keys())
            pb.progress(percentage)

        # check if the new arch component exists
        if not rpm_to_dict.has_key(rpm):
            # First, attempt to grab from mirror
            new_arch_file = rpm + "-" + rpm_from_dict[rpm]['version'] + "-" + rpm_from_dict[rpm]['release'] + "." + arch + ".rpm"
            path = rpm_to_dir + "/" + new_arch_file
            full_url = mirror + "/" + new_arch_file
            cmd = ("wget -O \"%s\" %s") % (path, full_url)
            if verbose: print ">> " + cmd
            output = commands.getoutput(cmd)
            if not os.path.exists(path):
                # Okay, download didn't work, let's just copy the file over and log it
                cmd = ("cp %s %s/.") % (rpm_from_dict[rpm]['filename'], rpm_to_dir)
                if verbose: print">> File could not download, default to copy original"
                output = commands.getoutput(cmd)
                error_log.append("Problem with %s for %s arch. Could not find in mirror." % (rpm, arch))

    if len(error_log):
        print >> sys.stderr, "ERRORS\n"
        i = 0
        for line in error_log:
            i += 1
            print "[%d] %s" % (i, line)
Пример #4
0
def run_compare(rpm_from, rpm_to, rpm_from_type, rpm_to_type, recurse,
                progress, verbose, binpkg, srcpkg, show_same):
    """ Run the comparison """

    col = commands.getoutput("echo \"$COLUMNS\"")
    try:
        columns = int(col)
    except:
        columns = 60
    pb = progress_bar.pb("Progress: ", "-", columns, sys.stderr)

    rdiff = rpmdiff_lib.rpmdiff(verbose, progress, pb)

    rpm_from_dict = {}
    rpm_to_dict = {}
    if rpm_from_type == 'dir':
        if progress: pb.set("Scanning %s :" % rpm_from)
        rpm_from_files = grab_rpm_files(rpm_from, recurse, binpkg, srcpkg)
        rpm_from_dict = rdiff.generate_rpm_dict(rpm_from_files)
        if progress: pb.set("Progress :")
        if progress: pb.clear()
    else:
        print "Error! No other supported types!"
        sys.exit(2)
    if rpm_to_type == 'dir':
        if progress: pb.set("Scanning %s :" % rpm_to)
        rpm_to_files = grab_rpm_files(rpm_to, recurse, binpkg, srcpkg)
        rpm_to_dict = rdiff.generate_rpm_dict(rpm_to_files)
        if progress: pb.set("Progress :")
        if progress: pb.clear()
    else:
        print "Error! No other supported types!"
        sys.exit(2)

    diff_results = rdiff.diff_rpm_dicts(rpm_from_dict, rpm_to_dict)
    if progress: pb.clear()
    print rdiff.produce_data_file(0, show_same)
Пример #5
0
def run_compare(rpm_from, rpm_to, rpm_from_type, rpm_to_type, recurse, progress, verbose, binpkg, srcpkg, show_same):
    """ Run the comparison """

    col = commands.getoutput("echo \"$COLUMNS\"")
    try:
        columns = int(col)
    except:
        columns = 60
    pb = progress_bar.pb("Progress: ", "-", columns, sys.stderr)

    rdiff = rpmdiff_lib.rpmdiff(verbose, progress, pb)

    rpm_from_dict = {}
    rpm_to_dict = {}
    if rpm_from_type == 'dir':
        if progress: pb.set("Scanning %s :" % rpm_from)
        rpm_from_files = grab_rpm_files(rpm_from, recurse, binpkg, srcpkg)
        rpm_from_dict = rdiff.generate_rpm_dict(rpm_from_files)
        if progress: pb.set("Progress :")
        if progress: pb.clear()
    else:
        print "Error! No other supported types!"
        sys.exit(2)
    if rpm_to_type == 'dir':
        if progress: pb.set("Scanning %s :" % rpm_to)
        rpm_to_files = grab_rpm_files(rpm_to, recurse, binpkg, srcpkg)
        rpm_to_dict = rdiff.generate_rpm_dict(rpm_to_files)
        if progress: pb.set("Progress :")
        if progress: pb.clear()
    else:
        print "Error! No other supported types!"
        sys.exit(2)

    diff_results = rdiff.diff_rpm_dicts(rpm_from_dict, rpm_to_dict)
    if progress: pb.clear()
    print rdiff.produce_data_file(0, show_same)