Example #1
0
def rpmbuild_remove_dirs():
    """
    builpy.rpm.rpmbuild_remove_dirs()
    function that removes temporary directories for rpmbuild
    moves back pre-existing rpmbuild directory to rpmbuild_old
    """
    home_check()

    if os.path.exists(RPMBUILD_DIR):
        shutil.rmtree(RPMBUILD_DIR)

    if os.path.exists(RPMBUILD_OLD):
        shutil.move(RPMBUILD_OLD, RPMBUILD_DIR)
        print("Moved old rpmbuild backup back into original place.")
Example #2
0
def check_rpmbuild():
    """
    builpy.rpm.check_rpmbuild()
    function that checks $HOME/rpmbuild, rpmbuild/SOURCES and rpmbuild/SPECS
    for existence and writability
    """
    home_check()

    if not os.access(RPMBUILD_DIR, os.W_OK):
        raise OSError("rpmbuild directory not existent or not writable.")
    if not os.access(RPMBUILD_SOURCES, os.W_OK):
        raise OSError("rpmbuild SOURCES directory not existent or not writable.")
    if not os.access(RPMBUILD_SPECS, os.W_OK):
        raise OSError("rpmbuild SPECS directory not existent or not writable.")
    if not os.access(RPMBUILD_SRPMS, os.W_OK):
        raise OSError("rpmbuild SRPMS directory not existent or not writable.")
Example #3
0
def rpmbuild_create_dirs():
    """
    builpy.rpm.rpmbuild_create_dirs()
    function that creates neccessary directories for rpmbuild:
    $HOME/rpmbuild/SOURCES, $HOME/rpmbuild/SPECS
    moves away pre-existing rpmbuild directory to rpmbuild_old
    """
    home_check()

    if os.path.exists(RPMBUILD_DIR):
        shutil.move(RPMBUILD_DIR, RPMBUILD_OLD)
        print("Moved old rpmbuild directory away.")

    os.mkdir(RPMBUILD_DIR)
    os.mkdir(RPMBUILD_SPECS)
    os.mkdir(RPMBUILD_SRPMS)
    os.mkdir(RPMBUILD_SOURCES)