mirror of
https://abf.rosa.ru/djam/urpm-tools.git
synced 2025-02-23 03:32:49 +00:00
init urpm-wrb script
This commit is contained in:
parent
5fdbcde0f9
commit
b5c55c2504
2 changed files with 51 additions and 1 deletions
3
Makefile
3
Makefile
|
@ -34,10 +34,11 @@ install:
|
|||
for d in $(SUBDIRS); do make DESTDIR=$(DESTDIR) -C $$d install; [ $$? = 0 ] || exit 1; done
|
||||
|
||||
install -m 644 urpmmisc.py $(DESTDIR)/$(PKGDIR)/urpmmisc.py;
|
||||
install -m 755 urpm-wrb.sh $(DESTDIR)/usr/bin/urpm-wrb
|
||||
|
||||
|
||||
for d in `python localizer.py --list`; do\
|
||||
mkdir -p $(DESTDIR)/usr/share/locale/$$d/LC_MESSAGES;\
|
||||
install -m 644 locale/$$d/LC_MESSAGES/urpm-tools.mo $(DESTDIR)/usr/share/locale/$$d/LC_MESSAGES/urpm-tools.mo;\
|
||||
done
|
||||
|
||||
|
||||
|
|
49
urpm-wrb.sh
Executable file
49
urpm-wrb.sh
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env bash
|
||||
# urpm-wrb: what to rebuild after ABI breakage or major so version bump
|
||||
# Authors:
|
||||
# - Mikhail Novosyolov <m.novosyolov@rosalinux.ru>, 2019
|
||||
|
||||
echo_help(){
|
||||
echo "
|
||||
urpm-wrb helps to find names of source packages which have to be rebuilt e.g. after ABI breakage or major so version bump.
|
||||
|
||||
Usage:
|
||||
urpm-wrb <list of packages>
|
||||
Examples:
|
||||
urpm-wrb lib64krb5_3
|
||||
urpm-wrb lib64krb5_3 lib64kdb5_8 lib64kadm5srv_mit10
|
||||
"
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
TMP="$(mktemp)"
|
||||
trap 'rm -rf "$TMP"' EXIT INT QUIT TERM
|
||||
|
||||
_main_method2(){
|
||||
while read -r line
|
||||
do
|
||||
while read -r line2
|
||||
do
|
||||
urpmq --sourcerpm "$line2" | awk -F ': ' '{print $2}' | rev | cut -d '-' -f 3- | rev
|
||||
done < <(urpmq --whatrequires "$line")
|
||||
done < <(echo "$@" | sed -e "s, ,\\n,g")
|
||||
}
|
||||
|
||||
_main(){
|
||||
# First try the fastest method, but it will not work if either of packages from the list
|
||||
# does not have reverse dependencies
|
||||
urpmq --whatrequires --sourcerpm "$@" | awk -F ': ' '{print $2}' | rev | cut -d '-' -f 3- | rev | sort -u > "$TMP"
|
||||
method1_rc="${PIPESTATUS[0]}"
|
||||
if [ "$method1_rc" != 1 ]
|
||||
then if [ "$(cat "$TMP" | wc -l)" -gt 0 ]; then cat "$TMP"; return; fi
|
||||
else exit 1
|
||||
fi
|
||||
|
||||
# If nothing was found and if there were no errors, try a longer method
|
||||
_main_method2 "$@" | sort -u
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
-h | --help | -help ) echo_help 0 ;;
|
||||
* ) if [ -n "$1" ]; then _main "$@"; else echo_help 2 ; fi ;;
|
||||
esac
|
Loading…
Add table
Reference in a new issue