Пример #1
0
def main():
    options = parse_args()

    # Parse new package versions
    buildversions = BuildVersions()

    # Do some RPM buildroot prep
    rpm_src_dir = _tempdir('rpmbuild-src')
    _prep_rpm_src_dir(buildversions, rpm_src_dir)

    # Call public scripts to generate the virtio .zip
    driver_input_dir = _tempdir("make-driver-dir-input")
    _prep_driver_dir_input(driver_input_dir)

    # Build the driver dir/iso dir layout
    driver_output_dir = _tempdir("make-driver-dir-output")
    shellcomm("./make-driver-dir.py %s --output-dir %s" %
        (driver_input_dir, driver_output_dir))

    # Generate RPM input archive + vfd + iso
    shellcomm("./make-virtio-win-rpm-archive.py %s %s" %
        (buildversions.virtio_rpm_str, driver_output_dir))
    shellcomm("mv *.tar.gz %s" % rpm_src_dir)

    # Alter and save spec + changelog
    spec = Spec(buildversions)
    _prompt_for_rpm_changelog(buildversions, spec)
    spec.write_changes(rpm_src_dir)

    # Call rpmbuild
    rpm_build_dir = _tempdir('rpmbuild-buildroot')
    rpm_output_dir = _tempdir('rpmbuild-output')
    _rpmbuild(spec, rpm_src_dir, rpm_build_dir, rpm_output_dir)

    if options.rpm_only:
        print("RPMs can be found in: %s" % rpm_output_dir)
        return 0

    # Trigger make-repo.py
    cmd = ("./make-repo.py --rpm-output %s --rpm-buildroot %s" %
        (rpm_output_dir, rpm_build_dir))
    print("\n\n")
    print(cmd)
    if yes_or_no("Run that make-repo.py command? (y/n): "):
        shellcomm(cmd)

    print()
    print()
    print("Don't forget to:")
    print("- Commit all the spec file changes")
    print("- If this is a stable build, update the STABLE_RPMS list in")
    print("  this scripts code and re-run with --repo-only")
    print("- Delete any local tmp* dirs")
    print()

    return 0
Пример #2
0
def _push_repos(reverse):
    """
    rsync the changes to fedorapeople.org
    """
    print()
    print()
    _run_rsync(reverse=reverse, dry=True)

    print()
    print()
    if not yes_or_no("Review the --dry-run changes. "
        "Do you want to push? (y/n): "):
        sys.exit(1)

    _run_rsync(reverse=reverse, dry=False)
def _prompt_for_rpm_changelog(buildversions, spec):
    """
    Interactively edit the rpm changelog, and confirm it
    """
    def _editable_tempfile(prefix, content):
        _tmp = tempfile.NamedTemporaryFile(prefix=prefix, mode="w+")
        _tmp.write(content)
        _tmp.flush()
        _tmp.seek(0)
        return _tmp

    # Save package changelogs to temporary files
    voutput = subprocess.check_output(
        "unzip -p %s/%s-sources.zip "
        "internal-kvm-guest-drivers-windows/status.txt | cat" %
        (NEW_BUILDS_DIR, buildversions.virtio_prewhql_str),
        shell=True,
        text=True)
    vtmp = _editable_tempfile("virtio-clog", voutput)

    qoutput = subprocess.check_output(
        "unzip -p %s/%s-sources.zip "
        "spice-qxl-wddm-dod/Changelog | cat" %
        (NEW_BUILDS_DIR, buildversions.qxlwddm_str),
        shell=True,
        text=True)
    qtmp = _editable_tempfile("qxldod-clog", qoutput)

    # Confirm with the user that everything looks good
    while True:
        os.system("clear")
        tmp = _editable_tempfile("rpm_changelog", spec.newclog)
        os.system("vim -p %s %s %s" % (vtmp.name, qtmp.name, tmp.name))
        spec.newclog = tmp.read()
        tmp.close()
        os.system("clear")

        print(spec.diff())
        print()
        if yes_or_no("Use this spec diff? (y/n, 'n' to edit changelog): "):
            break
