fix lookaside patch tree mode, and support numless Source/Patch

This commit is contained in:
Mustafa Gezen 2021-02-26 14:06:02 +01:00
parent 097f48e399
commit 81b27414d2
2 changed files with 7 additions and 5 deletions

View File

@ -68,7 +68,7 @@ func lookaside(cfg *srpmprocpb.Cfg, _ *data.ProcessData, md *data.ModeData, patc
}
} else {
if directive.FromPatchTree {
pushF, err := pushTree.Filesystem.OpenFile(filepath.Join("SOURCES", file), os.O_CREATE|os.O_TRUNC|os.O_RDWR, stat.Mode())
pushF, err := pushTree.Filesystem.OpenFile(filepath.Join("SOURCES", filepath.Base(file)), os.O_CREATE|os.O_TRUNC|os.O_RDWR, stat.Mode())
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_CREATE_FILE_IN_PUSH_TREE:%s", file))
}

View File

@ -57,11 +57,13 @@ func sourcePatchOperationInLoop(req *sourcePatchOperationInLoopRequest) error {
break
}
}
sourceNum, err := strconv.Atoi(strings.Split(req.field, req.expectedField)[1])
if err != nil {
return errors.New(fmt.Sprintf("INVALID_%s_NUM", strings.ToUpper(req.expectedField)))
if req.field != req.expectedField {
sourceNum, err := strconv.Atoi(strings.Split(req.field, req.expectedField)[1])
if err != nil {
return errors.New(fmt.Sprintf("INVALID_%s_NUM:%s", strings.ToUpper(req.expectedField), req.field))
}
*req.lastNum = sourceNum
}
*req.lastNum = sourceNum
}
return nil