Esempio n. 1
0
def make_rpm(outdir,
             name='test',
             version='1.0',
             release='1',
             arch=None,
             for_anaconda_ver=None,
             for_kernel_ver=None,
             payload=None):
    p = SimpleRpmBuild(name, version, release)
    if for_anaconda_ver:
        p.add_provides('installer-enhancement = %s' % for_anaconda_ver)
    if for_kernel_ver:
        p.add_provides('kernel-modules >= %s' % for_kernel_ver)
    if payload is None:
        payload = []
    for item in payload:
        p.add_installed_file(item.path, SourceFile(item.srcpath,
                                                   item.contents),
                             **item.kwargs)
    with in_tempdir("anaconda-test-dd."):
        p.make()
        rpmfile = p.get_built_rpm(arch or expectedArch)
        outfile = os.path.join(outdir, os.path.basename(rpmfile))
        shutil.move(rpmfile, outfile)
    return p
Esempio n. 2
0
def makeFakeRPM(repo_dir,
                name,
                epoch,
                version,
                release,
                files=None,
                provides=None):
    """Make a fake rpm file in repo_dir"""
    if provides is None:
        provides = []
    p = SimpleRpmBuild(name, version, release)
    if epoch:
        p.epoch = epoch
    if not files:
        p.add_simple_payload_file_random()
    else:
        # Make a number of fake file entries in the rpm
        for f in files:
            p.add_installed_file(installPath=f,
                                 sourceFile=SourceFile(os.path.basename(f),
                                                       "THIS IS A FAKE FILE"))
    for c in provides:
        p.add_provides(c)
    with in_tempdir("lorax-test-rpms."):
        p.make()
        rpmfile = p.get_built_rpm(expectedArch)
        shutil.move(rpmfile, repo_dir)
Esempio n. 3
0
def _create_fake_rpm(temp_dir):
    rpm = SimpleRpmBuild(name="test-rpm", version="200", release="9000")
    rpm.add_installed_file(installPath="/usr/bin/TEST",
                           sourceFile=SourceFile(sourceName="TEST",
                                                 content="SO AWESOME APP!"))
    with switch_workdir(temp_dir):
        rpm.make()

    rpm_rel_path = rpm.get_built_rpm(ARCH)
    return os.path.join(temp_dir, rpm_rel_path)
Esempio n. 4
0
def make_rpm(outdir, name='test', version='1.0', release='1', arch=None,
             for_anaconda_ver=None, for_kernel_ver=None,
             payload=None):
    p = SimpleRpmBuild(name, version, release)
    if for_anaconda_ver:
        p.add_provides('installer-enhancement = %s' % for_anaconda_ver)
    if for_kernel_ver:
        p.add_provides('kernel-modules >= %s' % for_kernel_ver)
    if payload is None:
        payload = []
    for item in payload:
        p.add_installed_file(item.path,
                             SourceFile(item.srcpath, item.contents),
                             **item.kwargs)
    with in_tempdir("anaconda-test-dd."):
        p.make()
        rpmfile = p.get_built_rpm(arch or expectedArch)
        outfile = os.path.join(outdir, os.path.basename(rpmfile))
        shutil.move(rpmfile, outfile)
    return p