def main():
    options = parse_args()

    # Parse new package versions
    buildversions = BuildVersions()

    # Do some RPM buildroot prep
    rpm_src_dir = _tempdir('rpmbuild-src')
    _prep_rpm_src_dir(buildversions, rpm_src_dir)

    # Call public scripts to generate the virtio .zip
    driver_input_dir = _tempdir("make-driver-dir-input")
    _prep_driver_dir_input(driver_input_dir)

    # Build the driver dir/iso dir layout
    driver_output_dir = _tempdir("make-driver-dir-output")
    shellcomm("./make-driver-dir.py %s --output-dir %s" %
              (driver_input_dir, driver_output_dir))

    spec = Spec(buildversions)

    # Build the driver installer
    installer_output_dir = _tempdir("make-installer-output")
    spice_dir = _tempdir("spice-extracted")
    winfsp_dir = _tempdir("make-winfsp-output")
    _prep_spice_vdagent_msi(spice_dir)
    _prep_qxldod_msi(driver_input_dir, spice_dir)
    _prep_win_fsp_msi(winfsp_dir)

    spice_vdagent_x64_msi = _find_msi(spice_dir, 'spice-vdagent-', 'x64')
    spice_vdagent_x86_msi = _find_msi(spice_dir, 'spice-vdagent-', 'x86')

    spice_driver_x64_msi = _find_msi(spice_dir, 'QxlWddmDod_', 'x64')
    spice_driver_x86_msi = _find_msi(spice_dir, 'QxlWddmDod_', 'x86')

    qemu_ga_agent_dir = os.path.join(TOP_TEMP_DIR,
                                     "mingw-qemu-ga-rpm-extracted")
    qemu_ga_agent_x64_msi = _find_msi(qemu_ga_agent_dir, 'qemu-ga-', 'x64')
    qemu_ga_agent_x86_msi = _find_msi(qemu_ga_agent_dir, 'qemu-ga-', 'x86')

    win_fsp_msi = _find_msi(winfsp_dir, 'winfsp-', '')

    shellcomm(
        "./make-installer.py %s %s %s %s %s %s %s %s %s --output-dir %s" %
        (spec.newversion, driver_output_dir, spice_vdagent_x64_msi,
         spice_vdagent_x86_msi, spice_driver_x64_msi, spice_driver_x86_msi,
         qemu_ga_agent_x64_msi, qemu_ga_agent_x86_msi, win_fsp_msi,
         installer_output_dir))
    shellcomm("cp %s/* %s" % (installer_output_dir, rpm_src_dir))

    # Generate RPM input archive + vfd + iso
    shellcomm("./make-virtio-win-rpm-archive.py %s %s" %
              (buildversions.virtio_rpm_str, driver_output_dir))
    shellcomm("mv *.tar.gz %s" % rpm_src_dir)

    # Alter and save spec + changelog
    _prompt_for_rpm_changelog(buildversions, spec)
    spec.write_changes(rpm_src_dir)

    # Call rpmbuild
    rpm_build_dir = _tempdir('rpmbuild-buildroot')
    rpm_output_dir = _tempdir('rpmbuild-output')
    _rpmbuild(spec, rpm_src_dir, rpm_build_dir, rpm_output_dir)

    if options.rpm_only:
        print("RPMs can be found in: %s" % rpm_output_dir)
        return 0

    # Trigger make-repo.py
    cmd = ("./make-repo.py --rpm-output %s --rpm-buildroot %s" %
           (rpm_output_dir, rpm_build_dir))
    print("\n\n")
    print(cmd)
    if yes_or_no("Run that make-repo.py command? (y/n): "):
        shellcomm(cmd)

    print()
    print()
    print("Don't forget to:")
    print("- Commit all the spec file changes")
    print("- If this is a stable build, update the STABLE_RPMS list in")
    print("  this scripts code and re-run with --repo-only")
    print("- Delete any local tmp* dirs")
    print()

    return 0