使用env2,從shell腳本制作module文件

克隆代碼

(py38) $ REMOTE_GIT_FILE=git://git.code.sf.net/p/env2/code \
LOCAL_GIT_FILE=$HOME/github/env2.git \
time -p bash -c 'git clone --bare $REMOTE_GIT_FILE $LOCAL_GIT_FILE'

檢查git branches和tags,選一個看著順眼的版本,只有FETCH_HEAD

(py38) $ GIT_DIR=$HOME/github/env2.git \
time -p bash -c '
git --bare --git-dir=$GIT_DIR fetch --all --prune; 
git --bare --git-dir=$GIT_DIR describe --all --long;
git --bare --git-dir=$GIT_DIR branch --list --all; 
git --bare --git-dir=$GIT_DIR tag;'

簽出FETCH_HEAD代碼

(py38) $ GIT_DIR=$HOME/github/env2.git \
USER_CODE_DIR=$HOME/code \
CODE_GIT_TAG=FETCH_HEAD \
GIT_WORK_TREE=$USER_CODE_DIR/env2-$CODE_GIT_TAG \
time -p bash -c '
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR reset --soft $CODE_GIT_TAG;
git --bare --git-dir=$GIT_DIR --work-tree=$GIT_WORK_TREE clean -fxd;
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR checkout-index --force --all --prefix=$GIT_WORK_TREE/;
git --bare --git-dir=$GIT_DIR --work-tree=$GIT_WORK_TREE describe --all --long;'

添加一個可執(zhí)行鏈接

USER_CODE_DIR=$HOME/code \
CODE_GIT_TAG=FETCH_HEAD \
GIT_WORK_TREE=$USER_CODE_DIR/env2-$CODE_GIT_TAG \
time -p bash -c '
ln -s $USER_CODE_DIR/env2-$CODE_GIT_TAG/env2 $HOME/bin/'

制作module files

從shell腳本制作module file

(py38) $ env2 -from sh -to modulecmd "$HOME/application/compiler/setenv_AOCC-2.0.0.sh" -o output && mv env2.modulecmd /tmp/aocc-compiler-2.0.0-tmp
(py38) $ env2 -from sh -to modulecmd "$HOME/application/compiler/setenv_AOCC-2.1.0.sh" -o output && mv env2.modulecmd /tmp/aocc-compiler-2.1.0-tmp
(py38) $ module purge
(py38) $ module load /tmp/aocc-compiler-2.0.0-tmp
(py38) $ env2 -from sh -to modulecmd "$HOME/application/compiler/setenv_AOCC-2.1.0.sh" -o output && mv env2.modulecmd 2.1.0
(py38) $ module purge
(py38) $ module load /tmp/aocc-compiler-2.1.0-tmp
(py38) $ env2 -from sh -to modulecmd "$HOME/application/compiler/setenv_AOCC-2.0.0.sh" -o output && mv env2.modulecmd 2.0.0
(py38) $ mv 2.0.0 2.1.0 $HOME/ascii/modulefiles/aocc

檢視制作好的module file,添加注釋

(py38) $ cat $HOME/ascii/modulefiles/aocc/2.1.0 
#%Module1.0###################################################################
append-path CPLUS_INCLUDE_PATH {/lustre/application/compiler/aocc-compiler-2.1.0/include};
prepend-path PATH {/lustre/application/compiler/aocc-compiler-2.1.0/bin};
append-path C_INCLUDE_PATH {/lustre/application/compiler/aocc-compiler-2.1.0/include};
prepend-path LD_LIBRARY_PATH {/lustre/application/compiler/aocc-compiler-2.1.0/lib32};
prepend-path LD_LIBRARY_PATH {/lustre/application/compiler/aocc-compiler-2.1.0/lib};
prepend-path LD_LIBRARY_PATH {/usr/lib};
prepend-path LD_LIBRARY_PATH {/usr/lib64};
prepend-path LIBRARY_PATH {/lustre/application/compiler/aocc-compiler-2.1.0/lib32};
prepend-path LIBRARY_PATH {/lustre/application/compiler/aocc-compiler-2.1.0/lib};
prepend-path LIBRARY_PATH {/usr/lib};
prepend-path LIBRARY_PATH {/usr/lib64};
#eof env2.modulecmd

用其它軟件制作管理module file

brightcomputing有這樣的腳本,可能要收費

(py38) $ rpm -qi env-modules-slave
Name        : env-modules-slave            Relocations: (not relocatable)
Version     : 3.2.10                            Vendor: modules project
Release     : 86_cm7.1                      Build Date: Mon 20 Apr 2015 03:52:16 AM +08
Install Date: Tue 15 Sep 2015 10:19:54 AM +08      Build Host: rhel6-buildhost64-nonvm.brightcomputing.com
Group       : Utilities/Shell               Source RPM: env-modules-3.2.10-86_cm7.1.src.rpm
Size        : 206201                           License: GPL
Signature   : (none)
Packager    : Martijn de Vries <martijn.devries@brightcomputing.com>
URL         : http://modules.sourceforge.net
Summary     : Environment Modules initialization scripts
Description :
The Modules package provides for the dynamic modification of a user's
environment via modulefiles.
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 由于習慣了 GIT 版本管理,切回 SVN 落差太大.下面總結(jié)用 GIT 操作 SVN. 一.原理 1.本地倉庫以...
    Jack0111閱讀 3,179評論 0 1
  • 查看、添加、提交、刪除、找回,重置修改文件 git help # 顯示command的help git sho...
    Swiftor閱讀 2,212評論 0 2
  • Xcode 9 Release Notes See more downloads 關(guān)于Xcode Accessin...
    印林泉閱讀 4,731評論 7 3
  • 設(shè)置用戶名郵箱 生成密鑰對 看一下有沒有id_rsa和id_rsa.pub(或者是id_dsa和id_dsa.pu...
    8546ed36e321閱讀 324評論 0 1
  • 1. GIT命令 git init在本地新建一個repo,進入一個項目目錄,執(zhí)行g(shù)it init,會初始化一個re...
    江邊一蓑煙閱讀 895評論 0 0

友情鏈接更多精彩內(nèi)容