Re: Script to get all deps of a package (for soname bumps etc.)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 13, 2022 at 8:19 AM Ankur Sinha <sanjay.ankur@xxxxxxxxx> wrote:
Hi folks,

I'm sure this exists somewhere but I couldn't find one, so with the help
of folks on #fedora-devel, I hacked up this simple shell script to get
the all the deps of a package. It's useful when your package update
includes a soname bump, and you need to figure out what packages need to
be rebuilt etc.

I use this script which I'm pretty sure I pieced together from some of Sergio's logic some time ago. I like that it saves them to a file so I can iterate over them with other scripts.

$ cat ~/.local/bin/needs_rebuilding
#!/bin/bash

if [ $# -eq 0 ]
  then
    echo "No arguments supplied"
    echo "Usage: $0 <pkgname> [pkgname] ..."
    exit 0
fi

provides=$(mktemp -t provides-XXXXXX)
deps=$(mktemp -t rawdeps-XXXXXX)

# Only break on newline not space or tab in for loops
IFS=$'\n'

for pkg in "$@"; do
echo "Checking for provides in $pkg."
dnf --quiet repoquery --repoid=rawhide --provides "$pkg" >> $provides
done

sed -i "/^bundled/d" $provides
sort -u -o $provides $provides

echo "Found $(wc -l $provides | awk '{print $1}') provides to be evaluated."

for dep in $(cat $provides); do
echo "Checking requirements for $dep"
dnf --quiet repoquery --repoid=rawhide --qf "%{source_name}" --whatrequires "$dep" >> $deps
done

sort -u -o ./needs_rebuilding $deps

# Remove the packages being checked
for pkgname in "$@"; do
sed -i "/$pkgname/d" needs_rebuilding
done

echo "Rebuild dependencies saved to ./needs_rebuilding"



Thanks,
Richard 
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux