3a516fb distgit-branch-unused: refuse removal of branches when modular builds exist

1 file Authored by zbyszek 3 years ago, Committed by mohanboddu 3 years ago,
    distgit-branch-unused: refuse removal of branches when modular builds exist
    
    So far this script would completely ignore modular builds, possibly
    allowing deletion of commits that we used for them. Some rules to figure
    out when a given commit was used for modular builds were suggested by @psabata
    in https://pagure.io/fesco/issue/2387#comment-662880, but they require a lot
    more logic and talking to the mbs.
    
    As a simpler solution, @decathorpe suggested simply refusing if *any*
    module builds are present, https://pagure.io/fesco/issue/2387#comment-670035.
    This patch implements that.
    
    Example:
    (before)
    $ distgit-branch-unused.py --repository rust-zram-generator f30; echo $?
    Checking package rust-zram-generator in /home/zbyszek/fedora/rust-zram-generator
    Found branch f30 in bodhi with tags: f30-container, f30-container-updates, f30-container-updates-testing, f30-container-updates-candidate, f30-container-updates-testing-pending, f30-container-updates-pending, f30-container-override
    Checking for rust-zram-generator in tag f30-container... (no)
    Checking for rust-zram-generator in tag f30-container-updates... (no)
    Checking for rust-zram-generator in tag f30-container-updates-testing... (no)
    Checking for rust-zram-generator in tag f30-container-updates-candidate... (no)
    Checking for rust-zram-generator in tag f30-container-updates-testing-pending... (no)
    Checking for rust-zram-generator in tag f30-container-updates-pending... (no)
    Checking for rust-zram-generator in tag f30-container-override... (no)
    No builds found in koji for branch f30
    Branch merged into refs/heads/f31, refs/heads/f32, refs/heads/master. Safe to delete.
    0
    
    (now)
    $ distgit-branch-unused.py --repository rust-zram-generator f30; echo $?
    Checking package rust-zram-generator in /home/zbyszek/fedora/rust-zram-generator
    Found branch f30 in bodhi with tags: f30-container, f30-container-updates, f30-container-updates-testing, f30-container-updates-candidate, f30-container-updates-testing-pending, f30-container-updates-pending, f30-container-override
    Checking for rust-zram-generator in tag f30-container... (no)
    Checking for rust-zram-generator in tag f30-container-updates... (no)
    Checking for rust-zram-generator in tag f30-container-updates-testing... (no)
    Checking for rust-zram-generator in tag f30-container-updates-candidate... (no)
    Checking for rust-zram-generator in tag f30-container-updates-testing-pending... (no)
    Checking for rust-zram-generator in tag f30-container-updates-pending... (no)
    Checking for rust-zram-generator in tag f30-container-override... (no)
    No builds found in koji for branch f30
    Querying koji for builds...
    Modular build rust-zram-generator-0.1.2-1.module_f32+6777+4fdfe9cf found.
    Package was used in modular builds, this script is not smart enough.
    1
    
    Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>