mirror of
https://github.com/envmodules/modules.git
synced 2026-06-10 00:56:30 +08:00
More standard shebang for modulecmd.tcl
Make use of './configure' information to set a precise tclsh shebang on modulecmd.tcl script. This change requires to move modulecmd.tcl to modulecmd.tcl.in within repository. Shebang is set to '@TCLSHDIR@/tclsh' rather just '@TCLSH@' in modulecmd.tcl.in to help forge code determines that this file is a Tcl script.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
modulecmd.tcl
|
||||
ChangeLog
|
||||
README
|
||||
Makefile.inc
|
||||
|
||||
13
Makefile
13
Makefile
@@ -2,7 +2,7 @@
|
||||
test testinstall instrument testcoverage
|
||||
|
||||
CURRENT_VERSION := $(shell grep '^set MODULES_CURRENT_VERSION' \
|
||||
modulecmd.tcl | cut -d ' ' -f 3)
|
||||
modulecmd.tcl.in | cut -d ' ' -f 3)
|
||||
DIST_PREFIX := modules-tcl-$(CURRENT_VERSION)
|
||||
|
||||
# definitions for code coverage
|
||||
@@ -19,7 +19,7 @@ ifneq ($(wildcard Makefile.inc),Makefile.inc)
|
||||
endif
|
||||
include Makefile.inc
|
||||
|
||||
all: initdir pkgdoc ChangeLog README
|
||||
all: initdir pkgdoc modulecmd.tcl ChangeLog README
|
||||
|
||||
initdir:
|
||||
make -C init all
|
||||
@@ -33,13 +33,17 @@ doc:
|
||||
www:
|
||||
make -C www all
|
||||
|
||||
modulecmd.tcl: modulecmd.tcl.in
|
||||
perl -pe 's|\@TCLSHDIR\@/tclsh|$(TCLSH)|g;' $< > $@
|
||||
chmod +x $@
|
||||
|
||||
ChangeLog:
|
||||
contrib/gitlog2changelog.py
|
||||
|
||||
README:
|
||||
perl -pe 's|^\[\!\[.*\].*\n||;' $@.md > $@
|
||||
|
||||
install: ChangeLog README
|
||||
install: modulecmd.tcl ChangeLog README
|
||||
mkdir -p $(DESTDIR)$(libexecdir)
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
cp modulecmd.tcl $(DESTDIR)$(libexecdir)/
|
||||
@@ -94,6 +98,7 @@ endif
|
||||
ifeq ($(wildcard .git) $(wildcard README.md),.git README.md)
|
||||
rm -f README
|
||||
endif
|
||||
rm -f modulecmd.tcl
|
||||
rm -f modules-tcl-*.tar.gz
|
||||
rm -f modules-tcl-*.srpm
|
||||
make -C init clean
|
||||
@@ -107,7 +112,7 @@ distclean: clean
|
||||
rm -f site.exp
|
||||
rm -rf $(NAGELFAR_RELEASE)
|
||||
|
||||
test:
|
||||
test: modulecmd.tcl
|
||||
TCLSH=$(TCLSH); export TCLSH; \
|
||||
MODULEVERSION=Tcl; export MODULEVERSION; \
|
||||
OBJDIR=`pwd -P`; export OBJDIR; \
|
||||
|
||||
@@ -42,6 +42,13 @@ if {[catch {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# determine source file name to report coverage against
|
||||
if {[file exists "${srcfile}.in"]} {
|
||||
set targetfile "${srcfile}.in"
|
||||
} else {
|
||||
set targetfile $srcfile
|
||||
}
|
||||
|
||||
# parse coverage result
|
||||
array set line_hits {}
|
||||
set covered_lines 0
|
||||
@@ -66,20 +73,20 @@ puts "Found $covered_lines lines covered over $total_lines ($percent_covered %)"
|
||||
# catch additional information to build reports
|
||||
set fmtime [file mtime $covres]
|
||||
set fmtime_date [clock format $fmtime -format "%Y-%m-%d %H:%M:%S"]
|
||||
regsub -all "\\." $srcfile "_" srcname
|
||||
regsub -all "\\." $targetfile "_" srcname
|
||||
|
||||
# build json report content
|
||||
array set content {}
|
||||
set content(json) "{
|
||||
\"files\": \[
|
||||
{\"file\": \"$srcfile\", \"percent_covered\": \"$percent_covered\", \"covered_lines\": \"$covered_lines\", \"total_lines\": \"$total_lines\"}
|
||||
{\"file\": \"$targetfile\", \"percent_covered\": \"$percent_covered\", \"covered_lines\": \"$covered_lines\", \"total_lines\": \"$total_lines\"}
|
||||
\],
|
||||
\"percent_covered\": \"$percent_covered\",
|
||||
\"covered_lines\": $covered_lines,
|
||||
\"total_lines\": $total_lines,
|
||||
\"percent_low\": 25,
|
||||
\"percent_high\": 75,
|
||||
\"command\": \"$srcfile\",
|
||||
\"command\": \"$targetfile\",
|
||||
\"date\": \"$fmtime_date\"
|
||||
}"
|
||||
|
||||
@@ -88,12 +95,12 @@ set content(xml) "<?xml version=\"1.0\" ?>
|
||||
<!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
|
||||
<coverage line-rate=\"0.000\" version=\"1.9\" timestamp=\"$fmtime\">
|
||||
<sources>
|
||||
<source>$srcfile</source>
|
||||
<source>$targetfile</source>
|
||||
</sources>
|
||||
<packages>
|
||||
<package name=\"$srcname\" line-rate=\"0.000\" branch-rate=\"1.0\" complexity=\"1.0\">
|
||||
<classes>
|
||||
<class name=\"$srcname\" filename=\"$srcfile\" line-rate=\"$ratio_covered\">
|
||||
<class name=\"$srcname\" filename=\"$targetfile\" line-rate=\"$ratio_covered\">
|
||||
<lines>
|
||||
"
|
||||
foreach n [lsort -integer [array names line_hits]] {
|
||||
@@ -107,7 +114,7 @@ append content(xml) " </lines>
|
||||
</coverage>"
|
||||
|
||||
# write reports
|
||||
set reportdir "[file dirname $srcfile]/coverage/$srcfile"
|
||||
set reportdir "[file dirname $srcfile]/coverage/$targetfile"
|
||||
if {[catch {file mkdir $reportdir} errMsg ]} {
|
||||
puts stderr "Report directory '$reportdir' cannot be created.\n$errMsg"
|
||||
exit 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.PHONY: install uninstall clean
|
||||
|
||||
VERSION_FILE := ../modulecmd.tcl
|
||||
VERSION_FILE := ../modulecmd.tcl.in
|
||||
MAN_VERSION := "modules-tcl $(shell grep '^set MODULES_CURRENT_VERSION' \
|
||||
$(VERSION_FILE) | cut -d ' ' -f 3)"
|
||||
MAN_HEADER := "Environment Modules"
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
#!/bin/sh
|
||||
# \
|
||||
tclshbin=$(type -p tclsh) && exec $tclshbin "$0" "$@"
|
||||
# \
|
||||
[ -x /usr/local/bin/tclsh ] && exec /usr/local/bin/tclsh "$0" "$@"
|
||||
# \
|
||||
[ -x /usr/bin/tclsh ] && exec /usr/bin/tclsh "$0" "$@"
|
||||
# \
|
||||
[ -x /bin/tclsh ] && exec /bin/tclsh "$0" "$@"
|
||||
# \
|
||||
echo "FATAL: module: Could not find tclsh in \$PATH or in standard directories" >&2; exit 1
|
||||
|
||||
#!@TCLSHDIR@/tclsh
|
||||
#
|
||||
# MODULECMD.TCL, a pure TCL implementation of the module command
|
||||
# Copyright (C) 2002-2004 Mark Lakata
|
||||
# Copyright (C) 2004-2017 Kent Mein
|
||||
@@ -33,7 +23,7 @@ echo "FATAL: module: Could not find tclsh in \$PATH or in standard directories"
|
||||
#
|
||||
# Some Global Variables.....
|
||||
#
|
||||
set MODULES_CURRENT_VERSION 1.969
|
||||
set MODULES_CURRENT_VERSION 1.971
|
||||
set MODULES_CURRENT_RELEASE_DATE "2017-08-17"
|
||||
set g_debug 0 ;# Set to 1 to enable debugging
|
||||
set error_count 0 ;# Start with 0 errors
|
||||
Reference in New Issue
Block a user