function post_process
Main purpose
- Perform any extra tasks not related to the package build (since
it has already been created) like removing leftover temporary files and
logs.
- Create extra reports or database files.
- Handle errors that have been encountered.
Notes
post_process takes care of any operaions that need to be done after the
package has been created.
Using MAKE_REPORT=YES causes this function to create a *.REPORT file in
the current directory with a lot of detailed information about the
package.
Using MAKE_DATABASE=YES will cause this function to create a *.DATABASE
file in the CWD which is a replica of the file which will be produced
when the package is installed using the 'installpkg' tool.
This function also takes care of removing temporary files created
during compiling and package creation if you are using the CLEANUP
option. By default temporary files are left intact so that you can
examine the content. It's a good idea to always do this when first
building a package so that you can be sure that package is complete and
properly built. The uncompressed content in the PKG_DIR exactly matches
the compressed content in the finished installable package. This also
gives you a chance to look at the sources in SRC_DIR if needed.
The CLEANUP option is best used in a transient manner -that is, only
when you are sure that the package build is succeeding completely and
correctly. Remember that if you are testing and rebuilding many times,
the make_dirs function will do this cleanup anyway before starting with
fresh directories.
Using CLEANUP=ALL will cause this function to delete the SRC_DIR,
PKG_DIR and the OBJ_DIR if used.
You can discriminate and only remove the PKG_DIR or the SRC_DIR &
OBJ_DIR if you like. Using CLEANUP=PKG removes only the PKG_DIR and
CLEANUP=SRC removes only the SRC_DIR and OBJ_DIR if used.
src2pkg handles most errors with its' own error detection system. There
are several reasons for this. Simply exiting anytime a command
returning a non-zero error code is not always accurate. Detecting
errors internally allows us to return an error string which is useful
for debugging. Most errors are handled in such a way that the src2pkg
script or program can exit gracefully with an exit error code of 0.
This is done so that, if the src2pkg script or program are being run by
another controlling parent script, the program flow control is returned
to the parent script.