Skip to content

Commit

Permalink
Merge pull request #283 from tbs60/dev_tming
Browse files Browse the repository at this point in the history
Dev tming
  • Loading branch information
tming authored Aug 22, 2024
2 parents ee07b06 + 0fa10c9 commit 2652533
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src/backend/booster/bk_dist/common/sdk/toolchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,27 @@ func checkAndAdd(i *dcFile.Info, remotepath string, files *[]FileDesc) error {
// 得到所有关联文件;如果是链接,则递归搜索,直到找到非链接为止
// 如果发现链接循环,则报错
func getRecursiveFiles(f string, remotepath string, files *[]FileDesc) error {
// 如果远端路径和本地不一致,则需要将链接替换为真实文件发送过去
localdir := filepath.Dir(f)
if localdir != remotepath {
i := dcFile.Stat(f)
if !i.Exist() {
err := fmt.Errorf("file %s not existed", f)
blog.Errorf("%v", err)
return err
}

return checkAndAdd(i, remotepath, files)
}

i := dcFile.Lstat(f)
if !i.Exist() {
err := fmt.Errorf("file %s not existed", f)
blog.Errorf("%v", err)
return err
}

// 链接,需要递归
// 如果远端路径和本地一致,则将链接相关的文件都包含进来
if i.Basic().Mode()&os.ModeSymlink != 0 {
originFile, err := os.Readlink(f)
if err == nil {
Expand Down Expand Up @@ -247,7 +260,7 @@ func (t *Toolchain) ToFileDesc() ([]FileDesc, error) {
}
}

blog.Infof("toolchain: get all files:%v", toolfiles)
blog.Debugf("toolchain: get all files:%v", toolfiles)

return toolfiles, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ func (m *Mgr) getToolFileInfoByKey(key string) *types.FileCollectionInfo {
blog.Infof("remote: ready get relative toolchain files for %s", key)
toolchainfiles, timestamp, err := m.work.Basic().GetToolChainRelativeFiles(key)
if err == nil && len(toolchainfiles) > 0 {
blog.Infof("remote: got toolchain files for %s:%v", key, toolchainfiles)
blog.Debugf("remote: got toolchain files for %s:%v", key, toolchainfiles)
return &types.FileCollectionInfo{
UniqID: key,
Files: toolchainfiles,
Expand All @@ -1626,7 +1626,7 @@ func (m *Mgr) getToolFileInfoByKey(key string) *types.FileCollectionInfo {
blog.Infof("remote: ready get normal toolchain files for %s", key)
toolchainfiles, timestamp, err := m.work.Basic().GetToolChainFiles(key)
if err == nil && len(toolchainfiles) > 0 {
blog.Infof("remote: got toolchain files for %s:%v", key, toolchainfiles)
blog.Debugf("remote: got toolchain files for %s:%v", key, toolchainfiles)
return &types.FileCollectionInfo{
UniqID: key,
Files: toolchainfiles,
Expand Down

0 comments on commit 2652533

Please sign in to comment.