diff --git a/.gitignore b/.gitignore index a96273a..715789a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ modules-3.2.8.tar.bz2 /modules-3.2.9b.tar.bz2 /modules-3.2.9c.tar.bz2 /modules-3.2.10.tar.bz2 +/modules-4.0.0.tar.bz2 diff --git a/createmodule.py b/createmodule.py deleted file mode 100755 index 3c778c1..0000000 --- a/createmodule.py +++ /dev/null @@ -1,237 +0,0 @@ -#!/usr/bin/python -# -# createmodule.py - Takes the name of a environment init script and -# produces a modulefile that duplicates the changes made by the init script -# -# Copyright (C) 2012 by Orion E. Poplawski -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -from __future__ import print_function - -from optparse import OptionParser -import os,sys,re -from subprocess import * - -# Handle options -usage = "Usage: %prog [-p prefix] [args]" -parser = OptionParser() -parser.set_usage(usage) -parser.add_option('-p', '--prefix', action='store', type='string', dest='prefix', help='Specify path prefix') -parser.add_option('--noprefix', action='store_true', dest='noprefix', default=False, help='Do not generate a prefix') -(options, args) = parser.parse_args() - -# Need a script name -if not args: - parser.print_usage() - exit(1) - -# Return environment after a command -def getenv(cmd = ':'): - env = {} - p = Popen(cmd + ";env", shell=True, stdout=PIPE, stderr=PIPE) - (stdout, stderr) = p.communicate() - if p.returncode != 0: - print("EROR: Could not execute initscript:") - print("%s returned exit code %d" % (cmd, p.returncode)) - print(stderr) - exit(1) - if stderr != '': - print("WARNING: initscript sent the following to stderr:") - print(stderr) - # Parse the output key=value pairs - skip = False - for line in stdout.splitlines(): - if skip: - if line == '}': - skip = False - continue - try: - (var,value) = line.split('=',1) - except ValueError: - print("ERROR: Could not parse output line:") - print(line) - exit(1) - # Exported functions - not handled - if value.find('() {') == 0: - skip = True - else: - env[var] = value - return env - -#Record initial environment -env1=getenv() - -#Record environment after sourcing the initscript -env2=getenv(". " + " ".join(args)) - -# Initialize our variables for storing modifications -chdir = None -appendpath = {} -prependpath = {} -unhandled = {} -setenv = {} -unsetenv = [] -pathnames = [] - -# Function to nomalize all paths in a list of paths and remove duplicate items -def normpaths(paths): - newpaths = [] - for path in paths: - normpath = os.path.normpath(path) - if normpath not in newpaths and normpath != '.': - newpaths.append(os.path.normpath(path)) - return newpaths - -# Start with existing keys and look for changes -for key in env1.keys(): - # Test for delete - if key not in env2: - unsetenv.append(key) - continue - # No change - if env1[key] == env2[key]: - del env2[key] - continue - #Working directory change - if key == 'PWD': - chdir=os.path.normpath(env2[key]) - pathnames.append(chdir) - del env2[key] - continue - # Determine modifcations to beginning and end of the string - try: - (prepend,append) = env2[key].split(env1[key]) - except ValueError: - continue - if prepend: - presep = prepend[-1:] - prependpaths = prepend.strip(presep).split(presep) - # LICENSE variables often include paths outside install directory - if 'LICENSE' not in key: - pathnames += prependpaths - if presep not in prependpath: - prependpath[presep] = {} - newpath = presep.join(normpaths(prependpaths)) - if newpath: - prependpath[presep][key] = newpath - else: - unhandled[key] = env2[key] - if append: - appsep = append[0:1] - appendpaths = append.strip(appsep).split(appsep) - # LICENSE variables often include paths outside install directory - if 'LICENSE' not in key: - pathnames += appendpaths - if appsep not in appendpath: - appendpath[appsep] = {} - newpath = appsep.join(normpaths(appendpaths)) - if newpath: - appendpath[appsep][key] = newpath - else: - unhandled[key] = env2[key] - del env2[key] - -# We're left with new keys in env2 -for key in env2.keys(): - # Use prepend-path for new paths - if (re.search('(DIRS|FILES|PATH)$',key)) or (':' in env2[key]): - prependpaths = env2[key].strip(':').split(':') - # MANPATH can have system defaults added it it wasn't previously set - # LICENSE variables often include paths outside install directory - if key != 'MANPATH' and 'LICENSE' not in key: - pathnames += prependpaths - if ':' not in prependpath: - prependpath[':'] = {} - prependpath[':'][key] = ':'.join(normpaths(prependpaths)) - continue - # Set new variables - setenv[key] = os.path.normpath(env2[key]) - if 'LICENSE' not in key: - pathnames.append(setenv[key]) - -# Report unhandled keys -for key in unhandled.keys(): - print("Unhandled change of", key, file=sys.stderr) - print("Before <%s>" % env1[key], file=sys.stderr) - print("After <%s>" % unhandled[key], file=sys.stderr) - for sepkey in appendpath.keys(): - appendpath[sepkey].pop(key, None) - for sepkey in prependpath.keys(): - prependpath[sepkey].pop(key, None) - -# Determine a prefix -prefix=None -if options.prefix: - prefix = options.prefix -elif not options.noprefix: - prefix = os.path.commonprefix(pathnames).rstrip('/') - if prefix == '': - prefix = None - -# Print out the modulefile -print("#%Module 1.0") - -# Prefix -if prefix is not None: - print("\nset prefix " + prefix + "\n") - -# Chdir -if chdir is not None: - print("chdir\t" + chdir) - -# Function to format output line with tabs and substituting prefix -def formatline(item, key, value=None): - print(item, end=' ') - print("\t"*(2-(len(item)+1)/8), end=' ') - print(key, end=' ') - if value is not None: - print("\t"*(3-(len(key)+1)/8), end=' ') - if prefix is not None: - print(value.replace(prefix,'$prefix')) - else: - print(value) - -# Paths first, grouped by variable name -for sepkey in prependpath.keys(): - pathkeys = prependpath[sepkey].keys() - pathkeys.sort() - for key in pathkeys: - if sepkey == ":": - formatline("prepend-path",key,prependpath[sepkey][key]) - else: - formatline("prepend-path --delim %s" % sepkey,key,prependpath[sepkey][key]) - -for sepkey in appendpath.keys(): - pathkeys = appendpath[sepkey].keys() - pathkeys.sort() - for key in pathkeys: - if sepkey == ":": - formatline("append-path",key,appendpath[sepkey][key]) - else: - formatline("append-path --delim %s" % sepkey,key,appendpath[sepkey][key]) - -# Setenv -setenvkeys = list(setenv.keys()) -setenvkeys.sort() -if setenvkeys: - print() -for key in setenvkeys: - formatline("setenv",key,setenv[key]) - -# Unsetenv -unsetenv.sort() -if unsetenv: - print() -for key in unsetenv: - formatline("unsetenv",key) diff --git a/createmodule.sh b/createmodule.sh deleted file mode 100755 index b0edfc5..0000000 --- a/createmodule.sh +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/bash -# -# createmodule.sh - Takes the name of a environment init script and -# produces a modulefile that duplicates the changes made by the init script -# -# Copyright (C) 2010-2012 by Orion E. Poplawski -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -usage="Usage: $0 [-p prefix] [args]" - -usage() { - echo $usage 1>&2 - exit 1 -} - -while getopts "p:" opt -do - case $opt in - p) prefix=$OPTARG; shift 2;; - *) usage;; - esac -done - -# Need a script name -[ -z "$1" ] && usage - -# Need to be a readable script -if [ ! -r "$1" ] -then - echo "ERROR: Cannot read $1" 1>&2 - exit 1 -fi - -#Will print out array assignment list -printenvarray () { - env | while read x - do - key=${x%%=*} - value=`printenv "$key"` - if [ $? -eq 0 ] - then - echo [$key]="'$value'" - fi - done -} - -#Apparently we need to declare the associative arrays -declare -A env1 env2 - -#Record starting environment -eval env1=(`printenvarray`) - -#Source the environment script -. "$@" - -#Record ending environment -eval env2=(`printenvarray`) - -#Print out the modulefile -echo "#%Module 1.0" - -#Prefix -[ -n "$prefix" ] && echo -e "\nset prefix $prefix\n" - -# dedup - remove duplicate entries from a list -#Subshell so we can sort the output -( -dedup() { - list=`mktemp` - [ -n "$2" ] && sep=$2 || sep=: - echo $1 | sed -r -e 's,[^/]+/\.\./,,g' -e 's,[^/]+/\.\./,,g' -e "s/\\$sep/\n/g" | - while read x - do - grep -Fx ${x} $list && continue - if [ -n "$prefix" ] - then - echo $x | sed -e s,$prefix,\$prefix, - else - echo $x - fi - echo $x >> $list - done | tr '\n' $sep | sed -e "s/\\$sep\$//" - rm $list -} - -#Keys that changed -for key in "${!env1[@]}" -do - if [ "${env1[$key]}" != "${env2[$key]}" ] - then - #Working directory change - if [ "$key" = PWD ] - then - if [ -n "$prefix" ] - then - echo -e "chdir\t\t${env2[PWD]}" | sed -e s,$prefix,\$prefix,g - else - echo -e "chdir\t\t${env2[PWD]}" - fi - #Test for delete - elif [ -z "${env2[$key]}" ] - then - echo -e "unsetenv\t${key}\t${env2[$key]}" - #Test for prepend - elif [ "${env2[$key]%${env1[$key]}}" != "${env2[$key]}" ] - then - added=${env2[$key]%${env1[$key]}} - sep=${added: -1} - added=${added%$sep} - added=$(dedup $added $sep) - if [ $sep = : ] - then - echo -e "prepend-path\t$key\t${added}" - else - echo -e "prepend-path\t--delim $sep\t$key\t${added}" - fi - #Test for prepend plus : added at end (MANPATH) - elif [ "${key: -4}" = PATH -a "${env2[$key]%${env1[$key]}:}" != "${env2[$key]}" ] - then - added=$(dedup ${env2[$key]%${env1[$key]}:}) - echo -e "prepend-path\t$key\t${added}" - #Test for append - elif [ "${env2[$key]#${env1[$key]}}" != "${env2[$key]}" ] - then - added=${env2[$key]#${env1[$key]}} - sep=${added:0:1} - added=${added#$sep} - added=$(dedup $added $sep) - if [ $sep = : ] - then - echo -e "append-path\t$key\t${added}" - else - echo -e "append-path\t--delim $sep\t$key\t${added}" - fi - #Test for prepend plus append - elif [ "${env2[$key]%${env1[$key]}*}" != "${env2[$key]}" ] - then - prepended=${env2[$key]%${env1[$key]}*} - presep=${prepended: -1} - prepended=${prepended%$presep} - prepended=$(dedup $prepended $presep) - appended=${env2[$key]#*${env1[$key]}} - appsep=${appended:0:1} - appended=${appended#$appsep} - appended=$(dedup $appended $appsep) - if [ $presep != $appsep -o -z "$prepended" -o -z "$appended" ] - then - #Unhandled - echo "Unhandled change of $key" 1>&2 - echo "Before <${env1[$key]}>" 1>&2 - echo "After <${env2[$key]}>" 1>&2 - else - if [ $presep = : ] - then - echo -e "prepend-path\t$key\t${prepended}" - echo -e "append-path\t$key\t${appended}" - else - echo -e "prepend-path\t--delim $presep\t$key\t${prepended}" - echo -e "append-path\t--delim $appsep\t$key\t${appended}" - fi - fi - else - #Unhandled - echo "Unhandled change of $key" 1>&2 - echo "Before <${env1[$key]}>" 1>&2 - echo "After <${env2[$key]}>" 1>&2 - fi - fi - #Delete keys we have handled - unset env1[$key] - unset env2[$key] -done - -#New keys -for key in "${!env2[@]}" -do - if [ "$key" = OLDPWD ] - then - continue - fi - #Use prepend-path for new paths - if [ "${key: -4}" = PATH -o "${key: -4}" = DIRS -o "${key: -4}" = FILES ] - then - # TODO - Need to handle stripping of default MANPATH - echo -e "prepend-path\t${key}\t"$(dedup ${env2[$key]}) - else - if [ -n "$prefix" ] - then - echo -e "setenv\t\t${key}\t${env2[$key]}" | sed -e s,$prefix,\$prefix,g - else - echo -e "setenv\t\t${key}\t${env2[$key]}" - fi - fi -done -) | sort diff --git a/environment-modules-3.2.10-unload-from-module.patch b/environment-modules-3.2.10-unload-from-module.patch deleted file mode 100644 index c848752..0000000 --- a/environment-modules-3.2.10-unload-from-module.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -up modules-3.2.10/ModuleCmd_Load.c.unload_from_modulefile modules-3.2.10/ModuleCmd_Load.c ---- modules-3.2.10/ModuleCmd_Load.c.unload_from_modulefile 2014-07-08 10:43:41.615212949 +0200 -+++ modules-3.2.10/ModuleCmd_Load.c 2014-07-08 13:49:21.674701003 +0200 -@@ -126,7 +126,7 @@ int ModuleCmd_Load( Tcl_Interp *interp, - ** Set up the flags controling the Tcl callback functions - **/ - -- /* avoid changes when invoked as a subcommand */ -+ /* avoid changes when invoked as a subcommand and loading */ - if (!(g_flags & M_SUBCMD)) { - if( load) { - g_flags |= M_LOAD; -@@ -136,6 +136,11 @@ int ModuleCmd_Load( Tcl_Interp *interp, - g_flags &= ~M_LOAD; - } - g_flags |= M_SUBCMD; -+ } else { -+ if (!load) { -+ g_flags |= M_REMOVE; -+ g_flags &= ~M_LOAD; -+ } - } - - /** diff --git a/environment-modules-3.2.7-bindir.patch b/environment-modules-3.2.7-bindir.patch deleted file mode 100644 index 1efb0ee..0000000 --- a/environment-modules-3.2.7-bindir.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- modules-3.2.7/init/Makefile.in.bindir 2009-09-22 12:13:52.000000000 -0600 -+++ modules-3.2.7/init/Makefile.in 2009-09-23 12:19:50.797470155 -0600 -@@ -404,7 +404,7 @@ - sed -e "/@$(if $(subst 0,,$(WANTS_VERSIONING)),NOT,)VERSIONING\@/d; \ - s,@$(if $(subst 0,,$(WANTS_VERSIONING)),,NOT)VERSIONING\@,,g; \ - s,@prefix\@,${prefix},g; \ -- s,@bindir\@,${exec_prefix}/bin,g; \ -+ s,@bindir\@,${bindir},g; \ - s,@VERSION\@,@VERSION@,g; \ - s,@BASEPREFIX\@,@BASEPREFIX@,g;" < $< > $@ - diff --git a/environment-modules-avail.patch b/environment-modules-avail.patch deleted file mode 100644 index 8d6f52b..0000000 --- a/environment-modules-avail.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up modules-3.2.10/init/bash_completion.in.avail modules-3.2.10/init/bash_completion.in ---- modules-3.2.10/init/bash_completion.in.avail 2012-10-25 13:33:34.000000000 -0600 -+++ modules-3.2.10/init/bash_completion.in 2013-01-15 12:05:37.247309733 -0700 -@@ -56,7 +56,7 @@ _module() { - unuse) COMPREPLY=( $(IFS=: compgen -W "${MODULEPATH}" -- "$cur") );; - use|*-a*) ;; # let readline handle the completion - -u|--userlvl) COMPREPLY=( $(compgen -W "novice expert advanced" -- "$cur") );; -- display|help|show|whatis) -+ av*|disp*|help|show|whatis) - COMPREPLY=( $(compgen -W "$(_module_avail)" -- "$cur") );; - *) if test $COMP_CWORD -gt 2 - then diff --git a/environment-modules-clear.patch b/environment-modules-clear.patch deleted file mode 100644 index 0817db5..0000000 --- a/environment-modules-clear.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- modules-3.2.9/utility.c 2011-11-28 22:27:13.000000000 +0100 -+++ modules-3.2.9-new/utility.c 2012-06-13 15:17:41.570629148 +0200 -@@ -727,7 +727,7 @@ int Output_Modulefile_Changes( Tcl_Inter - output_unset_variable( (char*) key); - } else { - val = EMGetEnv(interp, key); -- if(val && *val) -+ if(val) - output_set_variable(interp, (char*) key, val); - null_free((void *)&val); - } diff --git a/environment-modules-format.patch b/environment-modules-format.patch deleted file mode 100644 index 10d07be..0000000 --- a/environment-modules-format.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff -up modules-3.2.10/ModuleCmd_Avail.c.format modules-3.2.10/ModuleCmd_Avail.c ---- modules-3.2.10/ModuleCmd_Avail.c.format 2012-12-13 15:17:27.000000000 -0700 -+++ modules-3.2.10/ModuleCmd_Avail.c 2013-12-23 10:03:34.630492517 -0700 -@@ -257,7 +257,7 @@ int ModuleCmd_Avail( Tcl_Interp *interp, - **/ - - if( sw_format & SW_LONG) -- fprintf( stderr, long_header); -+ fprintf( stderr, "%s", long_header); - - /** - ** If a module category is specified check whether it is part -diff -up modules-3.2.10/ModuleCmd_Display.c.format modules-3.2.10/ModuleCmd_Display.c ---- modules-3.2.10/ModuleCmd_Display.c.format 2012-11-01 16:02:19.000000000 -0600 -+++ modules-3.2.10/ModuleCmd_Display.c 2013-12-23 10:03:34.630492517 -0700 -@@ -161,13 +161,13 @@ int ModuleCmd_Display( Tcl_Interp *inter - - g_current_module = modulename; - -- fprintf( stderr, local_line); -+ fprintf( stderr, "%s", local_line); - fprintf( stderr, "%s:\n\n", modulefile); - - result = CallModuleProcedure( disp_interp, &cmdbuf, modulefile, - "ModulesDisplay", 0); - -- fprintf( stderr, local_line); -+ fprintf( stderr, "%s", local_line); - - /** - ** Remove the Tcl interpreter that has been used for printing ... -diff -up modules-3.2.10/ModuleCmd_List.c.format modules-3.2.10/ModuleCmd_List.c ---- modules-3.2.10/ModuleCmd_List.c.format 2012-11-01 16:02:19.000000000 -0600 -+++ modules-3.2.10/ModuleCmd_List.c 2013-12-23 10:15:35.457029928 -0700 -@@ -122,7 +122,7 @@ int ModuleCmd_List( Tcl_Interp *interp, - **/ - - if( sw_format & SW_LONG ) { -- fprintf( stderr, long_header); -+ fprintf( stderr, "%s", long_header); - } - if( sw_format & (SW_TERSE | SW_LONG | SW_HUMAN) ) - fprintf( stderr, "Currently Loaded Modulefiles:\n"); diff --git a/environment-modules-implicit.patch b/environment-modules-implicit.patch deleted file mode 100644 index be93268..0000000 --- a/environment-modules-implicit.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -up modules-3.2.10/modules_def.h.implicit modules-3.2.10/modules_def.h ---- modules-3.2.10/modules_def.h.implicit 2012-11-01 10:58:27.000000000 -0600 -+++ modules-3.2.10/modules_def.h 2016-12-04 10:20:40.981094031 -0700 -@@ -616,6 +616,9 @@ extern int ModuleCmd_Load( Tcl_Interp* - /** ModuleCmd_Purge.c **/ - extern int ModuleCmd_Purge( Tcl_Interp*, int, char*[]); - -+/** ModuleCmd_Refresh.c **/ -+extern int ModuleCmd_Refresh( Tcl_Interp*, int, char*[]); -+ - /** ModuleCmd_Switch.c **/ - extern int ModuleCmd_Switch( Tcl_Interp*, int, char*[]); - -@@ -736,6 +739,7 @@ extern int IsLoaded( Tcl_Interp*, char - extern int IsLoaded_ExactMatch( Tcl_Interp*, char*, char **, char*); - extern int Update_LoadedList( Tcl_Interp*, char*, char*); - extern int check_magic( char*, char*, int); -+extern void regex_quote( const char*, char*, int); - extern char *xstrtok_r(char *, const char *, char **); - extern char *xstrtok(char *, const char *); - extern void chk4spch( char*); diff --git a/environment-modules-py3-and-doc-fix.patch b/environment-modules-py3-and-doc-fix.patch deleted file mode 100644 index ded76d9..0000000 --- a/environment-modules-py3-and-doc-fix.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -up modules-3.2.10/doc/module.1.in.py3 modules-3.2.10/doc/module.1.in ---- modules-3.2.10/doc/module.1.in.py3 2015-01-28 09:55:01.172781681 -0700 -+++ modules-3.2.10/doc/module.1.in 2015-01-28 09:55:51.045510021 -0700 -@@ -107,11 +107,8 @@ And the python - .I module - command is defined with: - -- import os; -- if os.environ.has_key('PYTHONPATH'): -- os.environ['PYTHONPATH'] +=':'+os.environ['MODULESHOME']+"/init"; -- else: -- os.environ['PYTHONPATH'] = os.environ['MODULESHOME']+"/init"; -+ import os, sys; -+ sys.path.insert(0, '@INITPATH@') - - from python import module; - -diff -up modules-3.2.10/init/python.py.in.py3 modules-3.2.10/init/python.py.in ---- modules-3.2.10/init/python.py.in.py3 2015-01-28 09:55:01.173781675 -0700 -+++ modules-3.2.10/init/python.py.in 2015-01-28 09:56:08.570414569 -0700 -@@ -27,5 +27,5 @@ def module(*args): - @VERSIONING@ (output, error) = subprocess.Popen(['@BASEPREFIX@/Modules/%s/bin/modulecmd' % os.environ['MODULE_VERSION'], 'python'] + - @NOTVERSIONING@ (output, error) = subprocess.Popen(['@bindir@/modulecmd', 'python'] + - args, stdout=subprocess.PIPE).communicate() -- exec output -+ exec(output) - diff --git a/environment-modules-tcl86.patch b/environment-modules-tcl86.patch deleted file mode 100644 index 73b0b02..0000000 --- a/environment-modules-tcl86.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -up modules-3.2.10/cmdModule.c.tcl86 modules-3.2.10/cmdModule.c ---- modules-3.2.10/cmdModule.c.tcl86 2012-11-01 16:02:19.000000000 -0600 -+++ modules-3.2.10/cmdModule.c 2014-05-27 15:25:50.531554880 -0600 -@@ -56,7 +56,11 @@ static void *UseId[] = { &UseId, Id }; - /** MACROS **/ - /** ************************************************************************ **/ - --/** not applicable **/ -+/** For Tcl < 8.6 compatibility **/ -+#if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6) -+#define Tcl_GetErrorLine(interp) (interp->errorLine) -+#define Tcl_SetErrorLine(interp,lineNum) (interp->errorLine = lineNum) -+#endif - - /** ************************************************************************ **/ - /** LOCAL DATA **/ -@@ -640,8 +644,8 @@ int Execute_TclFile( Tcl_Interp *interp - case TCL_OK: gotPartial = 0; - continue; /** while **/ - -- case TCL_ERROR: interp->errorLine = ((linenum-1)-gotPartial) + -- interp->errorLine; -+ case TCL_ERROR: Tcl_SetErrorLine(interp, ((linenum-1)-gotPartial) + -+ Tcl_GetErrorLine(interp)); - /* FALLTHROUGH */ - - case TCL_LEVEL0_RETURN: diff --git a/environment-modules-versioning.patch b/environment-modules-versioning.patch deleted file mode 100644 index 7bda920..0000000 --- a/environment-modules-versioning.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff -up modules-3.2.10/modulefiles/modules.in.versioning modules-3.2.10/modulefiles/modules.in ---- modules-3.2.10/modulefiles/modules.in.versioning 2012-10-25 13:33:34.000000000 -0600 -+++ modules-3.2.10/modulefiles/modules.in 2013-01-15 11:30:22.046031158 -0700 -@@ -26,5 +26,5 @@ setenv MODULESHOME $prefix - prepend-path PATH @bindir@ - prepend-path MANPATH @mandir@ - --module use @VERSIONPATH@ -+@VERSIONING@module use @VERSIONPATH@ - diff --git a/environment-modules.spec b/environment-modules.spec index 2054a85..f6721c0 100644 --- a/environment-modules.spec +++ b/environment-modules.spec @@ -1,43 +1,15 @@ %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: environment-modules -Version: 3.2.10 -Release: 23%{?dist} +Version: 4.0.0 +Release: 1%{?dist} Summary: Provides dynamic modification of a user's environment Group: System Environment/Base License: GPLv2+ URL: http://modules.sourceforge.net/ Source0: http://downloads.sourceforge.net/modules/modules-%{version}.tar.bz2 -Source1: modules.sh -Source2: createmodule.sh -Source3: createmodule.py Source4: macros.%{name} -Patch0: environment-modules-3.2.7-bindir.patch -# Comment out stray module use in modules file when not using versioning -# https://bugzilla.redhat.com/show_bug.cgi?id=895555 -Patch1: environment-modules-versioning.patch -# Fix module clear command -# https://bugzilla.redhat.com/show_bug.cgi?id=895551 -Patch2: environment-modules-clear.patch -# Patch from modules list to add completion to avail command -Patch3: environment-modules-avail.patch -# Fix -Werror=format-security -# https://bugzilla.redhat.com/show_bug.cgi?id=1037053 -# https://sourceforge.net/p/modules/patches/13/ -Patch4: environment-modules-format.patch -# Support Tcl 8.6 -# https://sourceforge.net/p/modules/feature-requests/14/ -Patch5: environment-modules-tcl86.patch -# python 3 support -# https://sourceforge.net/p/modules/patches/15/ -# https://bugzilla.redhat.com/show_bug.cgi?id=1184979 -Patch6: environment-modules-py3-and-doc-fix.patch -# Fix unload from loaded modulefile -# https://bugzilla.redhat.com/show_bug.cgi?id=1117334 -Patch7: environment-modules-3.2.10-unload-from-module.patch -# Fix build with -Werror=implicit-function-declaration -Patch8: environment-modules-implicit.patch BuildRequires: tcl-devel, tclx-devel, libX11-devel BuildRequires: dejagnu @@ -72,91 +44,136 @@ suite of different applications. NOTE: You will need to get a new shell after installing this package to have access to the module alias. +%package compat +Summary: Environment Modules compatibility version +Requires: environment-modules = %{version}-%{release} + +%description compat +The Environment Modules package provides for the dynamic modification of +a user's environment via modulefiles. + +This package provides Environment Modules compatibility version (3.2). + %prep %setup -q -n modules-%{version} -%patch0 -p1 -b .bindir -%patch1 -p1 -b .versioning -%patch2 -p1 -b .clear -%patch3 -p1 -b .avail -%patch4 -p1 -b .format -%patch5 -p1 -b .tcl86 -%patch6 -p1 -b .py3 -%patch7 -p1 -b .unload-from-module -%patch8 -p1 -b .implicit %build -%configure --disable-versioning \ - --prefix=%{_datadir} \ - --exec-prefix=%{_datadir}/Modules \ - --with-man-path=$(manpath) \ - --with-module-path=%{_sysconfdir}/modulefiles:%{_datadir}/modulefiles -# --with-debug=42 --with-log-facility-debug=stderr +%configure --prefix=%{_datadir}/Modules \ + --bindir=%{_datadir}/Modules/bin \ + --libexecdir=%{_datadir}/Modules/libexec \ + --docdir=%{_docdir}/%{name} \ + --enable-dotmodulespath \ + --with-modulepath=%{_datadir}/Modules/modulefiles:%{_sysconfdir}/modulefiles:%{_datadir}/modulefiles \ + --with-quarantine-vars=LD_LIBRARY_PATH make %{?_smp_mflags} %install -make install DESTDIR=$RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d +make install DESTDIR=%{buildroot} + +mkdir -p %{buildroot}%{_sysconfdir}/modulefiles +mkdir -p %{buildroot}%{_datadir}/modulefiles +mkdir -p %{buildroot}%{_sysconfdir}/profile.d +mkdir -p %{buildroot}%{_bindir} + +# Set up for alternatives. touch %{buildroot}%{_sysconfdir}/profile.d/modules.{csh,sh} -cp -p %SOURCE1 $RPM_BUILD_ROOT%{_datadir}/Modules/init/modules.sh -cp -p %SOURCE2 %SOURCE3 $RPM_BUILD_ROOT%{_datadir}/Modules/bin -%if 0%{?fedora} >= 22 +touch %{buildroot}%{_bindir}/modulecmd +mv %{buildroot}%{_mandir}/man1/module{,-c}.1 +mv %{buildroot}%{_mandir}/man4/modulefile{,-c}.4 + +# Major utilities go to regular bin dir. +mv %{buildroot}%{_datadir}/Modules/bin/envml %{buildroot}%{_bindir}/ + +# Rename compat docs to find them in files section. +mv compat/ChangeLog ChangeLog-compat +mv compat/NEWS NEWS-compat + +mv {doc/build/,}NEWS.txt +mv {doc/build/,}MIGRATING.txt +mv {doc/build/,}diff_v3_v4.txt +mv {doc/,}example.txt +rm -f %{buildroot}%{_docdir}/%{name}/{COPYING.GPLv2,ChangeLog-compat,INSTALL.txt,NEWS-compat} + +cp -p contrib/scripts/createmodule.sh %{buildroot}%{_datadir}/Modules/bin +cp -p contrib/scripts/createmodule.py %{buildroot}%{_datadir}/Modules/bin sed -i -e 1s,/usr/bin/python,/usr/bin/python3, \ - $RPM_BUILD_ROOT%{_datadir}/Modules/bin/createmodule.py -%endif -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modulefiles \ - $RPM_BUILD_ROOT%{_datadir}/modulefiles -# Install the rpm config file -install -Dpm 644 %{SOURCE4} %{buildroot}/%{macrosdir}/macros.%{name} -# Prep for man alternatives -mv $RPM_BUILD_ROOT%{_mandir}/man1/module{,-c}.1 -mv $RPM_BUILD_ROOT%{_mandir}/man4/modulefile{,-c}.4 + %{buildroot}%{_datadir}/Modules/bin/createmodule.py +install -Dpm 644 %{SOURCE4} %{buildroot}/%{macrosdir}/macros.%{name} %check make test - %post # Cleanup from pre-alternatives -[ ! -L %{_bindir}/modules.sh ] && rm -f %{_sysconfdir}/profile.d/modules.sh [ ! -L %{_mandir}/man1/module.1.gz ] && rm -f %{_mandir}/man1/module.1.gz [ ! -L %{_mandir}/man4/modulefile.4.gz ] && rm -f %{_mandir}/man4/modulefile.4.gz -%{_sbindir}/update-alternatives --install %{_sysconfdir}/profile.d/modules.sh modules.sh %{_datadir}/Modules/init/modules.sh 40 \ - --slave %{_sysconfdir}/profile.d/modules.csh modules.csh %{_datadir}/Modules/init/csh \ - --slave %{_mandir}/man1/module.1.gz module.1.gz %{_mandir}/man1/module-c.1.gz \ - --slave %{_mandir}/man4/modulefile.4.gz modulefile.4.gz %{_mandir}/man4/modulefile-c.4.gz +[ ! -L %{_sysconfdir}/profile.d/modules.sh ] && rm -f %{_sysconfdir}/profile.d/modules.sh +[ ! -L %{_sysconfdir}/profile.d/modules.csh ] && rm -f %{_sysconfdir}/profile.d/modules.csh +[ ! -L %{buildroot}%{_bindir}/modulecmd ] && rm -f %{_bindir}/modulecmd + +# Migration from version 3.x to 4 +if [ "$(readlink /etc/alternatives/modules.sh)" = '%{_datadir}/Modules/init/modules.sh' ]; then + %{_sbindir}/update-alternatives --remove modules.sh %{_datadir}/Modules/init/modules.sh +fi + +%{_sbindir}/update-alternatives \ + --install %{_sysconfdir}/profile.d/modules.sh modules.sh %{_datadir}/Modules/init/profile.sh 40 \ + --slave %{_sysconfdir}/profile.d/modules.csh modules.csh %{_datadir}/Modules/init/profile.csh \ + --slave %{_bindir}/modulecmd modulecmd %{_datadir}/Modules/libexec/modulecmd.tcl + +%post compat +%{_sbindir}/update-alternatives \ + --install %{_sysconfdir}/profile.d/modules.sh modules.sh %{_datadir}/Modules/init/profile-compat.sh 10 \ + --slave %{_sysconfdir}/profile.d/modules.csh modules.csh %{_datadir}/Modules/init/profile-compat.csh \ + --slave %{_bindir}/modulecmd modulecmd %{_datadir}/Modules/libexec/modulecmd-compat %postun if [ $1 -eq 0 ] ; then %{_sbindir}/update-alternatives --remove modules.sh %{_datadir}/Modules/init/modules.sh fi +%postun compat +if [ $1 -eq 0 ] ; then + %{_sbindir}/update-alternatives --remove modules.sh %{_datadir}/Modules/init/profile-compat.sh +fi + %files -%license LICENSE.GPL -%doc README TODO +%license COPYING.GPLv2 +%doc ChangeLog README NEWS.txt MIGRATING.txt diff_v3_v4.txt example.txt %{_sysconfdir}/modulefiles %ghost %{_sysconfdir}/profile.d/modules.csh %ghost %{_sysconfdir}/profile.d/modules.sh -%{_bindir}/modulecmd +%ghost %{_bindir}/modulecmd +%{_bindir}/envml %dir %{_datadir}/Modules -%{_datadir}/Modules/bin/ +%{_datadir}/Modules/bin +%dir %{_datadir}/Modules/libexec +%{_datadir}/Modules/libexec/modulecmd.tcl %dir %{_datadir}/Modules/init %config(noreplace) %{_datadir}/Modules/init/* %config(noreplace) %{_datadir}/Modules/init/.modulespath %{_datadir}/Modules/modulefiles %{_datadir}/modulefiles -%ghost %{_mandir}/man1/module.1.gz -%ghost %{_mandir}/man4/modulefile.4.gz %{_mandir}/man1/module-c.1.gz %{_mandir}/man4/modulefile-c.4.gz %{macrosdir}/macros.%{name} +%files compat +%doc ChangeLog-compat NEWS-compat +%{_datadir}/Modules/libexec/modulecmd-compat +%{_mandir}/man1/module-compat.1.gz +%{_mandir}/man4/modulefile-compat.4.gz + %changelog +* Mon Nov 20 2017 Jan Synáček - 4.0.0-1 +- Update to 4.0.0 (#1503408) + * Wed Aug 02 2017 Fedora Release Engineering - 3.2.10-23 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild diff --git a/modules.sh b/modules.sh deleted file mode 100644 index 48cc324..0000000 --- a/modules.sh +++ /dev/null @@ -1,7 +0,0 @@ -shell=`/bin/basename \`/bin/ps -p $$ -ocomm=\`` -if [ -f /usr/share/Modules/init/$shell ] -then - . /usr/share/Modules/init/$shell -else - . /usr/share/Modules/init/sh -fi diff --git a/sources b/sources index 440d4c7..f041293 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7db43a0e272574219d68bd2a2683f25f modules-3.2.10.tar.bz2 +SHA512 (modules-4.0.0.tar.bz2) = 821b1ba2b92df8a9222af3f203e10207d33988b9cf41e2b4004926a3f2b21dbf83adc7a260ae06de2780816e507b758e3d8ff66354e1804bad8198a33f7b0fb8