From 0f636ea4276e66e4656eaf8afb2e9ae760abba27 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 16:07:52 +0000 Subject: [PATCH 01/10] Try to create WORKSPACE relative paths --- meta/folder.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 52ceb06..245d961 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -554,13 +554,16 @@ class MetaInfo extends GISJsonSerialised { } String relativize(String path) { - def Path thispath = Paths.get(path) - if (thispath.startsWith(script.WORKSPACE)) { + def Path mypath = Paths.get(path) + String pathRelative + if (mypath.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) - def Path wsrelativePath = wspath.relativize(thispath) - return wsrelativePath.toString() + def Path wsrelativePath = wspath.relativize(mypath) + pathRelative = wsrelativePath.toString() + } else { + pathRelative = mypath.toString() } - return path + return pathRelative } static String metafilepath() { From dc6e7c6b1d5a0e54aec98ce61539ae27b855c2dd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:05:25 +0000 Subject: [PATCH 02/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 245d961..d7cbc4f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -556,12 +556,15 @@ class MetaInfo extends GISJsonSerialised { String relativize(String path) { def Path mypath = Paths.get(path) String pathRelative - if (mypath.startsWith(script.WORKSPACE)) { + script.echo("Seeing if ${path} begins with from ${script.WORKSPACE}") + if (path.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) pathRelative = wsrelativePath.toString() + script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}" } else { pathRelative = mypath.toString() + script.echo("Path relative is unchanged: ${pathRelative}" } return pathRelative } From de9e4d82ed9664de567db925c1213be31cc8e84a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:07:33 +0000 Subject: [PATCH 03/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d7cbc4f..0c94a12 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -561,7 +561,7 @@ class MetaInfo extends GISJsonSerialised { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) pathRelative = wsrelativePath.toString() - script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}" + script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") } else { pathRelative = mypath.toString() script.echo("Path relative is unchanged: ${pathRelative}" From 6ca84a13fecedfda50a8a8f594bf761b60a26fc9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:18:29 +0000 Subject: [PATCH 04/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0c94a12..f6797a2 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -564,7 +564,7 @@ class MetaInfo extends GISJsonSerialised { script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") } else { pathRelative = mypath.toString() - script.echo("Path relative is unchanged: ${pathRelative}" + script.echo("Path relative is unchanged: ${pathRelative}") } return pathRelative } From d66b7b80d602550ccae4aca1b1483f36f19b4a67 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:21:14 +0000 Subject: [PATCH 05/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f6797a2..ce041d0 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -556,7 +556,7 @@ class MetaInfo extends GISJsonSerialised { String relativize(String path) { def Path mypath = Paths.get(path) String pathRelative - script.echo("Seeing if ${path} begins with from ${script.WORKSPACE}") + script.echo("Seeing if ${path} begins with ${script.WORKSPACE}") if (path.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) From 736f0ece675736032cc8b1dc1f33c313015648e4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:45:39 +0000 Subject: [PATCH 06/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ce041d0..74c00cc 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -553,17 +553,14 @@ class MetaInfo extends GISJsonSerialised { deserialiseJson(rawmeta) } - String relativize(String path) { - def Path mypath = Paths.get(path) + String relativize(String mypath) { String pathRelative - script.echo("Seeing if ${path} begins with ${script.WORKSPACE}") - if (path.startsWith(script.WORKSPACE)) { - def Path wspath = Paths.get(script.WORKSPACE) - def Path wsrelativePath = wspath.relativize(mypath) - pathRelative = wsrelativePath.toString() - script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") + script.echo("Seeing if ${mypath} begins with ${script.WORKSPACE}") + if (mypath.startsWith(script.WORKSPACE)) { + pathRelative = mypath.minus(script.WORKSPACE) + script.echo("Extracted ${pathRelative} from ${script.WORKSPACE} and ${mypath}") } else { - pathRelative = mypath.toString() + pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } return pathRelative From d2bd59bfa5c3a6d922a118e86fc46e707f4b5f90 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 18:07:16 +0000 Subject: [PATCH 07/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 74c00cc..1f90c61 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -563,6 +563,13 @@ class MetaInfo extends GISJsonSerialised { pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } + // Strip leading / if any + pathRelative = pathRelative.replaceAll("^/+", "") + // Strip leading \ if any + pathRelative = pathRelative.replaceAll("^\\+", "") + + script.echo("Path relative is ${pathRelative}") + return pathRelative } From 4c7726123e43370c5c6397b678615717ec11e8ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:06:38 +0000 Subject: [PATCH 08/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1f90c61..3a4d464 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -564,9 +564,11 @@ class MetaInfo extends GISJsonSerialised { script.echo("Path relative is unchanged: ${pathRelative}") } // Strip leading / if any - pathRelative = pathRelative.replaceAll("^/+", "") + pathRelative = pathRelative.replaceAll('^/+', '') // Strip leading \ if any - pathRelative = pathRelative.replaceAll("^\\+", "") + pathRelative = pathRelative.replaceAll('^\\+', '') + // Convert \ with / + pathRelative = pathRelative.replaceAll('\\', '/') script.echo("Path relative is ${pathRelative}") From da35fd3aa07e1ee84822752e74a9b2fcc3a5ec3e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:23:02 +0000 Subject: [PATCH 09/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 3a4d464..adfee97 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -568,7 +568,7 @@ class MetaInfo extends GISJsonSerialised { // Strip leading \ if any pathRelative = pathRelative.replaceAll('^\\+', '') // Convert \ with / - pathRelative = pathRelative.replaceAll('\\', '/') + pathRelative = pathRelative.replace('\\', '/') script.echo("Path relative is ${pathRelative}") From 06ca80c596d36ce9c758edd6982132eec3e3c44a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:46:23 +0000 Subject: [PATCH 10/10] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index adfee97..f9d4bf3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -563,12 +563,10 @@ class MetaInfo extends GISJsonSerialised { pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } + // Convert \ with / + pathRelative = pathRelative.tokenize('\\').join('/') // Strip leading / if any pathRelative = pathRelative.replaceAll('^/+', '') - // Strip leading \ if any - pathRelative = pathRelative.replaceAll('^\\+', '') - // Convert \ with / - pathRelative = pathRelative.replace('\\', '/') script.echo("Path relative is ${pathRelative}")