aboutsummaryrefslogtreecommitdiff
path: root/builder
diff options
context:
space:
mode:
authorCatalin Stratu <catalinstratu45@gmail.com>2022-03-14 16:42:13 +0200
committerCatalin Stratu <catalinstratu45@gmail.com>2022-03-15 11:24:39 +0200
commitd87b06509712d2369d1cad8b814370b0519c7379 (patch)
treebebcbe54449570ebaa1b08094c7b92c7115c1a0f /builder
parentafc5d6449b2f92e44b423df2f3f1129c43473c53 (diff)
downloadspdx-tools-d87b06509712d2369d1cad8b814370b0519c7379.tar.gz
file patch fixes
Signed-off-by: Catalin Stratu <catalinstratu45@gmail.com>
Diffstat (limited to 'builder')
-rw-r--r--builder/builder2v1/build_package.go5
-rw-r--r--builder/builder2v2/build_package.go4
2 files changed, 6 insertions, 3 deletions
diff --git a/builder/builder2v1/build_package.go b/builder/builder2v1/build_package.go
index ffc5d06..b1503e1 100644
--- a/builder/builder2v1/build_package.go
+++ b/builder/builder2v1/build_package.go
@@ -5,6 +5,7 @@ package builder2v1
import (
"fmt"
"path/filepath"
+ "strings"
"github.com/spdx/tools-golang/spdx"
"github.com/spdx/tools-golang/utils"
@@ -26,14 +27,14 @@ func BuildPackageSection2_1(packageName string, dirRoot string, pathsIgnore []st
files := map[spdx.ElementID]*spdx.File2_1{}
fileNumber := 0
for _, fp := range filepaths {
- newFile, err := BuildFileSection2_1(filepath.FromSlash(filepath.ToSlash("./"+fp)), dirRoot, fileNumber)
+ newFilePatch := filepath.FromSlash("./" + fp)
+ newFile, err := BuildFileSection2_1(strings.Replace(newFilePatch, string(filepath.Separator), "/", -1), dirRoot, fileNumber)
if err != nil {
return nil, err
}
files[newFile.FileSPDXIdentifier] = newFile
fileNumber++
}
-
// get the verification code
code, err := utils.GetVerificationCode2_1(files, "")
if err != nil {
diff --git a/builder/builder2v2/build_package.go b/builder/builder2v2/build_package.go
index a5b2206..7f871a4 100644
--- a/builder/builder2v2/build_package.go
+++ b/builder/builder2v2/build_package.go
@@ -5,6 +5,7 @@ package builder2v2
import (
"fmt"
"path/filepath"
+ "strings"
"github.com/spdx/tools-golang/spdx"
"github.com/spdx/tools-golang/utils"
@@ -26,7 +27,8 @@ func BuildPackageSection2_2(packageName string, dirRoot string, pathsIgnore []st
files := map[spdx.ElementID]*spdx.File2_2{}
fileNumber := 0
for _, fp := range filepaths {
- newFile, err := BuildFileSection2_2(filepath.FromSlash(filepath.ToSlash("./"+fp)), dirRoot, fileNumber)
+ newFilePatch := filepath.FromSlash("./" + fp)
+ newFile, err := BuildFileSection2_2(strings.Replace(newFilePatch, string(filepath.Separator), "/", -1), dirRoot, fileNumber)
if err != nil {
return nil, err
}