From d954694760aff59a2aacd0c359a1c4340c4bca5b Mon Sep 17 00:00:00 2001 From: rsora Date: Tue, 7 Apr 2020 19:19:39 +0200 Subject: [PATCH 1/4] add build-path fallback POC in upload --- commands/upload/upload.go | 41 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/commands/upload/upload.go b/commands/upload/upload.go index c373c9b049f..c305b80eaf0 100644 --- a/commands/upload/upload.go +++ b/commands/upload/upload.go @@ -25,6 +25,7 @@ import ( "strings" "time" + "github.com/arduino/arduino-cli/arduino/builder" "github.com/arduino/arduino-cli/arduino/cores" "github.com/arduino/arduino-cli/arduino/sketches" "github.com/arduino/arduino-cli/cli/feedback" @@ -156,6 +157,7 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr var importPath *paths.Path var importFile string + // If no importFile is passed, use sketch path if req.GetImportFile() == "" { importPath = sketch.FullPath importFile = sketch.Name + "." + fqbnSuffix @@ -169,19 +171,52 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr if !ok { return nil, fmt.Errorf("property 'recipe.output.tmp_file' not defined") } + ext := filepath.Ext(outputTmpFile) if strings.HasSuffix(importFile, ext) { importFile = importFile[:len(importFile)-len(ext)] } + // Check if the file ext we calculate is the same that is needed by the upload recipe + recipet := uploadProperties.Get("upload.pattern") + cmdLinet := uploadProperties.ExpandPropsInString(recipet) + cmdArgst, err := properties.SplitQuotedString(cmdLinet, `"'`, false) + var tPath *paths.Path + if err != nil { + return nil, fmt.Errorf("invalid recipe '%s': %s", recipet, err) + } + for _, t := range cmdArgst { + if strings.Contains(t, "build.project_name") { + tPath = paths.New(t) + } + } + + if ext != tPath.Ext() { + ext = tPath.Ext() + } + //uploadRecipeInputFileExt := uploadProperties.SetPath("build.path", importPath) uploadProperties.Set("build.project_name", importFile) uploadFile := importPath.Join(importFile + ext) if _, err := uploadFile.Stat(); err != nil { - if os.IsNotExist(err) { - return nil, fmt.Errorf("compiled sketch %s not found", uploadFile.String()) + if !os.IsNotExist(err) { + return nil, fmt.Errorf("cannot open sketch: %s", err) } - return nil, fmt.Errorf("cannot open sketch: %s", err) + // Built sketch not found in the provided path, let's fallback to the temp compile path + fallbackBuildPath := builder.GenBuildPath(sketchPath) + logrus.Warnf("Built sketch not found in %s, let's fallback to %s", uploadFile, fallbackBuildPath) + uploadProperties.SetPath("build.path", fallbackBuildPath) + // If we search inside the build.path, compile artifact do not have the fqbnSuffix in the filename + uploadFile = fallbackBuildPath.Join(sketch.Name + ".ino" + ext) + if _, err := uploadFile.Stat(); err != nil { + if os.IsNotExist(err) { + return nil, fmt.Errorf("compiled sketch %s not found", uploadFile.String()) + } + return nil, fmt.Errorf("cannot open sketch: %s", err) + } + // Clean from extension + uploadProperties.Set("build.project_name", sketch.Name+".ino") + } // Perform reset via 1200bps touch if requested From f6bc899068fb7fb8692c63cea34f926f05f35a31 Mon Sep 17 00:00:00 2001 From: rsora Date: Tue, 7 Apr 2020 19:25:43 +0200 Subject: [PATCH 2/4] Add passing of build-path to upload to allow fallback in case of custom build-path --- cli/compile/compile.go | 1 + commands/upload/upload.go | 9 ++- rpc/commands/lib.pb.go | 165 +++++++++++++++++++------------------- rpc/commands/upload.pb.go | 48 ++++++----- rpc/commands/upload.proto | 3 +- 5 files changed, 123 insertions(+), 103 deletions(-) diff --git a/cli/compile/compile.go b/cli/compile/compile.go index 0ddaf97232f..3385ba6d1aa 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -135,6 +135,7 @@ func run(cmd *cobra.Command, args []string) { Verbose: verbose, Verify: verify, ImportFile: exportFile, + BuildPath: buildPath, }, os.Stdout, os.Stderr) if err != nil { diff --git a/commands/upload/upload.go b/commands/upload/upload.go index c305b80eaf0..fd67595904c 100644 --- a/commands/upload/upload.go +++ b/commands/upload/upload.go @@ -203,7 +203,14 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr return nil, fmt.Errorf("cannot open sketch: %s", err) } // Built sketch not found in the provided path, let's fallback to the temp compile path - fallbackBuildPath := builder.GenBuildPath(sketchPath) + var fallbackBuildPath *paths.Path + if req.GetBuildPath() != "" { + fallbackBuildPath = paths.New(req.GetBuildPath()) + } else { + + fallbackBuildPath = builder.GenBuildPath(sketchPath) + } + logrus.Warnf("Built sketch not found in %s, let's fallback to %s", uploadFile, fallbackBuildPath) uploadProperties.SetPath("build.path", fallbackBuildPath) // If we search inside the build.path, compile artifact do not have the fqbnSuffix in the filename diff --git a/rpc/commands/lib.pb.go b/rpc/commands/lib.pb.go index 3906f264c8a..93eb441985b 100644 --- a/rpc/commands/lib.pb.go +++ b/rpc/commands/lib.pb.go @@ -1416,85 +1416,88 @@ func init() { func init() { proto.RegisterFile("commands/lib.proto", fileDescriptor_9feed0d29806df6c) } var fileDescriptor_9feed0d29806df6c = []byte{ - // 1276 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xcd, 0x6f, 0xdc, 0x44, - 0x14, 0xaf, 0x77, 0xdb, 0x64, 0xf7, 0x6d, 0xd2, 0x38, 0xd3, 0xb4, 0x75, 0x53, 0xda, 0x2e, 0x16, - 0x1f, 0xdb, 0x54, 0xd9, 0xa0, 0x22, 0x55, 0xa8, 0x52, 0x41, 0x85, 0xb4, 0xa8, 0x28, 0xaa, 0x22, - 0xf7, 0xe3, 0x00, 0x48, 0xd6, 0xac, 0xfd, 0xb2, 0x19, 0x65, 0xd6, 0x76, 0x67, 0xc6, 0x5b, 0x2d, - 0x17, 0xbe, 0xae, 0x5c, 0xb8, 0x73, 0xe0, 0x86, 0xc4, 0x1f, 0xc7, 0x95, 0x2b, 0x9a, 0xf1, 0xd8, - 0xfb, 0x91, 0x6c, 0x12, 0x50, 0x54, 0x10, 0xa7, 0xf8, 0x7d, 0xce, 0xef, 0xcd, 0x7b, 0xef, 0x67, - 0x67, 0x81, 0x44, 0xe9, 0x60, 0x40,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x3b, 0x0c, 0xa0, 0x21, 0x90, 0x23, 0x95, 0xa8, 0x27, 0x58, 0x1f, 0x77, 0xef, 0xb4, 0xc7, - 0x75, 0x03, 0x1b, 0xf8, 0x28, 0x51, 0x62, 0x14, 0x54, 0x79, 0xc8, 0x27, 0xb0, 0xc0, 0xa9, 0x42, - 0xa9, 0xcc, 0x1d, 0xb7, 0xee, 0xbe, 0x7f, 0xd2, 0x5c, 0xd8, 0x44, 0x81, 0x0d, 0x5b, 0x8f, 0x61, - 0x79, 0x2a, 0x37, 0x71, 0xa1, 0x7e, 0x80, 0x23, 0x0b, 0x5c, 0x3f, 0x92, 0x07, 0x70, 0x61, 0x48, - 0x79, 0x8e, 0x76, 0xed, 0x4e, 0x7d, 0x44, 0x11, 0x75, 0xbf, 0xf6, 0x91, 0xe3, 0xff, 0x51, 0x87, - 0x8b, 0xd3, 0x56, 0x72, 0x05, 0x16, 0x68, 0xae, 0xf6, 0x53, 0x61, 0x8f, 0xb2, 0xd2, 0xe4, 0xae, - 0xd4, 0xa6, 0x76, 0x85, 0xdc, 0x04, 0x18, 0x50, 0x96, 0x28, 0xca, 0x12, 0x14, 0x76, 0xa6, 0x26, - 0x34, 0x64, 0x1d, 0x1a, 0x12, 0x13, 0x85, 0x7a, 0x72, 0xce, 0x1b, 0x6b, 0x25, 0x93, 0xb7, 0xa0, - 0x99, 0x51, 0x41, 0xfb, 0x82, 0x66, 0xfb, 0xde, 0x05, 0x63, 0x1c, 0x2b, 0xf4, 0x99, 0xaf, 0xb1, - 0x27, 0x99, 0x42, 0x6f, 0xa1, 0x38, 0xd3, 0x8a, 0x3a, 0x67, 0x44, 0x15, 0xf6, 0x53, 0x31, 0xf2, - 0x16, 0x8b, 0x9c, 0xa5, 0x4c, 0xde, 0x81, 0x65, 0xdd, 0x24, 0xa6, 0x30, 0x52, 0xb9, 0x40, 0xe9, - 0x35, 0xda, 0xf5, 0x4e, 0x33, 0x98, 0x56, 0xea, 0x81, 0x54, 0xa3, 0x0c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 0x25, 0xee, 0x39, 0xd2, 0x80, 0xf3, 0xb9, 0x44, 0xe1, 0x3a, 0x3a, 0x47, 0x39, 0x70, 0x95, 0xbd, - 0x46, 0x6e, 0xc1, 0x75, 0x81, 0x7b, 0x28, 0xf4, 0x3a, 0xc6, 0xe1, 0x21, 0x87, 0xfa, 0xa7, 0x9b, - 0x5f, 0xde, 0xe9, 0x33, 0xb5, 0x9f, 0xf7, 0xf4, 0x25, 0x6c, 0xd9, 0x4b, 0x29, 0xff, 0x6e, 0x46, - 0x9c, 0x6d, 0x89, 0x2c, 0xda, 0x2a, 0x2f, 0xa8, 0xb7, 0x60, 0x7e, 0x26, 0xf8, 0xf0, 0xaf, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x9c, 0x45, 0xeb, 0x72, 0x6c, 0x10, 0x00, 0x00, + // 1318 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xcb, 0x6f, 0xdb, 0x46, + 0x13, 0x0f, 0xad, 0x44, 0x96, 0x46, 0x76, 0x4c, 0x6f, 0x9c, 0x84, 0x71, 0xbe, 0x24, 0xfe, 0x88, + 0x3e, 0x14, 0xa7, 0x96, 0x0b, 0x17, 0x08, 0x8a, 0x00, 0x69, 0x91, 0xd6, 0x49, 0x91, 0xc2, 0x08, + 0x0c, 0xe6, 0x71, 0x28, 0x0a, 0x10, 0x2b, 0x72, 0x2c, 0x2f, 0xbc, 0x22, 0x99, 0xdd, 0xa5, 0x02, + 0xf5, 0xd2, 0xd7, 0xb5, 0x97, 0xde, 0x7b, 0x68, 0x4f, 0x05, 0xfa, 0xc7, 0xf5, 0xda, 0x6b, 0xb1, + 0xcb, 0x25, 0x45, 0xc9, 0x76, 0xec, 0x16, 0x46, 0x5a, 0xf4, 0x64, 0xce, 0xfb, 0x37, 0x3b, 0xb3, + 0x3f, 0x52, 0x06, 0x12, 0xa5, 0xc3, 0x21, 0x4d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 0xa2, 0x1e, 0x12, 0x53, 0x18, + 0xa9, 0x5c, 0xa0, 0xf4, 0x5a, 0x6b, 0x8d, 0x6e, 0x3b, 0x98, 0x56, 0xea, 0xbd, 0x56, 0xe3, 0x0c, + 0xa5, 0xd7, 0x36, 0xd6, 0x42, 0x20, 0x9f, 0x41, 0x5b, 0xa0, 0x4c, 0x73, 0x11, 0xa1, 0xf4, 0xe0, + 0x94, 0x0c, 0x1b, 0xd8, 0x88, 0x60, 0x12, 0xab, 0xa1, 0x73, 0x16, 0x61, 0x22, 0xd1, 0xeb, 0x14, + 0xd0, 0xad, 0x48, 0xee, 0xc0, 0x72, 0x26, 0xd2, 0x11, 0x8b, 0x51, 0x86, 0x2c, 0x89, 0x78, 0x1e, + 0xa3, 0xf4, 0x16, 0x0c, 0x08, 0xb7, 0x34, 0x3c, 0xb6, 0x7a, 0xf2, 0x64, 0x86, 0xac, 0x16, 0xcd, + 0x7e, 0xae, 0x9f, 0x9e, 0xac, 0x66, 0x68, 0xea, 0x45, 0x75, 0x6d, 0x27, 0x2e, 0x47, 0x5e, 0x8a, + 0x0d, 0x20, 0x76, 0xbe, 0x61, 0x94, 0x26, 0x52, 0x09, 0x3d, 0x4f, 0x3b, 0xf9, 0x65, 0x6b, 0xf9, + 0xb4, 0x32, 0xf8, 0x3f, 0x39, 0xe0, 0xce, 0x1e, 0x87, 0x5e, 0xd9, 0x5c, 0xf0, 0x72, 0x65, 0x73, + 0xc1, 0x35, 0xeb, 0x99, 0x29, 0x8c, 0x70, 0x8f, 0x71, 0xac, 0xd1, 0xfa, 0xac, 0xda, 0x0c, 0x78, + 0x1f, 0xa3, 0x03, 0x99, 0x0f, 0xed, 0x4a, 0x55, 0xb2, 0xc6, 0x2b, 0xd9, 0x57, 0xc5, 0x32, 0x35, + 0x02, 0xf3, 0xac, 0x17, 0x29, 0xa2, 0xd1, 0x3e, 0x66, 0x54, 0x55, 0x8b, 0x54, 0x29, 0xfc, 0xaf, + 0xab, 0x35, 0xdf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, 0xef, 0xc2, 0xe2, 0x14, 0x0e, 0xb2, 0x04, 0x9d, 0x3d, 0x4e, 0x55, 0x58, 0xc0, 0x71, 0xcf, + 0x91, 0x15, 0x70, 0x05, 0x46, 0xb9, 0x90, 0x6c, 0x84, 0xa5, 0xd6, 0x59, 0x8f, 0x26, 0x04, 0x57, + 0x76, 0xbe, 0x04, 0x1d, 0x16, 0x63, 0xd8, 0xcf, 0x19, 0x57, 0x2c, 0x71, 0xcf, 0x91, 0x16, 0x9c, + 0xcf, 0x25, 0x0a, 0xd7, 0xd1, 0x39, 0xca, 0x05, 0xad, 0xec, 0x73, 0xe4, 0x16, 0x5c, 0x17, 0xb8, + 0x87, 0x42, 0x5f, 0xdf, 0x38, 0x3c, 0xe4, 0xd0, 0xf8, 0x64, 0xe3, 0x8b, 0x3b, 0x03, 0xa6, 0xf6, + 0xf3, 0xbe, 0x3e, 0xb4, 0x4d, 0x7b, 0x88, 0xe5, 0xdf, 0x8d, 0x88, 0xb3, 0x4d, 0x91, 0x45, 0x9b, + 0xe5, 0x81, 0xf6, 0x9b, 0xe6, 0xbf, 0x13, 0x1f, 0xfc, 0x19, 0x00, 0x00, 0xff, 0xff, 0x01, 0x14, + 0xc2, 0xc0, 0xe3, 0x10, 0x00, 0x00, } diff --git a/rpc/commands/upload.pb.go b/rpc/commands/upload.pb.go index 47d5b983876..b00dd96fa9a 100644 --- a/rpc/commands/upload.pb.go +++ b/rpc/commands/upload.pb.go @@ -28,6 +28,7 @@ type UploadReq struct { Verbose bool `protobuf:"varint,5,opt,name=verbose,proto3" json:"verbose,omitempty"` Verify bool `protobuf:"varint,6,opt,name=verify,proto3" json:"verify,omitempty"` ImportFile string `protobuf:"bytes,7,opt,name=import_file,json=importFile,proto3" json:"import_file,omitempty"` + BuildPath string `protobuf:"bytes,8,opt,name=buildPath,proto3" json:"buildPath,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -107,6 +108,13 @@ func (m *UploadReq) GetImportFile() string { return "" } +func (m *UploadReq) GetBuildPath() string { + if m != nil { + return m.BuildPath + } + return "" +} + type UploadResp struct { OutStream []byte `protobuf:"bytes,1,opt,name=out_stream,json=outStream,proto3" json:"out_stream,omitempty"` ErrStream []byte `protobuf:"bytes,2,opt,name=err_stream,json=errStream,proto3" json:"err_stream,omitempty"` @@ -162,24 +170,24 @@ func init() { func init() { proto.RegisterFile("commands/upload.proto", fileDescriptor_cd642cc079f8acdb) } var fileDescriptor_cd642cc079f8acdb = []byte{ - // 291 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x4f, 0x4b, 0xc4, 0x30, - 0x10, 0xc5, 0xe9, 0xba, 0xee, 0x9f, 0x59, 0x4f, 0x01, 0x35, 0x08, 0xe2, 0xba, 0xa7, 0x05, 0xd9, - 0x14, 0xf4, 0xec, 0xc5, 0x83, 0xa0, 0x27, 0xa9, 0x78, 0xf1, 0x52, 0xd2, 0x34, 0xb5, 0xc1, 0x36, - 0xc9, 0x26, 0xe9, 0x82, 0x5f, 0xd8, 0xcf, 0x21, 0x49, 0x1a, 0x3d, 0x79, 0xca, 0x64, 0x7e, 0xef, - 0xcd, 0x30, 0x0f, 0x4e, 0x99, 0xea, 0x7b, 0x2a, 0x6b, 0x9b, 0x0f, 0xba, 0x53, 0xb4, 0x26, 0xda, - 0x28, 0xa7, 0xd0, 0x39, 0x63, 0x84, 0x9a, 0x7a, 0x10, 0x52, 0x11, 0xd6, 0x09, 0x92, 0x54, 0x17, - 0x7f, 0x7a, 0x5f, 0x28, 0x19, 0xf5, 0x9b, 0xef, 0x0c, 0x96, 0x6f, 0x61, 0x40, 0xc1, 0xf7, 0xe8, - 0x1e, 0x16, 0x42, 0x5a, 0x47, 0x25, 0xe3, 0x38, 0x5b, 0x67, 0xdb, 0xd5, 0xed, 0x35, 0xf9, 0x67, - 0x20, 0x79, 0x1a, 0x85, 0xc5, 0xaf, 0x05, 0x21, 0x98, 0x36, 0xfb, 0x4a, 0xe2, 0xc9, 0x3a, 0xdb, - 0x2e, 0x8b, 0x50, 0xa3, 0x2b, 0x58, 0xd9, 0x4f, 0xee, 0x58, 0x5b, 0x6a, 0xea, 0x5a, 0x7c, 0x14, - 0x10, 0xc4, 0xd6, 0x0b, 0x75, 0xad, 0x37, 0x69, 0x65, 0x1c, 0x9e, 0x46, 0x93, 0xaf, 0x11, 0x86, - 0xf9, 0x81, 0x9b, 0x4a, 0x59, 0x8e, 0x8f, 0xd7, 0xd9, 0x76, 0x51, 0xa4, 0x2f, 0x3a, 0x83, 0xd9, - 0x81, 0x1b, 0xd1, 0x7c, 0xe1, 0x59, 0x00, 0xe3, 0xcf, 0xaf, 0x11, 0xbd, 0xf7, 0x96, 0x8d, 0xe8, - 0x38, 0x9e, 0xc7, 0x35, 0xb1, 0xf5, 0x28, 0x3a, 0xbe, 0x79, 0x06, 0x48, 0x77, 0x5a, 0x8d, 0x2e, - 0x01, 0xd4, 0xe0, 0x4a, 0xeb, 0x0c, 0xa7, 0x7d, 0x38, 0xf5, 0xa4, 0x58, 0xaa, 0xc1, 0xbd, 0x86, - 0x86, 0xc7, 0xdc, 0x98, 0x84, 0x27, 0x11, 0x73, 0x63, 0x22, 0x7e, 0xd8, 0xbd, 0xdf, 0x7c, 0x08, - 0xd7, 0x0e, 0x95, 0x4f, 0x23, 0x1f, 0xd3, 0x49, 0xef, 0x8e, 0x75, 0x22, 0x37, 0x9a, 0xe5, 0x29, - 0xa9, 0x6a, 0x16, 0xa2, 0xbe, 0xfb, 0x09, 0x00, 0x00, 0xff, 0xff, 0xfc, 0xf8, 0xc5, 0x33, 0xb3, - 0x01, 0x00, 0x00, + // 304 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x3f, 0x4f, 0xc3, 0x30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x0c, 0x2f, 0x7f, 0x86, 0xf7, 0x3e, 0xbb, 0xd9, 0xf2, + 0x8e, 0xe1, 0x69, 0x3c, 0x13, 0xa5, 0x27, 0xde, 0x31, 0x74, 0x09, 0x79, 0xed, 0x78, 0xd7, 0xf8, + 0x9b, 0x78, 0x16, 0xf0, 0x41, 0x58, 0xbe, 0x00, 0xa4, 0x16, 0x8c, 0x42, 0x57, 0x00, 0xd2, 0xd9, + 0x8d, 0xb1, 0x9a, 0x91, 0x3e, 0x14, 0x71, 0x52, 0xe5, 0xd2, 0xd9, 0xb7, 0x20, 0x78, 0xcc, 0xb4, + 0x4e, 0x78, 0x14, 0x31, 0xd3, 0x3a, 0xe2, 0xc7, 0xf5, 0xc7, 0xed, 0x27, 0xb7, 0xad, 0xab, 0x7d, + 0x57, 0xe5, 0xd0, 0x5d, 0xfa, 0xae, 0x69, 0xc7, 0x4b, 0xad, 0x68, 0x99, 0x7a, 0xac, 0x27, 0xe1, + 0x47, 0xdc, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x22, 0x66, 0x28, 0xd1, 0x01, 0x00, 0x00, } diff --git a/rpc/commands/upload.proto b/rpc/commands/upload.proto index ad5b747643c..f9079b23aba 100644 --- a/rpc/commands/upload.proto +++ b/rpc/commands/upload.proto @@ -29,9 +29,10 @@ message UploadReq { bool verbose = 5; bool verify = 6; string import_file = 7; + string buildPath = 8; // Path where to find saved compiled files. } message UploadResp { bytes out_stream = 1; bytes err_stream = 2; -} \ No newline at end of file +} From 3315f0c1b0d7558d723dffa4178cd1002d6af652 Mon Sep 17 00:00:00 2001 From: rsora Date: Wed, 8 Apr 2020 19:06:19 +0200 Subject: [PATCH 3/4] Refactor smart built sketch search --- commands/upload/upload.go | 114 +++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/commands/upload/upload.go b/commands/upload/upload.go index fd67595904c..dee8b7e55cb 100644 --- a/commands/upload/upload.go +++ b/commands/upload/upload.go @@ -20,8 +20,6 @@ import ( "fmt" "io" "net/url" - "os" - "path/filepath" "strings" "time" @@ -150,6 +148,18 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr uploadProperties.Set("upload.verify", uploadProperties.Get("upload.params.noverify")) } + // Extract the final file extension from the upload recipe + ext, err := getExtensionFromRecipe(uploadProperties, err) + if err != nil { + return nil, fmt.Errorf("recipe parsing unsuccessful: %s", err) + } + + // Start smart fetch process for the built sketch + var uploadPaths []*paths.Path + + // Search for built sketch to upload in CLI param importFile (if passed)... + // ...or in the Export path (the Sketch Path) + // Set path to compiled binary // Make the filename without the FQBN configs part fqbn.Configs = properties.NewMap() @@ -166,64 +176,42 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr importFile = paths.New(req.GetImportFile()).Base() } - outputTmpFile, ok := uploadProperties.GetOk("recipe.output.tmp_file") - outputTmpFile = uploadProperties.ExpandPropsInString(outputTmpFile) - if !ok { - return nil, fmt.Errorf("property 'recipe.output.tmp_file' not defined") + // Remove file extension if any from input + importFileExt := paths.New(importFile).Ext() + if strings.HasSuffix(importFile, importFileExt) { + importFile = importFile[:len(importFile)-len(importFileExt)] } - ext := filepath.Ext(outputTmpFile) - if strings.HasSuffix(importFile, ext) { - importFile = importFile[:len(importFile)-len(ext)] - } - - // Check if the file ext we calculate is the same that is needed by the upload recipe - recipet := uploadProperties.Get("upload.pattern") - cmdLinet := uploadProperties.ExpandPropsInString(recipet) - cmdArgst, err := properties.SplitQuotedString(cmdLinet, `"'`, false) - var tPath *paths.Path - if err != nil { - return nil, fmt.Errorf("invalid recipe '%s': %s", recipet, err) - } - for _, t := range cmdArgst { - if strings.Contains(t, "build.project_name") { - tPath = paths.New(t) - } - } + uploadPaths = append(uploadPaths, importPath.Join(importFile+ext)) - if ext != tPath.Ext() { - ext = tPath.Ext() + // Try fetch the file to upload using CLI param buildPath + if req.GetBuildPath() != "" { + buildPath := paths.New(req.GetBuildPath()) + // If we search inside the build.path, compile artifact do not have the fqbnSuffix in the filename + uploadPaths = append(uploadPaths, buildPath.Join(sketch.Name+".ino"+ext)) } - //uploadRecipeInputFileExt := - uploadProperties.SetPath("build.path", importPath) - uploadProperties.Set("build.project_name", importFile) - uploadFile := importPath.Join(importFile + ext) - if _, err := uploadFile.Stat(); err != nil { - if !os.IsNotExist(err) { - return nil, fmt.Errorf("cannot open sketch: %s", err) - } - // Built sketch not found in the provided path, let's fallback to the temp compile path - var fallbackBuildPath *paths.Path - if req.GetBuildPath() != "" { - fallbackBuildPath = paths.New(req.GetBuildPath()) - } else { - fallbackBuildPath = builder.GenBuildPath(sketchPath) - } + // Try fetch the file to upload using builder.GenBuildPath(sketchPath) + fallbackBuildPath := builder.GenBuildPath(sketchPath) + // If we search inside the build.path, compile artifact do not have the fqbnSuffix in the filename + uploadPaths = append(uploadPaths, fallbackBuildPath.Join(sketch.Name+".ino"+ext)) + for _, p := range uploadPaths { + if _, err := p.Stat(); err == nil { + uploadProperties.SetPath("build.path", p.Parent()) + name := p.Base() + name = name[:len(name)-len(ext)] + uploadProperties.Set("build.project_name", name) - logrus.Warnf("Built sketch not found in %s, let's fallback to %s", uploadFile, fallbackBuildPath) - uploadProperties.SetPath("build.path", fallbackBuildPath) - // If we search inside the build.path, compile artifact do not have the fqbnSuffix in the filename - uploadFile = fallbackBuildPath.Join(sketch.Name + ".ino" + ext) - if _, err := uploadFile.Stat(); err != nil { - if os.IsNotExist(err) { - return nil, fmt.Errorf("compiled sketch %s not found", uploadFile.String()) - } - return nil, fmt.Errorf("cannot open sketch: %s", err) + } else { + logrus.Warnf("Built sketch opening error in %s: %s", p, err) } - // Clean from extension - uploadProperties.Set("build.project_name", sketch.Name+".ino") + } + if n, nOK := uploadProperties.GetOk("build.project_name"); n == "" || !nOK { + return nil, fmt.Errorf("cannot find file to upload") + } + if p, pOK := uploadProperties.GetOk("build.path"); p == "" || !pOK { + return nil, fmt.Errorf("cannot find file to upload") } // Perform reset via 1200bps touch if requested @@ -305,6 +293,28 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr return &rpc.UploadResp{}, nil } +func getExtensionFromRecipe(uploadProperties *properties.Map, err error) (string, error) { + recipe := uploadProperties.Get("upload.pattern") + cmdLine := uploadProperties.ExpandPropsInString(recipe) + cmdArgs, err := properties.SplitQuotedString(cmdLine, `"'`, false) + if err != nil { + return "", err + } + + var uploadInputPath *paths.Path + for _, t := range cmdArgs { + if strings.Contains(t, "build.project_name") { + uploadInputPath = paths.New(t) + } + } + + if uploadInputPath == nil { + return "", fmt.Errorf("cannot find upload file extension in upload recipe") + } + + return uploadInputPath.Ext(), nil +} + func touchSerialPortAt1200bps(port string) error { logrus.Infof("Touching port %s at 1200bps", port) From cfcf23fd0526ef259b7df94f7c251ea9c860a867 Mon Sep 17 00:00:00 2001 From: rsora Date: Thu, 9 Apr 2020 15:05:32 +0200 Subject: [PATCH 4/4] Fixes ext bug --- commands/upload/upload.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/commands/upload/upload.go b/commands/upload/upload.go index dee8b7e55cb..0c10a9d7cc1 100644 --- a/commands/upload/upload.go +++ b/commands/upload/upload.go @@ -157,9 +157,6 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr // Start smart fetch process for the built sketch var uploadPaths []*paths.Path - // Search for built sketch to upload in CLI param importFile (if passed)... - // ...or in the Export path (the Sketch Path) - // Set path to compiled binary // Make the filename without the FQBN configs part fqbn.Configs = properties.NewMap() @@ -167,19 +164,19 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr var importPath *paths.Path var importFile string - // If no importFile is passed, use sketch path if req.GetImportFile() == "" { + // Search for built sketch to upload in CLI param importFile (if passed)... importPath = sketch.FullPath importFile = sketch.Name + "." + fqbnSuffix } else { + // ...or in the Export path (the Sketch Path) importPath = paths.New(req.GetImportFile()).Parent() importFile = paths.New(req.GetImportFile()).Base() } // Remove file extension if any from input - importFileExt := paths.New(importFile).Ext() - if strings.HasSuffix(importFile, importFileExt) { - importFile = importFile[:len(importFile)-len(importFileExt)] + if strings.HasSuffix(importFile, ext) { + importFile = importFile[:len(importFile)-len(ext)] } uploadPaths = append(uploadPaths, importPath.Join(importFile+ext)) @@ -195,13 +192,14 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr fallbackBuildPath := builder.GenBuildPath(sketchPath) // If we search inside the build.path, compile artifact do not have the fqbnSuffix in the filename uploadPaths = append(uploadPaths, fallbackBuildPath.Join(sketch.Name+".ino"+ext)) + for _, p := range uploadPaths { if _, err := p.Stat(); err == nil { uploadProperties.SetPath("build.path", p.Parent()) name := p.Base() name = name[:len(name)-len(ext)] uploadProperties.Set("build.project_name", name) - + break } else { logrus.Warnf("Built sketch opening error in %s: %s", p, err) } @@ -305,14 +303,16 @@ func getExtensionFromRecipe(uploadProperties *properties.Map, err error) (string for _, t := range cmdArgs { if strings.Contains(t, "build.project_name") { uploadInputPath = paths.New(t) + break } } if uploadInputPath == nil { return "", fmt.Errorf("cannot find upload file extension in upload recipe") } - - return uploadInputPath.Ext(), nil + // trim extension from "}" and following recipe tokens as they could be erroneously included by the Ext() func + trimmedExt := strings.Split(uploadInputPath.Ext(), "}")[0] + return trimmedExt, nil } func touchSerialPortAt1200bps(port string) error { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy