Exemple #1
0
def main():
    " Go, go, go! "
    args = parse_args()
    img_root_dir = os.path.join(uhdimgs.get_images_dir(), 'images')
    os.chdir(uhdimgs.get_images_dir())
    print "== Clearing out the images directory..."
    clear_img_dir(img_root_dir)
    print "== Creating ZIP file..."
    cpack_cmd = ["./make_zip.sh",]
    if args.release_mode is not None:
        cpack_cmd.append(args.release_mode)
    try:
        cpack_output = subprocess.check_output(cpack_cmd)
    except subprocess.CalledProcessError as e:
        print e.output
        raise SystemExit, 1
    zipfilename = get_zipfilename_from_cpack_output(cpack_output)
    print "Filename: ", zipfilename
    print "== Calculating MD5 sum of ZIP archive..."
    md5 = uhdimgs.md5_checksum(zipfilename)
    print 'MD5: ', md5
    base_url = uhdimgs.get_base_url()
    if uhdimgs.base_url_is_local(base_url) and os.access(base_url, os.W_OK):
        print "== Moving ZIP file to {0}...".format(base_url)
        move_zip_to_repo(base_url, zipfilename)
    print "== Updating CMakeLists.txt..."
    uhdimgs.update_main_cmake_file(md5, zipfilename)
    if args.commit is not None:
        print "== Committing changes..."
        subprocess.check_call(['git', 'commit', '-m', args.commit, uhdimgs.get_cmake_main_file()])
    print "== Done!"
Exemple #2
0
def main():
    " Go, go, go! "
    # Switch to correct dir
    img_root_dir = os.path.join(uhdimgs.get_images_dir(), "images")
    os.chdir(uhdimgs.get_images_dir())
    # Read out the CMakeLists.txt file, get filename
    print "== Reading MD5 and ZIP filename for current commit from {0}...".format(uhdimgs.get_cmake_main_file())
    (md5, filename) = get_md5_and_zipfilename()
    print "== Starting download..."
    try:
        downloader_cmd = [
            "python",
            "../host/utils/uhd_images_downloader.py.in",
            "-i",
            img_root_dir,
            "-f",
            filename,
            "-c",
            md5,
        ]
        subprocess.check_call(downloader_cmd)
    except (subprocess.CalledProcessError, OSError):
        print "[ERROR] Failed to run downloader script."
        exit(1)
    print "== Done!"
Exemple #3
0
def get_md5_and_zipfilename():
    """ Return MD5 hash and ZIP filename from the host/CMakeLists.txt file. """
    cmakef = open(uhdimgs.get_cmake_main_file(), "r").read()
    md5_regex = re.compile(r'UHD_IMAGES_MD5SUM\s*"(?P<md5>[0-9a-f]{32})', flags=re.MULTILINE)
    md5 = md5_regex.search(cmakef).groups("md5")[0]
    filename_regex = re.compile(r'UHD_IMAGES_DOWNLOAD_SRC\s*"(?P<filename>[^"]*\.zip)', flags=re.MULTILINE)
    filename = filename_regex.search(cmakef).groups("filename")[0]
    return (md5, filename)
Exemple #4
0
def get_md5_and_zipfilename():
    """ Return MD5 hash and ZIP filename from the host/CMakeLists.txt file. """
    cmakef = open(uhdimgs.get_cmake_main_file(), 'r').read()
    md5_regex = re.compile(r'UHD_IMAGES_MD5SUM\s*"(?P<md5>[0-9a-f]{32})',
                           flags=re.MULTILINE)
    md5 = md5_regex.search(cmakef).groups('md5')[0]
    filename_regex = re.compile(
        r'UHD_IMAGES_DOWNLOAD_SRC\s*"(?P<filename>[^"]*\.zip)',
        flags=re.MULTILINE)
    filename = filename_regex.search(cmakef).groups('filename')[0]
    return (md5, filename)
Exemple #5
0
def main():
    " Go, go, go! "
    # Switch to correct dir
    img_root_dir = os.path.join(uhdimgs.get_images_dir(), 'images')
    os.chdir(uhdimgs.get_images_dir())
    # Read out the CMakeLists.txt file, get filename
    print "== Reading MD5 and ZIP filename for current commit from {0}...".format(
        uhdimgs.get_cmake_main_file())
    (md5, filename) = get_md5_and_zipfilename()
    print "== Starting download..."
    try:
        downloader_cmd = [
            'python', '../host/utils/uhd_images_downloader.py.in', '-i',
            img_root_dir, '-f', filename, '-c', md5
        ]
        subprocess.check_call(downloader_cmd)
    except (subprocess.CalledProcessError, OSError):
        print "[ERROR] Failed to run downloader script."
        exit(1)
    print "== Done!"
Exemple #6
0
def main():
    " Go, go, go! "
    args = parse_args()
    img_root_dir = os.path.join(uhdimgs.get_images_dir(), 'images')
    os.chdir(uhdimgs.get_images_dir())
    print "== Clearing out the images directory..."
    clear_img_dir(img_root_dir)
    print "== Creating archives..."
    cpack_cmd = [
        "./make_zip.sh",
    ]
    cpack_cmd.append(args.release_mode)
    if args.patch is not None:
        cpack_cmd.append("-DUHD_PATCH_OVERRIDE={}".format(args.patch))
    try:
        cpack_output = subprocess.check_output(cpack_cmd)
    except subprocess.CalledProcessError as e:
        print e.output
        raise SystemExit, 1
    zipfilename = get_zipfilename_from_cpack_output(cpack_output)
    print "Filename: ", zipfilename
    print "== Calculating MD5 sum of ZIP archive..."
    md5 = uhdimgs.md5_checksum(zipfilename)
    print 'MD5: ', md5
    base_url = uhdimgs.get_base_url()
    if not args.skip_move and uhdimgs.base_url_is_local(
            base_url) and os.access(base_url, os.W_OK):
        print "== Moving ZIP file to {0}...".format(base_url)
        move_zip_to_repo(base_url, zipfilename)
    print "== Updating CMakeLists.txt..."
    uhdimgs.update_main_cmake_file(md5, zipfilename)
    if args.commit is not None:
        print "== Committing changes..."
        subprocess.check_call([
            'git', 'commit', '-m', args.commit,
            uhdimgs.get_cmake_main_file()
        ])
    print "== Done!"