@@ -34,23 +34,31 @@ timeout(time: 6, unit: 'HOURS') {
3434 node (NODE_LABEL ) {
3535 timestamps {
3636 try {
37- def remoteConfigParameters = [refspec : " +refs/pull/${ ghprbPullId} /*:refs/remotes/origin/pr/${ ghprbPullId} /* +refs/heads/${ ghprbTargetBranch} :refs/remotes/origin/${ ghprbTargetBranch} " ,
38- url : SRC_REPO ]
37+ def remoteConfigParameters = [
38+ refspec : " +refs/pull/${ ghprbPullId} /*:refs/remotes/origin/pr/${ ghprbPullId} /* +refs/heads/${ ghprbTargetBranch} :refs/remotes/origin/${ ghprbTargetBranch} " ,
39+ url : SRC_REPO
40+ ]
3941 if (GIT_CREDENTIALS_ID ) {
4042 remoteConfigParameters. put(" credentialsId" , " ${ GIT_CREDENTIALS_ID} " )
4143 }
4244 String REPO_CACHE_DIR = params. REPO_CACHE_DIR ?: " ${ env.HOME} /openjdk_cache"
4345
44- checkout changelog : false , poll : false ,
45- scm : [$class : ' GitSCM' ,
46- branches : [[name : sha1]],
47- doGenerateSubmoduleConfigurations : false ,
48- extensions : [[$class : ' CloneOption' ,
49- depth : 0 ,
50- noTags : false ,
51- reference : " ${ REPO_CACHE_DIR} " ,
52- shallow : false ]],
53- userRemoteConfigs : [remoteConfigParameters]]
46+ checkout
47+ changelog : false ,
48+ poll : false ,
49+ scm : [
50+ $class : ' GitSCM' ,
51+ branches : [[name : sha1]],
52+ doGenerateSubmoduleConfigurations : false ,
53+ extensions : [[
54+ $class : ' CloneOption' ,
55+ depth : 0 ,
56+ noTags : false ,
57+ reference : " ${ REPO_CACHE_DIR} " ,
58+ shallow : false
59+ ]],
60+ userRemoteConfigs : [remoteConfigParameters]
61+ ]
5462
5563 if (GIT_CREDENTIALS_ID ) {
5664 sshagent(credentials :[" ${ GIT_CREDENTIALS_ID} " ]) {
@@ -65,7 +73,7 @@ timeout(time: 6, unit: 'HOURS') {
6573 } else {
6674 def FILES_LIST = FILES . split(" \\ r?\\ n" )
6775 FILES_LIST . each() {
68- println " Checking file: '${ it} '"
76+ echo " Checking file: '${ it} '"
6977 TYPE = sh (
7078 script : " file -b '${ it} '" ,
7179 returnStdout : true
@@ -80,7 +88,18 @@ timeout(time: 6, unit: 'HOURS') {
8088 case ~/ .*\. bat/ :
8189 switch (TYPE ) {
8290 case ~/ .*CRLF line terminators.*/ :
83- echo " Good windows script: '${ it} ' type: '${ TYPE} '"
91+ # check for CRLF at EOF
92+ NEWLINES = sh (
93+ script : " tail -c2 '${ it} ' | wc -l" ,
94+ returnStdout : true
95+ ). trim()
96+ if (NEWLINES == " 1" ) {
97+ echo " Good Windows script: '${ it} ' type: '${ TYPE} '"
98+ } else {
99+ echo " ERROR - should have final line terminator: '${ it} ' type: '${ TYPE} '"
100+ FAIL = true
101+ BAD_FILES << " ${ it} "
102+ }
84103 break
85104 default :
86105 echo " ERROR - should have CRLF line terminators: '${ it} ' type: '${ TYPE} '"
@@ -95,7 +114,18 @@ timeout(time: 6, unit: 'HOURS') {
95114 BAD_FILES << " ${ it} "
96115 break
97116 default :
98- echo " Good text file: '${ it} ' type: '${ TYPE} '"
117+ # check for LF at EOF
118+ NEWLINES = sh (
119+ script : " tail -c1 '${ it} ' | wc -l" ,
120+ returnStdout : true
121+ ). trim()
122+ if (NEWLINES == " 1" ) {
123+ echo " Good text file: '${ it} ' type: '${ TYPE} '"
124+ } else {
125+ echo " ERROR - should have final line terminator: '${ it} ' type: '${ TYPE} '"
126+ FAIL = true
127+ BAD_FILES << " ${ it} "
128+ }
99129 break
100130 }
101131 }
@@ -112,7 +142,7 @@ timeout(time: 6, unit: 'HOURS') {
112142 echo " ${ HASHES} "
113143 sh ' exit 1'
114144 } else {
115- println " Checking for added trailing whitespace..."
145+ echo " Checking for added trailing whitespace..."
116146 if (GIT_CREDENTIALS_ID ) {
117147 sshagent(credentials :[" ${ GIT_CREDENTIALS_ID} " ]) {
118148 WHITESPACE_ERRORS = get_whitespaces()
0 commit comments