colcon / colcon-clean

A colcon extension to clean package workspaces
http://colcon.readthedocs.io
Apache License 2.0
46 stars 4 forks source link

What is the expected behaviour of ``colcon clean workspace``? #27

Closed ijnek closed 2 years ago

ijnek commented 2 years ago

I've been wanting to try this out since the last Infrastructure office hours meeting, and finally got around to it today! With the package not available on PyPI yet (I believe it isn't?), I just installed it with pip3 install ., hoping that's the right way.

I was expecting colcon clean workspace to do something similar to rm -rf build/ install/ log/ or rm -rf build/* install/* log/*, but files in the directories seem to remain. What is the expected behaviour?

This is the behaviour I'm seeing:

ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ ls install/
COLCON_IGNORE   ipm_library  local_setup.bash  local_setup.sh            _local_setup_util_sh.py  setup.bash  setup.sh
ipm_interfaces  ipm_service  local_setup.ps1   _local_setup_util_ps1.py  local_setup.zsh          setup.ps1   setup.zsh
ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ colcon clean workspace
Paths:
     build
     install
     log
Clean the above paths? [Y/n] Y
ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ ls install/
COLCON_IGNORE   ipm_library  local_setup.bash  local_setup.sh            _local_setup_util_sh.py  setup.bash  setup.sh
ipm_interfaces  ipm_service  local_setup.ps1   _local_setup_util_ps1.py  local_setup.zsh          setup.ps1   setup.zsh
ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ ls install/ipm_library/
lib/   share/ 
ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ ls install/ipm_library/
lib  share
ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ ls install/ipm_library/share/
ament_index  colcon-core  ipm_library
ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ ls install/ipm_library/share/ipm_library/
hook  package.bash  package.dsv  package.ps1  package.sh  package.xml  package.zsh
ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ 

On Ubuntu22.04.

ruffsl commented 2 years ago

The expected behavior should be as you describe. The only caveat being the log file generated by colcon clean verb will repopulate the emptied log folder. E.g:

That being said, could you report back on the contents of that log file? Perhaps there was some warning or error in deleting those workspace directories, like any permission errors?

ijnek commented 2 years ago

Sure, here's the log:

ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$ cat log/latest_clean/logger_all.log 
[0.373s] DEBUG:colcon:Command line arguments: ['/usr/bin/colcon', 'clean', 'workspace']
[0.373s] DEBUG:colcon:Parsed command line arguments: Namespace(log_base='log', log_level=None, verb_name='clean', subverb_name='workspace', verb_parser=<colcon_mixin.mixin.mixin_argument.MixinArgumentDecorator object at 0x7fbecf8977f0>, verb_extension=<colcon_clean.subverb.workspace.WorkspaceCleanSubverb object at 0x7fbed0231090>, main=<bound method WorkspaceCleanSubverb.main of <colcon_clean.subverb.workspace.WorkspaceCleanSubverb object at 0x7fbed0231090>>, yes=False, clean_match=None, clean_ignore=None, clean_no_linked_dirs=True, clean_no_linked_files=True, base_select=['build', 'install', 'log', 'test_result'], base_ignore=[], build_base='build', install_base='install', test_result_base='build', event_handlers=None, mixin_files=None, mixin=None, mixin_verb=('clean', 'workspace'))
ijnek@ijnek-MS-7924:~/tmp_workspaces/ipm_ws$
ruffsl commented 2 years ago

@ijnek , thanks for reporting this issue! Please check out https://github.com/colcon/colcon-clean/pull/28 .

ijnek commented 2 years ago

I can confirm the changes fixed the problem, thanks @ruffsl