Skip to content

Commit

Permalink
Add automatic Modulefile for sim/gen
Browse files Browse the repository at this point in the history
  • Loading branch information
Dario Berzano authored and dberzano committed Nov 22, 2017
1 parent a4d5172 commit da8d725
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
32 changes: 31 additions & 1 deletion generators.sh
Expand Up @@ -4,4 +4,34 @@ requires:
- pythia
- pythia6
---
# A catch all recipe for all the generators.
#!/bin/bash -e

# Catch-all recipe. Requires a Modulefile for CVMFS. To add new dependencies it
# is sufficient to change the `requires:` field. Modulefile will update deps
# automatically

MODULEFILE_REQUIRES=""
for PKG in $REQUIRES; do
[[ $PKG != defaults* ]] || continue
PKG_UP=$(echo $PKG|tr '[:lower:]' '[:upper:]'|tr '-' '_')
MODULEFILE_REQUIRES="$MODULEFILE_REQUIRES $PKG/$(eval echo \$${PKG_UP}_VERSION-\$${PKG_UP}_REVISION)"
done
MODULEFILE_REQUIRES=$(echo $MODULEFILE_REQUIRES)

# Modulefile
MODULEDIR="$INSTALLROOT/etc/modulefiles"
MODULEFILE="$MODULEDIR/$PKGNAME"
mkdir -p "$MODULEDIR"
cat > "$MODULEFILE" <<EoF
#%Module1.0
proc ModulesHelp { } {
global version
puts stderr "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
}
set version $PKGVERSION-@@PKGREVISION@$PKGHASH@@
module-whatis "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
# Dependencies
module load BASE/1.0 $MODULEFILE_REQUIRES
# Our environment
setenv GENERATORS_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
EoF
32 changes: 31 additions & 1 deletion simulation.sh
Expand Up @@ -6,4 +6,34 @@ requires:
- GEANT3
- HepMC
---
# A catch all recipe for all the generators.
#!/bin/bash -e

# Catch-all recipe. Requires a Modulefile for CVMFS. To add new dependencies it
# is sufficient to change the `requires:` field. Modulefile will update deps
# automatically

MODULEFILE_REQUIRES=""
for PKG in $REQUIRES; do
[[ $PKG != defaults* ]] || continue
PKG_UP=$(echo $PKG|tr '[:lower:]' '[:upper:]'|tr '-' '_')
MODULEFILE_REQUIRES="$MODULEFILE_REQUIRES $PKG/$(eval echo \$${PKG_UP}_VERSION-\$${PKG_UP}_REVISION)"
done
MODULEFILE_REQUIRES=$(echo $MODULEFILE_REQUIRES)

# Modulefile
MODULEDIR="$INSTALLROOT/etc/modulefiles"
MODULEFILE="$MODULEDIR/$PKGNAME"
mkdir -p "$MODULEDIR"
cat > "$MODULEFILE" <<EoF
#%Module1.0
proc ModulesHelp { } {
global version
puts stderr "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
}
set version $PKGVERSION-@@PKGREVISION@$PKGHASH@@
module-whatis "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
# Dependencies
module load BASE/1.0 $MODULEFILE_REQUIRES
# Our environment
setenv SIMULATION_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
EoF

0 comments on commit da8d725

Please sign in to comment.