Google

CCP4i Documentation for Programmers: Core Documentation

Contents

Utilities for managing task installation (src/CCP4i_packages_utils.tcl)

Utilities for managing task installation

Utilities for installing, uninstalling and exporting task interface packages, and manipulating ccp4i_packages.def files.

InstallTaskPackage Driver procedure to perform installation of a new task

Argument list: <package_name> <location> <archive_file> <args>

Install or update a package with identifier package_name from the specified archive_file. The package will be installed in either the main CCP4i area (accessible to all users) or the user's local CCP4i (accessible only to them), depending on the location argument. A record of the installation is stored in the relevant ccp4i_packages.def file.

By default the installation will proceed automatically based on the information and files found in the archive_file. The calling procedure can over-ride this by supplying alternative information for each attribute via the arguments below.

InstallPackage can run in two different modes, specified by the -mode option. The default is 'nongraphical' mode, which means that warnings and error messages are written to the standard output. In 'graphical' mode these warnings are displayed graphically using the WarningMessage procedure.

Returns 1 if the installation was successful, 0 if it failed.

package_name Identifier for the package

location Either MAIN (the main CCP4i area) or LOCAL (user's private CCP4i area)

archive_file A tar or tar.gz archive file containing the task package to be installed. Alternatively, it can be a directory where the archive file has already been unpacked.

-version version

Version control string of the form "major.minor.patch"

-task_files list_of_files

Specify alternative list of task files (.tcl and .def) to be installed

-script_files list_of_files

Specify alternative list of script files (.script)

-com_files list_of_files

Specify alternative list of template files (.com)

-help_files list_of_files

Specify alternative list of help files (.html)

-task_references list_of_references

Specify task references to be added to the modules.def file. Each task reference must be a list consisting of: task_name task_title task_description module_name module_title

-install_script script_file

Specify a script to be run before installing the package

-no_install_script

Do not run the install script, even if one is found

-mode run_mode

Warning and error messages will be displayed in a window (run_mode = graphical) or written to standard output (run_mode = nongraphical)

ExportTaskPackage Driver procedure to create a task package archive file

Argument list: <package_name> <archive_file> <args>

Create an installable tar.gz archive file for a package with identifier package_name. The contents and attributes of the package are specified via the optional arguments.

ExportPackage can run in either 'nongraphical' (the default) or 'graphical' modes, as specified by the -mode option. In the former warning and error messages are written to the standard output, in the latter they are displayed graphically using the WarningMessage procedure.

Returns 1 if the package was successfully exported, 0 if it failed.

package_name Identifier for the package

archive_file Archive file to be written

-version version

Version control string of the form "major.minor.patch"

-task_files list_of_files

Specify list of task files (.tcl and .def) for inclusion

-script_files list_of_files

Specify list of script files (.script) for inclusion

-com_files list_of_files

Specify list of template files (.com) for inclusion

-help_files list_of_files

Specify list of help files for inclusion

-task_references list_of_references

Specify task references to be added to the modules.def file

-install_script script_file

Specify a script to be run before installing the package

-mode run_mode

Warning and error messages displayed in a window (run_mode = graphical) or written to standard output (run_mode = nongraphical)

UninstallTaskPackage Driver procedure to uninstall a previously installed task package

Argument list: <package_name> <location> <args>

Uninstall the package with identifier package_name from either the main CCP4i area or the user's local CCP4i area (depending on the value of the location argument), using the information stored in the relevant ccp4i_packages.def file.

The uninstall will remove the files associated with the package (restoring any backup files that it finds in the process) and remove any associated task references which were installed in the modules.def file. The package will be removed from the ccp4i_packages.def file.

UninstallPackage can run in two different modes, specified by the -mode option. The default is 'nongraphical' mode, which means that warnings and error messages are written to the standard output. In 'graphical' mode these warnings are displayed graphically using the WarningMessage procedure.

Returns 1 if the uninstallation was successful, 0 if it failed.

package_name Identifier for the package to be uninstalled

location Either MAIN (the main CCP4i area) or LOCAL (user's private CCP4i area)

-mode run_mode

Warning and error messages will be displayed in a window (run_mode = graphical) or written to standard output (run_mode = nongraphical)

ExamineTaskArchive Examine the contents of a task archive package file

Argument list: <package_name> <archive_file> <packagesVar>

Returns a list of the contents of a package archive file, as follows:

List element 0: list of tasks

List element 1: list of tcl files

List element 2: list of def files

List element 3: list of script files

List element 4: list of template files

List element 5: list of help files

List element 6: list of task references, read from the modules file in the package.

Each task reference is itself a list, consisting of: task name, task title, task description, module name and module title.

If the archive contents cannot be successfully read then an empty string is returned. If the archive contains a ccp4i_packages.def file then the contents are also read into an array called packagesVar and returned to the calling procedure.

package_name The name of the package

archive_file The full path of the archive (file)

packagesVar Name of the array variable in which information will be returned to the calling procedure

MakeTmpTaskInstallDir Create a temporary directory in which to unpack an archive file

Argument list: <package_name> <args>

Makes a subdirectory in TEMPORARY called install_(package_name). This is used by other procedures to unpack and examine the contents of the the archive file.

Returns the path of the temporary directory, or an empty string if there is an error.

NB The procedure will attempt to detect if it is operating in a non-graphical mode - if the ChooseOptionDialog procedure is not found then non-graphical mode is assumed and the -force option is taken as default.

package_name Identifier for package

-force

By default the user is queried if the temporary directory already exists. This option over-rides the query and forces deletion of the directory contents before recreating the directory.

GetTaskInstallDir Return the root path for the installation area

Argument list: <location>

Returns the path for the installation area depending on the value of the location argument. MAIN refers to the main CCP4i area pointed to by the CCP4I_TOP system variable, LOCAL refers to the user's private CCP4i area in \$HOME/.CCP4/CCP4I_TOP

location Installation area, either MAIN or LOCAL

GetTaskInstallFileDir Return the root path for the installation modules and packages files

Argument list: <location>

Returns the path for the directory holding the releveny modules.def and ccp4i_packages.def files depending on the value of the location argument. MAIN refers to the main CCP4i area (\$CCP4I_TOP/etc/(OPSYS)), LOCAL refers to the user's private CCP4i area (\$HOME/.CCP4/(opsys)).

location Installation area, either MAIN or LOCAL

UnpackTaskArchive Unpack a CCP4i task package archive file.

Argument list: <archive_file> <tmpdir>

Copy the task archive file to the temporary area, and uncompress and unpack it so that the contents can be examined. Returns the full path name of the unpacked directory, or an empty string if there was an error.

archive_file Full path name of the task archive file

tmpdir Full path name of the temporary directory

GetPackageList Return a list of CCP4i package names from a ccp4i_packages.def file

Argument list: <packages_file>

packages_file Full path name of the ccp4i_packages.def file of interest

GetPackageFiles Return a list of files for a package registered in a CCP4i subdirectory

Argument list: <packages_file> <package_name> <subdir>

Get a list of files in one of the CCP4i subdirectories (tasks, scripts, templates or help) which are associated with a currently installed package.

packages_file The full path name of the ccp4i_packages.def file

package_name Name of the CCP4i task package of interest

subdir The subdirectory of interest

GetPackageReferences Return a list of associated task references registered with a package

Argument list: <packages_file> <package_name>

Returns a list of task references from a ccp4i_packages.def file.

Each element of the list is also a list, describing the installed task references:

{task_title} {task_name} {task_descript} {module_name} {module_title}

packages_file The full path name of the ccp4i_packages.def file

package_name The name of the package of interest

GetPackageVersion Return the version string of a CCP4i task package in the ccp4i_packages.def file

Argument list: <packages_file> <package_name>

packages_file The full path of the ccp4i_packages.def file

package_name The name of the package to examine

UpdatePackagesEntry Update an entry in a ccp4i_packages.def file

Argument list: <packages_file> <package_name> <args>

Updates the existing entry for a CCP4i task package in a ccp4i_packages.def file, or creates a new entry if it doesn't currently exist.

packages_file The full path for the ccp4i_packages.def file

package_name The name of the CCP4i task package

-version version_string

Specifies the version string for the package

-task_files

List of associated files in the tasks directory (.tcl and .def)

-script_files

List of associated script files

-com_files

List of associated template (.com) files

-help_files

List of associated help files

-task_references

List of associated task references

-install_script

Name of an installation script

-backups

List of associated backup files

-modules

List of modules

RemovePackagesEntry Remove an existing entry from a ccp4i_packages.def file

Argument list: <packages_file> <package_name>

packages_file The full path for the ccp4i_packages.def file

package_name The name of the CCP4i task package whose entry is to be removed.

CreateTarFile Apply 'tar cf' to dir to create a tar file

Argument list: <file> <tar_dir> <parent_dir>

file Full pathname of tar file to create

tar_dir Name of directory to archive relative to parent_dir

parent_dir Directory to move to before creating tar file

ValidatePackageName Check that the supplied package name is valid

Argument list: <package_name>

Package names should only contain letters, numbers and underscores.

package_name Package name to check.

ComparePackageVersions Compare version strings for CCP4i task packages

Argument list: <version1> <version2>

Version strings should be of the form a(.b(.c)) i.e. major(minor(patch)).

Returns 0 if the versions are equivalent, 1 if version1 is higher than version2, 2 if version2 is higher than version1, or -1 if the comparison is ambiguious (e.g. one or both are not of the correct format).

version1 First version string

version2 Second version string

InstallReport Report a message from the install procedures.

Argument list: <message> <run_mode>

message Text of message to be displayed

run_mode Either graphical (message is displayed in a window) or nongraphical (message is written to stdout).