Skip to content

Commit

Permalink
Windows doesn't like "patch"
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Fissore <[email protected]>
  • Loading branch information
Federico Fissore committed Sep 28, 2015
1 parent c90dedf commit 2af6148
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Once done, run the following commands:
go get github.com/go-errors/errors
go get github.com/stretchr/testify
go get github.com/jstemmer/go-junit-report
go get golang.org/x/codereview/patch
go build
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
--- downloaded_hardware/arduino/avr/platform.txt 2015-09-10 17:14:15.137942087 +0200
+++ downloaded_hardware/arduino/avr/platform.txt 2015-09-23 10:27:19.522085331 +0200
@@ -77,6 +77,12 @@
diff --git a/downloaded_hardware/arduino/avr/platform.txt b/downloaded_hardware/arduino/avr/platform.txt
index 537fcc5..4e526d9 100644
--- a/downloaded_hardware/arduino/avr/platform.txt
+++ b/downloaded_hardware/arduino/avr/platform.txt
@@ -81,6 +81,12 @@ recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*

Expand Down

This file was deleted.

17 changes: 11 additions & 6 deletions src/arduino.cc/builder/test/helper_tools_downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"encoding/json"
"fmt"
"github.com/go-errors/errors"
"golang.org/x/codereview/patch"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -133,20 +134,24 @@ func DownloadCoresAndToolsAndLibraries(t *testing.T) {

download(t, cores, boardsManagerCores, boardsManagerRedBearCores, tools, boardsManagerTools, boardsManagerRFduinoTools, libraries)

patch(t)
patchFiles(t)
}

// FIXME: once patched cores are released, patching them will be unnecessary
func patch(t *testing.T) {
func patchFiles(t *testing.T) {
files, err := ioutil.ReadDir(PATCHES_FOLDER)
NoError(t, err)

for _, file := range files {
if filepath.Ext(file.Name()) == ".patch" {
cmd := exec.Command("patch", "-N", "-p0", "-r", "-", "-i", filepath.Join(PATCHES_FOLDER, file.Name()))
cmd.CombinedOutput()
//output, _ := cmd.CombinedOutput()
//fmt.Println(string(output))
data, err := ioutil.ReadFile(Abs(t, filepath.Join(PATCHES_FOLDER, file.Name())))
NoError(t, err)
patchSet, err := patch.Parse(data)
NoError(t, err)
operations, err := patchSet.Apply(ioutil.ReadFile)
for _, op := range operations {
ioutil.WriteFile(op.Dst, op.Data, os.FileMode(0644))
}
}
}
}
Expand Down

0 comments on commit 2af6148

Please sign in to comment.