File indexing completed on 2024-04-06 12:03:10
0001
0002
0003 exec tclsh "$0" ${1+"$@"}
0004
0005 global env
0006 if {![info exists env(CMSSW_BASE)]} {
0007 puts stderr "Please set up CMSSW environment first"
0008 exit 1
0009 }
0010
0011 set current_dir [pwd]
0012 set cmssw_base $env(CMSSW_BASE)
0013 set testdir $cmssw_base/src/CondTools/Hcal/test
0014 set pkgdir HBHENegativeEFilter
0015
0016 set pkg_files {
0017 DataFormats/HcalDetId {
0018 HcalDetId.h
0019 HcalDetId.cc
0020 HcalSubdetector.h
0021 }
0022 DataFormats/DetId {
0023 DetId.h
0024 }
0025 CondTools/Hcal {
0026 make_HBHENegativeEFilter.h
0027 }
0028 CondFormats/HcalObjects {
0029 HBHENegativeEFilter.h
0030 HBHENegativeEFilter.cc
0031 PiecewiseScalingPolynomial.h
0032 PiecewiseScalingPolynomial.cc
0033 }
0034 }
0035
0036 set test_files {
0037 write_HBHENegativeEFilter.cc
0038 make_HBHENegativeEFilter.cc
0039 }
0040
0041 set copy_files {
0042 Makefile.4 Makefile
0043 }
0044
0045
0046
0047
0048
0049
0050 cd [file join $cmssw_base src]
0051 set filelist [list]
0052 set includemap [list "\#include \"FWCore/Utilities/interface/Exception.h\"" \
0053 "\#include <stdexcept>"]
0054 lappend includemap cms::Exception std::runtime_error
0055
0056 foreach {pkg files} $pkg_files {
0057 if {![file isdirectory $pkg]} {
0058 exec git cms-addpkg $pkg
0059 }
0060 foreach f $files {
0061 if {[string equal [file extension $f] ".h"]} {
0062 set header "$pkg/interface/$f"
0063 lappend includemap "\#include \"$header\"" "\#include \"$f\""
0064 lappend filelist $header
0065 } else {
0066 lappend filelist "$pkg/src/$f"
0067 }
0068 }
0069 }
0070
0071 if {![file isdirectory CondFormats/Serialization]} {
0072 exec git cms-addpkg CondFormats/Serialization
0073 }
0074
0075 proc file_contents {filename} {
0076 set chan [open $filename "r"]
0077 set contents [read $chan [file size $filename]]
0078 close $chan
0079 set contents
0080 }
0081
0082 proc filemap {infile outfile map} {
0083 set fix [list "(\"Invalid DetId\") <<" "(\"Invalid DetId\"); // <<"]
0084 set in_data [file_contents $infile]
0085 set chan [open $outfile "w"]
0086 puts -nonewline $chan [string map $fix [string map $map $in_data]]
0087 close $chan
0088 }
0089
0090 set todir "$testdir/$pkgdir"
0091 file delete -force $todir
0092 exec /bin/mkdir -p $todir
0093 exec /bin/mkdir -p $todir/CondFormats/Serialization/interface
0094 file copy -force CondFormats/Serialization/interface/eos \
0095 $todir/CondFormats/Serialization/interface
0096 file copy -force CondFormats/Serialization/src/templateInstantiations.cc $todir
0097
0098 foreach f $filelist {
0099 set outfile [file join "$todir" [file tail $f]]
0100 filemap $f $outfile $includemap
0101 }
0102
0103 foreach f $test_files {
0104 set infile [file join $testdir $f]
0105 set outfile [file join $todir $f]
0106 filemap $infile $outfile $includemap
0107 }
0108
0109 foreach {f1 f2} $copy_files {
0110 set infile [file join $testdir $f1]
0111 set outfile [file join $todir $f2]
0112 file copy -force $infile $outfile
0113 }
0114
0115 set tarfile [file join $current_dir $pkgdir.tar.gz]
0116 file delete -force $tarfile
0117 cd $testdir
0118 exec /bin/tar -czvf $tarfile $pkgdir
0119 file delete -force $todir
0120 puts "Wrote file $pkgdir.tar.gz"
0121
0122 exit 0