#!/usr/bin/env python from os import environ, system, getcwd, chdir, popen, readlink from os.path import isdir, isfile, islink, join, dirname from sys import argv, exit, platform import re import getopt from string import split, strip, find, lower import platform from time import asctime from glob import glob program = 'difxbuild' version = '0.26' verdate = '20130607' author = 'Walter Brisken ' difxbuildUrl = 'http://www.aoc.nrao.edu/~wbrisken/difxbuild' openmpiVersion = '1.6' pgplotVersion = '5.2' gpstkVersion = '2.0' jamVersion = '2.5.2' pngVersion = '1.2.50' schedVersion = '11.0' skedVersion = '2013jan23' m4Version = '1.4.16' autoconfVersion = '2.69' automakeVersion = '1.11.6' libtoolVersion = '2.4' pkgconfigVersion = '0.28' numMakeCpus = 4 todo_list = """ TODO: * X install from .tar.gz * generic arch install (e.g., fftw) * wget option to clobber * add gui, difx_monitor, ... * add package dependencies and make use of them * option to test all possible dependencies * plplot * python path * integrate streamstor build * svnstatus * integrate sked: ftp://gemini.gsfc.nasa.gov/pub/sked/ * integrate AIPS? * Set FLIB for hops? MAYBE: * http://naif.jpl.nasa.gov/naif/toolkit_FORTRAN_PC_Linux_g77_32bit.html * http://naif.jpl.nasa.gov/pub/naif/toolkit//FORTRAN/PC_Linux_g77_32bit/packages/toolkit.tar.Z """ documentation = """ In-line documentation for difxbuild Dec 19, 2012 Walter Brisken Some assumptions: * All user directories and the difxbase paths are cross mounted and appear the same on all machines that will be installed with DiFX. Note that a DiFX installation is on a cluster, not on individual machines. * The machine used for downloading has external access via the svn, http, and ftp protocols. Some definitions: * architecture: A CPU architecture. Multiple architectures can be used in the same DiFX cluster. Multiple platforms can be specified per architecture. Some files are common across all versions or platforms of a given architecture. difxbuild will ensure that no redundant copies are installed, simplifying cross-version and cross-platform maintenance. * platform: The could be different variants of DiFX machines across a single cpu architecture. For example, in the i686 architecture one could have multiple different Mark5 types running different Conduant SDK versions, each of which needs to link to a different set of libraries. difxbuild uses out-of-source-tree building so that all platforms for a given DiFX installation can use the same source tree. Very handy for developers. * version: The formal DiFX version (e.g., DIFX-2.1), or the development version (called DIFX-DEVEL). * label: A user-defined name for the DiFX installation (to be applied across all platforms). By default this is the same as the version. Different bootstrap files using different labels can manage multiple instances of a single DiFX version. This is potentially useful if different DIFX-DEVEL snapshots are to be used in production. Some useful tips for users of difxbuild: * You can rerun bootstrap as many times as needed, changing parameters each time. It may be necessary to rebuild code after a bootstrap. * You can run "difxbuild rebuild" without any parameters if you are in the source component of a particular component. Same for "build" * After each successful (re)build/install of a component, a line of text is added to a file called buildlog in each platform's base directory. This can be used to trace back the subversion history of any binary at any time. * It is not recommended to move a difxbuild-based installation either to a different machine or across machines. Rather the new system should be rebootstrapped and the entire build process repeated. If this must be done, it is highly recommended to wipe out all bin/ lib/ etc/ include/ and share/ directories under $DIFXROOT and run 'difxbuild build all'. Bootstrap parameter options include: * version: which version of difx to install. Currently supported values are DIFX-DEVEL and DIFX-2.1. The DIFX_VERSION environment varialbe will reflect this value. This parameter is required. * headnode: the computer that will be singled out as the head node. The DIFX_HEAD_NODE environment variable will reflect this value. This parameter is required. * difxbase: the top level directory for DiFX software. DiFX version independent files will be placed beneath this directory. By default DiFX version specific files will be installed in a subdirectory of this (see information about the root parameter below). It is okay (and encouraged) to use the same difxbase for all installed versions. This parameter is required. * root: the base directory for DiFX version/label specific files for the primary platform. Secondary platforms will use the same but with a provided extension (see altplatformX below). If not provided, this parameter will default to /