msys2 / msys2-autobuild

🏭🏭🏭🏭🏭🏭🏭🏭
https://packages.msys2.org/queue
MIT License
35 stars 25 forks source link

CI: add a step which uninstalls all potentially left over packages #87

Open lazka opened 1 month ago

lazka commented 1 month ago

In case a previous run has been aborted mid-run, there might still be packages installed. Make sure we get back to the minimal state again.

lazka commented 1 month ago

@jeremyd2019 is this useful?

jeremyd2019 commented 1 month ago

I do install some extra packages on the arm runner setup too. base-devel git mingw-w64-clang-aarch64-toolchain procps-ng psmisc zip unzip vim etc-update. I don't actually see a good reason for git to be in there at the moment. I included toolchain in there with the idea that it would reduce the amount of package thrashing.

lazka commented 1 month ago

ah, right, now I remember. hm

lazka commented 1 month ago

Something like this?

jeremyd2019 commented 1 month ago

The incantation I usually use to remove left-over packages is pacman -Rnsc $(pacman -Qtdq), but I just noticed today this does not work right when there's a circular dependency (like there was with harfbuzz).

jeremyd2019 commented 1 month ago

I tried your script to get the TO_REMOVE list, and I see:

mingw-w64-clang-aarch64-bzip2
mingw-w64-clang-aarch64-clang-analyzer
mingw-w64-clang-aarch64-clang-tools-extra
mingw-w64-clang-aarch64-crt-git
mingw-w64-clang-aarch64-expat
mingw-w64-clang-aarch64-libc++
mingw-w64-clang-aarch64-libmangle-git
mingw-w64-clang-aarch64-libsystre
mingw-w64-clang-aarch64-libtre-git
mingw-w64-clang-aarch64-lldb
mingw-w64-clang-aarch64-llvm-openmp
mingw-w64-clang-aarch64-lua
mingw-w64-clang-aarch64-make
mingw-w64-clang-aarch64-mpdecimal
mingw-w64-clang-aarch64-ncurses
mingw-w64-clang-aarch64-ntldd
mingw-w64-clang-aarch64-openssl
mingw-w64-clang-aarch64-pkgconf
mingw-w64-clang-aarch64-python
mingw-w64-clang-aarch64-python-six
mingw-w64-clang-aarch64-readline
mingw-w64-clang-aarch64-sqlite3
mingw-w64-clang-aarch64-tcl
mingw-w64-clang-aarch64-termcap
mingw-w64-clang-aarch64-tk
mingw-w64-clang-aarch64-tools-git
mingw-w64-clang-aarch64-tzdata
mingw-w64-clang-aarch64-winpthreads-git
mingw-w64-clang-aarch64-winstorecompat-git
procps-ng

some of that is expected (since you used -clang instead of -toolchain), but notably the -*-git and -libc++ packages stand out, it appears that script doesn't handle provides.

lazka commented 1 month ago

hm, I guess I could expand the group in the array if wanted (pactree doesn't do groups which is why I went for clang only)

jeremyd2019 commented 1 month ago

For the record, I removed git zip unzip from the packages I'll pre-install moving forward, and I am seriously considering switching from -toolchain to -cc to further reduce the set of packages (largely because lldb is part of toolchain, and lldb depends on python. There are probably other 'large' dependency branches in toolchain as well).

Regardless, what concerns me about this is that when I tested the scriptlet it thought it needed to uninstall -crt-git and friends. That suggests to me that it does not properly handle provides aliases (-clang depends on -crt, and -crt-git provides -crt). That's probably a showstopper for this change as-is

jeremyd2019 commented 1 month ago

What has been kicking around in my mind is what makepkg does for --syncdeps --rmdeps: it saves a list of all installed packages at the start (pacman -Qq), and then at the end it removes all packages that were not in that list (https://github.com/msys2/msys2-pacman/blob/761a878373f16db3c1825d1e8eea4c5167c36057/scripts/makepkg.sh.in#L322-L346). Unfortunately, if the runner fails in such a way that makepkg doesn't uninstall things, it seems unlikely that a subsequent step in the job would be able to clean things up either (ie, in a post step).

lazka commented 1 month ago

Regardless, what concerns me about this is that when I tested the scriptlet it thought it needed to uninstall -crt-git and friends. That suggests to me that it does not properly handle provides aliases (-clang depends on -crt, and -crt-git provides -crt). That's probably a showstopper for this change as-is

Indeed, seems like a pactree bug