command-line-hacks.sh 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # List all the packages depending on packages modified on top of origin/master
  2. new_or_updated_packages() {
  3. # arg1: git refspec start (default: origin/master)
  4. # arg2: git refspec stop (default: HEAD)
  5. git log "${1:-origin/master}..$2" --oneline |
  6. grep -E 'gnu: ([[:graph:]]+:|Add)' |
  7. sed -E 's/.*gnu: Add (.*).$/\1/' |
  8. sed -E 's/.*gnu: ([^:]*):.*/\1/' |
  9. sed -E 's/-([0-9.]*)$/@\1/' | sort | uniq
  10. }
  11. packages=$(new_or_updated_packages)
  12. impacted_packages=$(./pre-inst-env guix refresh -l $packages |
  13. sed 's/@\S*//g' | sed 's/^.*: //' | tr ' ' "\n" |
  14. sort | uniq)
  15. Example of result for git log --oneline origin/master..HEAD
  16. $ git log --oneline origin/master..HEAD
  17. e6281e7799 (HEAD -> master) gnu: python-psutil: Update to 5.8.0.
  18. 2aa1c322e4 gnu: python-geventhttpclient: Adjust to build with updated gevent.
  19. da5422af1d gnu: python-greenlet: Update to 1.0.0.
  20. f446f77d24 gnu: python-locust: Update to 1.4.3.
  21. 2268ae6fa9 doc: Add an example of how the open file descriptors limit can be raised.
  22. aa36e7873f gnu: python-gevent: Update to 21.1.2.
  23. Then running the above command yields:
  24. $ echo $impacted_packages
  25. s-tui bpytop thefuck clipper cwltool python-pytest-xprocess python-ccm
  26. terminator python-pytest-openfiles python-transient
  27. python-pytest-services python-sanic python-hyperkitty
  28. python-mailman-hyperkitty python-hicexplorer python-pygenometracks
  29. python-hic2cool synapse python-celery python-gridmap
  30. python-scikit-image poetry pigx glances python-pysnptools
  31. rapid-photo-downloader certbot ganeti unknown-horizons bpython
  32. python-pynvim python-locust xandikos websockify python-swiftclient
  33. python-ws4py eolie python-pykafka python-gipc python-pykka
  34. gnome-shell-extension-gsconnect syncthing-gtk onionshare
  35. # Use the above to find out which packages are currently building
  36. broken_packages=$(guix weather --display-missing $impacted_packages |
  37. awk '/\/gnu\/store/ \
  38. { print(gensub("[^-]*-(.*)-[0-9]+.*$", "\\1", 1, $1)) }' |
  39. sed -E 's/(-[0-9.]*)*$//' | sort | uniq)
  40. $ echo $broken_packages
  41. s-tui
  42. clipper
  43. python-pytest-xprocess
  44. python-ccm
  45. python-pytest-openfiles
  46. glances
  47. python-pysnptools
  48. python-hyperkitty
  49. python-hicexplorer
  50. python-hic2cool
  51. python-scikit-image
  52. python-pynvim
  53. python-swiftclient
  54. python-pykafka
  55. python-pykka
  56. # Which means the above impacted_packages are likely already broken on origin/master.
  57. # Let's see if our changes improved/worsened the situation!
  58. $ ./pre-inst-env guix build --keep-going $impacted_packages
  59. [...]
  60. # Alternatively, if the broken packages are costly to attempt building
  61. # and not your current focus, you could omit rebuilding them with:
  62. known_good_impacted_packages=$(echo $impacted_packages | tr ' ' "\n" | sort |
  63. comm -3 - <(echo $broken_packages |
  64. tr ' ' "\n" | sort))
  65. $ ./pre-inst-env guix build --keep-going $known_good_impacted_packages
  66. # Let's lint
  67. ./pre-inst-env guix lint $packages