Skip to content

Instantly share code, notes, and snippets.

@eclipseo
Last active December 20, 2020 02:11
Show Gist options
  • Save eclipseo/ef12d7b6ef8ce809621efb1d536e4723 to your computer and use it in GitHub Desktop.
Save eclipseo/ef12d7b6ef8ce809621efb1d536e4723 to your computer and use it in GitHub Desktop.
Golang on Side Tags
set release 33
set build (fedpkg verrel)
set pkg (string split -m 2 -r - $build)[1]
set tag (fedpkg request-side-tag --base-tag f$release-build | grep -oE "(f[0-9]{2}-build-side-[0-9]{5})" | head -1)

fedpkg clone $pkg
cd $pkg
fedpkg request-branch f$release --no-git-branch

set buildroot (~/golang-buildroot.py list-buildroot $build)
set buildroot_pkgs (string split -m 2 -r - $buildroot | grep '^[a-z].*' | sort)
koji add-pkg --owner releng $tag $buildroot_pkgs $pkg --force
koji tag-build $tag $buildroot

echo $buildroot | xargs -P32 -n1 koji wait-repo $tag --build

fedpkg build --target $tag --skip-nvr-check
koji untag-build $tag $buildroot

# Create bodhi update
#!/usr/bin/python3
import sys
import click
import koji as _koji
@click.group()
@click.option("--profile", default="koji", help="Koji profile")
@click.pass_context
def cli(ctx, profile):
koji = _koji.get_profile_module(profile)
session_opts = koji.grab_session_options(koji.config)
session = koji.ClientSession(koji.config.server, session_opts)
ctx.obj = session
@cli.command()
@click.argument("nvr")
@click.pass_obj
def list_buildroot(session, nvr):
build = session.getBuild(nvr, strict=True)
if build["state"] != _koji.BUILD_STATES["COMPLETE"]:
click.echo("Build is not in the COMPLETE state")
sys.exit(1)
task = session.listTasks(
opts={"method": "buildArch", "parent": build["task_id"]}, queryOpts={"limit": 1}
)[0]
buildroot = session.listBuildroots(
taskID=task["id"], queryOpts={"order": "-id", "limit": 1}
)[0]
rpms = session.listRPMs(componentBuildrootID=buildroot["id"])
with session.multicall(strict=True) as m:
srpms = [
m.listRPMs(buildID=rpm["build_id"], arches="src", queryOpts={"limit": 1})
for rpm in rpms
if (rpm["name"].startswith("golang-") and rpm["name"].endswith("-devel"))
or (
rpm["name"].startswith("compat-golang-")
and rpm["name"].endswith("-devel")
)
or (rpm["name"].startswith("containerd") and rpm["name"].endswith("-devel"))
or (rpm["name"].startswith("go-rpm-macros"))
or (rpm["name"].startswith("redhat-rpm-config"))
]
nvrs = set(data.result[0]["nvr"] for data in srpms)
print("\n".join(sorted(nvrs)))
if __name__ == "__main__":
cli()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment