Removing unwanted tarballs from the dist-git rpms

Description

This SOP provides instructions for sysadmin-main level users to remove unwanted tarballs and source RPMs from a branch in the dist-git repositories on Fedora’s infrastructure.

Access level required

  • sysadmin-main

Machine

  • pkgs01.rdu3.fedoraproject.org

Steps to access the machine

  1. SSH into batcave01.rdu3.fedoraproject.org:

       ssh batcave01.rdu3.fedoraproject.org
  2. Switch to the root user:

       sudo su
  3. SSH into pkgs01.rdu3.fedoraproject.org:

       ssh pkgs01.rdu3.fedoraproject.org

Removing unwanted tarballs from dist-git

To remove unwanted tarballs and source RPMs from a specific branch of a package in the dist-git repository:

  1. Navigate to the package repository:

       cd /srv/git/repositories/rpms/PKG_NAME.git
  2. Disable warning messages:

       FILTER_BRANCH_SQUELCH_WARNING=1
  3. Rewrite history on the desired branch:

       git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch *.src.rpm *.tar.gz' --original refs/archive -- BRANCH

Replace *.src.rpm *.tar.gz with the actual file name, that you would like to remove. If you want to remove file from all branches use --all instead of BRANCH.

  1. Move the backup reference:

       mv refs/archive/refs/heads/BRANCH refs/archive/BRANCH
  2. Remove the redundant directories:

       rm -r refs/archive/refs/

Replace PKG_NAME with the name of the package. Replace BRANCH with the target branch name.

Verification

Verify the unwanted files have been removed from the branch history.

  1. Run Verification

        git for-each-ref --format='%(refname:short)' | while read branch; do
            echo "Checking $branch:"
            git ls-tree -r $branch --name-only | grep -q "$FILE_NAME" && echo "FOUND in $branch" || echo "Not in $branch"
        done

Use actual file name instead of $FILE_NAME.