bldcat creates a tmp directory for unpacking packages into using the function File::Temp::tempdir with the CLEANUP flag set.
According to the File::Temp docs, CLEANUP cleans up when the program exits:
Create a temporary directory using the supplied template, but attempt to remove it (and all files inside it) when the program exits.
via http://perldoc.perl.org/File/Temp.html
Delaying cleanup of temporary directories containing expanded packages until bldcat has finished is not an ideal situation. It means that storage space required for generating a catalog is larger than the storage space required for the packages, which can become problematic when building a catalog containing a large number of packages.
I could not find a particular reason for all packages to remain expanded until bldcat completes. It looks to me as if bldcat processes packages one at a time.
To remedy the situation I placed a call to File::Temp::cleanup at the end of the main inspection loop. Docs for File::Temp::cleanup:
Calling this function will cause any temp files or temp directories that are registered for removal to be removed. This happens automatically when the process exits but can be triggered manually if the caller is sure that none of the temp files are required. This method can be registered as an Apache callback.
Note that if a temp directory is your current directory, it cannot be removed. C out of the directory first before calling C. (For the cleanup at program exit when the CLEANUP flag is set, this happens automatically.)
On OSes where temp files are automatically removed when the temp file is closed, calling this function will have no effect other than to remove temporary directories (which may include temporary files).
This call causes temporary directories to be cleaned up after each package is processed. Thus the issue of N storage space being used while building a catalog is alleviated.
Attached is a patch.
Thanks for the patch, I have built new 2.6.7 packages available at http://buildfarm.opencsw.org/experimental.html#bonivart, please take them for a spin and let me know if they are OK so I can release them to the unstable repo.
Fixed packages released to OpenCSW unstable repo.