#23 Add dependency-finding script
Merged 2 years ago by decathorpe. Opened 2 years ago by cipherboy.
cipherboy/stewardship-sig intersection  into  master

@@ -0,0 +1,44 @@ 

+ #!/bin/bash

+ 

+ set -euo pipefail

+ 

+ repoquery="/tmp/stewardship-sig-repoquery.txt"

+ maintained="/tmp/stewardship-sig-maintained.txt"

+ api="https://src.fedoraproject.org/api/0/group/stewardship-sig?projects=true"

+ 

+ if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then

+     echo "Usage: intersection.sh [--help] packages..."

+     echo ""

+     echo "Find the dependencies of a set of packages maintained by the SIG."

+     exit 0

+ fi

+ 

+ # Search for all recursive dependencies (Requires) of a list of packages,

+ # including both Requires and BuildRequires. Only shows results for the

+ # current rawhide.

+ dnf repoquery --requires --recursive --resolve --repo=fedora \

+               --repo=fedora-source --releasever=rawhide "$@" 2>/dev/null |

+     sed -e 's/ [| \\\_]\+\|-[[:digit:]]\+..*\|[[:digit:]]\://g' > "$repoquery.tmp"

+ 

+ sort -u < "$repoquery.tmp" > "$repoquery"

+ 

+ # Check for an empty repoquery file as that usually indicates an error

+ if [ ! -s "$repoquery" ]; then

+     echo Error: "$@" have no dependencies or doesn\'t exist.

+     exit 1

+ fi

+ 

+ # Download the current list of SIG-maintained packages from the API

+ curl -s "$api" |

+     jq -r '.projects[].name?' |

+     sort -u > "$maintained"

+ 

+ # Check for an empty maintained file as that usually indicates an error

+ if [ ! -s "$maintained" ]; then

+     echo Error: Fedora project API changed or internal failure.

+     exit 1

+ fi

+ 

+ # Show the common packages and clean up after ourselves

+ comm -1 -2 "$repoquery" "$maintained"

+ rm -f "$repoquery" "$repoquery.tmp" "$maintained"

This script lists all dependencies of a set of packages (as given on the
command line) which are maintained by the SIG. This includes recursive
dependencies.

To show the help text:

./scripts/intersection.sh --help

To show SIG packages which are required by Dogtag PKI:

./scripts/intersection.sh pki-ca

Signed-off-by: Alexander Scheel <ascheel@redhat.com>

rebased onto 18419fc

2 years ago

Should this rather use --repo rawhide (and rawhide-source)?

Yes, please use the --repo rawhide and --repo rawhide-source for repository queries.

The issues we're dealing with are still limited to rawhide, with the exception of the problems caused by the retirement of eclipse on 32bit - which affects fedora 30, as well.

Good catch, I'll update that today. I also want to revisit the Pagure API. I thought repo listing was limited to 100 results by default, I think the SIG has exceeded that in number of maintained packages. I could be wrong though.

Querying a group with ?projects=1 luckily does not limit the number of the group's projects that's returned. I'm doing that in the scripts that generate the reports, as well.

rebased onto 75a5d6e

2 years ago

This has been updated with feedback.

Pull-Request has been merged by decathorpe

2 years ago
Metadata