Skip to content

Instantly share code, notes, and snippets.

@hanynowsky
Created April 28, 2015 08:53
Show Gist options
  • Select an option

  • Save hanynowsky/af5e2dc70149de0850cd to your computer and use it in GitHub Desktop.

Select an option

Save hanynowsky/af5e2dc70149de0850cd to your computer and use it in GitHub Desktop.
force removal of a Koji package
WORKDIR="/tmp"
SQLFILE=$1.sql
cat > $WORKDIR/$SQLFILE << EOF
delete from tag_listing where build_id in (select id from build where pkg_id in (select id from package where name = '$1'));
delete from rpmsigs where rpm_id in (select id from rpminfo where build_id in (select id from build where pkg_id in (select id from package where name = '$1')));
delete from buildroot_listing where rpm_id in (select id from rpminfo where build_id in (select id from build where pkg_id in (select id from package where name = '$1')));
delete from rpminfo where build_id in (select id from build where pkg_id in (select id from package where name = '$1'));
delete from build where pkg_id = (select id from package where name = '$1');
delete from tag_packages where package_id = (select id from package where name = '$1');
delete from package where name = '$1';
EOF
su - koji -c "psql koji < $WORKDIR/$SQLFILE"
# remove old package directory otherwise koji failed
rm -rf /mnt/koji/hub/packages/$1/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment