function pre_process

Combine the variables given and the system defaults and preferences to derive the most important details about the sources and package to be created.

Main purpose

  1. Derive the final NAME, VERSION, ARCH and BUILD variables for the package.
  2. Verify the validity of directories and variables given

Notes

Support for rpm archives makes the job of getting the name right more complicated. There's about 200 lines of code which try to guess the right name and version based on the name of the source archive given as SOURCE_NAME, SOURCE or SOURCE_URL or derived from the name of the current directory.

Using SOURCE_NAME is the normal way to specify the archive name if it's already located on your system in the SOURCES_DIR(see /etc/src2pkg/src2pkg.conf for details).

SOURCE should be used if you want to specify a hard path to an archive which overrides SOURCES_DIR.

Both SOURCE_NAME and SOURCE should also work with relative paths like './subdir' or 'thisdir/thatdir'.

SOURCE_URL is needed if you are want to supply a URL address to an archive for downloading. src2pkg will later look for an archive with the requested name(minus the URL location) in your SOURCES_DIR and if not present it will be downloaded for you.

Unless specified, ARCH is calculated to match your running system architecture. The CFLAGS variable used to configure and compile sources is also set here unless you've already given it

pre_process should always be run first as all other functions depend on the ouptut from pre_process. When you use the src2pkg program to write a new *.src2pkg build script(with -N option) it uses only this function to get enough information to write a basic script.

pre_process separates the final NAME and VERSION for the package from the real name and location of the source archive so they don't have to be the same. This function will automatically correct the name if it contains capital letters unless you disable this feature using CORRECT_NAMES=NO. It also allows you to override  the derived NAME and VERSION by specifying them using ALT_NAME or ALT_VERSION. This is useful if you want a special name for the package or if src2pkg doesn't guess them correctly.
In some extreme cases this function makes drastic changes to the name and version in an effort to come up with what looks like a resonable name and version which are also Slackware conformant. RPM archive names are particularly complex and varied. You can also easily change the name and version by using a link to the full archive with the desired new name and version.

Correction of capital letters is a matter of personal choice since the Slackware pkgtools will not complain or fail if using packages with capital letters in the name. Slackware doesn't include packages with capital letters so src2pkg corrects them by default. For example, WindowMaker-0.92.0.tar.bz2 would yield the corrected name windowmaker.
However, the placement and usage of '-' (dash) characters in package names is essential to proper functioning of pkgtools. pre_process does a pretty good job of getting the correct name and version from many types of names, but can always be overridden when needed.