Alien-Build icon indicating copy to clipboard operation
Alien-Build copied to clipboard

Alien::Build::MM: clean_install not called for system installs

Open shawnlaffan opened this issue 1 year ago • 3 comments

Possibly not a big issue, but it seems the clean_install option is not run when doing a system install.

I assume it should?

Example below uses Alien::libtiff given it can be installed as a system dep.

Tested using Ubuntu 20.04.6 LTS with the libtiff-dev package installed.

ALIEN="Alien::libtiff"
ALIEN_DIR="Alien-libtiff"

eval "$(perl -I$HOME/foo/lib/perl5 -Mlocal::lib=$HOME/foo)"

ALIEN_INSTALL_TYPE=share perl Makefile.PL && make install

touch ~/foo/lib/perl5/x86_64-linux/auto/share/dist/${ALIEN_DIR}/unclean.txt
ls ~/foo/lib/perl5/x86_64-linux/auto/share/dist/${ALIEN_DIR}/unclean.txt

make clean 
ALIEN_INSTALL_TYPE=share perl Makefile.PL && make install
ls ~/foo/lib/perl5/x86_64-linux/auto/share/dist/${ALIEN_DIR}/unclean.txt
#  is gone

touch ~/foo/lib/perl5/x86_64-linux/auto/share/dist/${ALIEN_DIR}/unclean.txt
ls ~/foo/lib/perl5/x86_64-linux/auto/share/dist/${ALIEN_DIR}/unclean.txt

make clean
ALIEN_INSTALL_TYPE=system perl Makefile.PL && make install
ls ~/foo/lib/perl5/x86_64-linux/auto/share/dist/${ALIEN_DIR}/unclean.txt
#  still there, as are the bin, lib etc dirs

shawnlaffan avatar Oct 11 '24 06:10 shawnlaffan

I think this was an oversight by myself. For consistency we should do clean_install for system installs too.

plicease avatar Oct 28 '24 13:10 plicease

It should just be a case of removing the conditional at https://github.com/PerlAlien/Alien-Build/blob/d53b4856aff59778d3de8895a5bd900181a74e97/lib/Alien/Build.pm#L1983

I can PR that.

Adding tests is slightly more complicated. It needs to be a share install followed by a share install, and then check the share dir is appropriately cleaned up. I'm not yet sure where to add this.

shawnlaffan avatar Oct 28 '24 21:10 shawnlaffan

Adding tests is slightly more complicated. It needs to be a share install followed by a share install, and then check the share dir is appropriately cleaned up. I'm not yet sure where to add this.

There is a test for this, for which the expectations need to be flipped.
https://github.com/PerlAlien/Alien-Build/blob/d53b4856aff59778d3de8895a5bd900181a74e97/t/alien_build_plugin_core_cleaninstall.t#L33

shawnlaffan avatar Oct 29 '24 01:10 shawnlaffan