mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
663 B

  1. #!/bin/bash
  2. # Usage example:
  3. # for x in [0-9]*.patch; do bash genprifixdiff.sh ${x%.patch}; done
  4. if [ -f fixdiff_$1.patch ]; then
  5. echo "Found existing fixdiff for $1!"
  6. exit 1
  7. fi
  8. cp $1.patch $1.patch_new
  9. for descfile in $( lsdiff $1.patch | grep '\.desc$'; )
  10. do
  11. currpri=$( grep '^\[P\]' $descfile | sed 's, *$,,; s,.* ,,'; )
  12. if [ -n "$currpri" ]; then
  13. perl -i -pe "
  14. if (not \$done) {
  15. \$gotit = 1 if m,$descfile,;
  16. \$done = 1 if \$gotit and s/(\[P\].*)([0-9]{3}\.[0-9]{3})/\${1}$currpri/;
  17. }
  18. " $1.patch_new
  19. fi
  20. done
  21. {
  22. echo "Generated using genprifixdiff.sh"
  23. diff -u $1.patch $1.patch_new
  24. } > fixdiff_$1.patch
  25. rm -f $1.patch_new
  26. exit 0