为task增加sourcepath,便于处理

This commit is contained in:
algotao
2025-07-25 12:04:16 +08:00
parent d1ad148725
commit a2bf3c853e
5 changed files with 303 additions and 63 deletions

View File

@@ -7,6 +7,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"runtime"
"sort"
"strings"
@@ -89,6 +90,7 @@ func RunTaskMake(args ...string) error {
TaskDescription: *desc,
Appid: *appid,
DataspaceId: *ds,
SourcePath: *sourcePath,
},
}
return doMakeHash(makeTaskParams, true)
@@ -207,10 +209,12 @@ func doTaskMake(makeTaskParams *makeTaskParams) error {
})
// 输出结果
relPath, _ := filepath.Rel(makeTaskParams.task.GetSourcePath(), makeTaskParams.sourcePath)
fileInfo := &saasapi.FileInfo{
FileName: makeTaskParams.sourcePath,
FileName: relPath,
FileSize: uint64(fi.Size()),
}
for _, r := range allResults {
fileInfo.FileBlocks = append(fileInfo.FileBlocks, &saasapi.FileBlock{
BlockSha256: r.hash,
@@ -219,6 +223,8 @@ func doTaskMake(makeTaskParams *makeTaskParams) error {
}
makeTaskParams.task.TaskFileInfos = append(makeTaskParams.task.TaskFileInfos, fileInfo)
makeTaskParams.task.TaskSize += uint64(fi.Size())
fmt.Println("")
return nil
}