Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: ct/go/util/chromium_builds.go

Issue 1988073002: Add ability to only upload a single Chromium build and check for patch existence (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Initial upload Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Utility to create and manage chromium builds. 1 // Utility to create and manage chromium builds.
2 package util 2 package util
3 3
4 import ( 4 import (
5 "fmt" 5 "fmt"
6 "io/ioutil" 6 "io/ioutil"
7 "os" 7 "os"
8 "path/filepath" 8 "path/filepath"
9 "runtime" 9 "runtime"
10 10
(...skipping 23 matching lines...) Expand all
34 // CreateChromiumBuild creates a chromium build using the specified arguments. 34 // CreateChromiumBuild creates a chromium build using the specified arguments.
35 35
36 // runID is the unique id of the current run (typically requester + timestamp). 36 // runID is the unique id of the current run (typically requester + timestamp).
37 // targetPlatform is the platform the benchmark will run on (Android / Linux ). 37 // targetPlatform is the platform the benchmark will run on (Android / Linux ).
38 // chromiumHash is the hash the checkout should be synced to. If not specified t hen 38 // chromiumHash is the hash the checkout should be synced to. If not specified t hen
39 // Chromium's Tot hash is used. 39 // Chromium's Tot hash is used.
40 // skiaHash is the hash the checkout should be synced to. If not specified then 40 // skiaHash is the hash the checkout should be synced to. If not specified then
41 // Skia's LKGR hash is used (the hash in Chromium's DEPS file). 41 // Skia's LKGR hash is used (the hash in Chromium's DEPS file).
42 // applyPatches if true looks for Chromium/Skia patches in the temp dir and 42 // applyPatches if true looks for Chromium/Skia patches in the temp dir and
43 // runs once with the patch applied and once without the patch applied. 43 // runs once with the patch applied and once without the patch applied.
44 func CreateChromiumBuild(runID, targetPlatform, chromiumHash, skiaHash string, a pplyPatches bool) (string, string, error) { 44 // uploadSingleBuild if true does not upload a 2nd build of Chromium.
45 func CreateChromiumBuild(runID, targetPlatform, chromiumHash, skiaHash string, a pplyPatches, uploadSingleBuild bool) (string, string, error) {
45 // Determine which build dir and fetch target to use. 46 // Determine which build dir and fetch target to use.
46 var chromiumBuildDir, fetchTarget string 47 var chromiumBuildDir, fetchTarget string
47 if targetPlatform == "Android" { 48 if targetPlatform == "Android" {
48 chromiumBuildDir = filepath.Join(ChromiumBuildsDir, "android_bas e") 49 chromiumBuildDir = filepath.Join(ChromiumBuildsDir, "android_bas e")
49 fetchTarget = "android" 50 fetchTarget = "android"
50 } else if targetPlatform == "Linux" { 51 } else if targetPlatform == "Linux" {
51 chromiumBuildDir = filepath.Join(ChromiumBuildsDir, "linux_base" ) 52 chromiumBuildDir = filepath.Join(ChromiumBuildsDir, "linux_base" )
52 fetchTarget = "chromium" 53 fetchTarget = "chromium"
53 } else { 54 } else {
54 return "", "", fmt.Errorf("Unrecognized target_platform %s", tar getPlatform) 55 return "", "", fmt.Errorf("Unrecognized target_platform %s", tar getPlatform)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 gs, err := NewGsUtil(nil) 119 gs, err := NewGsUtil(nil)
119 if err != nil { 120 if err != nil {
120 return "", "", fmt.Errorf("Could not create GS object: %s", err) 121 return "", "", fmt.Errorf("Could not create GS object: %s", err)
121 } 122 }
122 if err := uploadChromiumBuild(filepath.Join(chromiumBuildDir, "src", "ou t", "Release"), filepath.Join(CHROMIUM_BUILDS_DIR_NAME, googleStorageDirName), t argetPlatform, gs); err != nil { 123 if err := uploadChromiumBuild(filepath.Join(chromiumBuildDir, "src", "ou t", "Release"), filepath.Join(CHROMIUM_BUILDS_DIR_NAME, googleStorageDirName), t argetPlatform, gs); err != nil {
123 return "", "", fmt.Errorf("There was an error uploaded the chrom ium build dir %s: %s", filepath.Join(chromiumBuildDir, "src", "out", "Release"), err) 124 return "", "", fmt.Errorf("There was an error uploaded the chrom ium build dir %s: %s", filepath.Join(chromiumBuildDir, "src", "out", "Release"), err)
124 } 125 }
125 126
126 // Check for the applypatch flag and reset and then build again and copy to 127 // Check for the applypatch flag and reset and then build again and copy to
127 // google storage. 128 // google storage.
128 » if applyPatches { 129 » if applyPatches && !uploadSingleBuild {
129 // Now build chromium without the patches and upload it to Googl e Storage. 130 // Now build chromium without the patches and upload it to Googl e Storage.
130 131
131 // Make sure we are starting from a clean slate. 132 // Make sure we are starting from a clean slate.
132 if err := resetChromiumCheckout(filepath.Join(chromiumBuildDir, "src")); err != nil { 133 if err := resetChromiumCheckout(filepath.Join(chromiumBuildDir, "src")); err != nil {
133 return "", "", fmt.Errorf("Could not reset the chromium checkout in %s: %s", chromiumBuildDir, err) 134 return "", "", fmt.Errorf("Could not reset the chromium checkout in %s: %s", chromiumBuildDir, err)
134 } 135 }
135 // Build chromium. 136 // Build chromium.
136 if err := buildChromium(chromiumBuildDir, targetPlatform); err ! = nil { 137 if err := buildChromium(chromiumBuildDir, targetPlatform); err ! = nil {
137 return "", "", fmt.Errorf("There was an error building c hromium %s + skia %s: %s", chromiumHash, skiaHash, err) 138 return "", "", fmt.Errorf("There was an error building c hromium %s + skia %s: %s", chromiumHash, skiaHash, err)
138 } 139 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return fmt.Errorf("Could not reset Skia's checkout in %s: %s", s kiaDir, err) 242 return fmt.Errorf("Could not reset Skia's checkout in %s: %s", s kiaDir, err)
242 } 243 }
243 // Reset Chromium. 244 // Reset Chromium.
244 if err := ResetCheckout(chromiumSrcDir); err != nil { 245 if err := ResetCheckout(chromiumSrcDir); err != nil {
245 return fmt.Errorf("Could not reset Chromium's checkout in %s: %s ", chromiumSrcDir, err) 246 return fmt.Errorf("Could not reset Chromium's checkout in %s: %s ", chromiumSrcDir, err)
246 } 247 }
247 return nil 248 return nil
248 } 249 }
249 250
250 func applyRepoPatches(chromiumSrcDir, runID string) error { 251 func applyRepoPatches(chromiumSrcDir, runID string) error {
251 » // Apply Skia patch. 252 » // Apply Skia patch if it exists.
252 skiaDir := filepath.Join(chromiumSrcDir, "third_party", "skia") 253 skiaDir := filepath.Join(chromiumSrcDir, "third_party", "skia")
253 skiaPatch := filepath.Join(os.TempDir(), runID+".skia.patch") 254 skiaPatch := filepath.Join(os.TempDir(), runID+".skia.patch")
254 » skiaPatchFile, _ := os.Open(skiaPatch) 255 » if _, err := os.Stat(skiaPatch); err == nil {
255 » skiaPatchFileInfo, _ := skiaPatchFile.Stat() 256 » » skiaPatchFile, _ := os.Open(skiaPatch)
256 » if skiaPatchFileInfo.Size() > 10 { 257 » » skiaPatchFileInfo, _ := skiaPatchFile.Stat()
257 » » if err := ApplyPatch(skiaPatch, skiaDir); err != nil { 258 » » if skiaPatchFileInfo.Size() > 10 {
258 » » » return fmt.Errorf("Could not apply Skia's patch in %s: % s", skiaDir, err) 259 » » » if err := ApplyPatch(skiaPatch, skiaDir); err != nil {
260 » » » » return fmt.Errorf("Could not apply Skia's patch in %s: %s", skiaDir, err)
261 » » » }
259 } 262 }
260 } 263 }
261 » // Apply Chromium patch. 264 » // Apply Chromium patch if it exists.
262 chromiumPatch := filepath.Join(os.TempDir(), runID+".chromium.patch") 265 chromiumPatch := filepath.Join(os.TempDir(), runID+".chromium.patch")
263 » chromiumPatchFile, _ := os.Open(chromiumPatch) 266 » if _, err := os.Stat(chromiumPatch); err == nil {
264 » chromiumPatchFileInfo, _ := chromiumPatchFile.Stat() 267 » » chromiumPatchFile, _ := os.Open(chromiumPatch)
265 » if chromiumPatchFileInfo.Size() > 10 { 268 » » chromiumPatchFileInfo, _ := chromiumPatchFile.Stat()
266 » » if err := ApplyPatch(chromiumPatch, chromiumSrcDir); err != nil { 269 » » if chromiumPatchFileInfo.Size() > 10 {
267 » » » return fmt.Errorf("Could not apply Chromium's patch in % s: %s", chromiumSrcDir, err) 270 » » » if err := ApplyPatch(chromiumPatch, chromiumSrcDir); err != nil {
271 » » » » return fmt.Errorf("Could not apply Chromium's pa tch in %s: %s", chromiumSrcDir, err)
272 » » » }
268 } 273 }
269 } 274 }
270 return nil 275 return nil
271 } 276 }
272 277
273 func InstallChromeAPK(chromiumBuildName string) error { 278 func InstallChromeAPK(chromiumBuildName string) error {
274 // Install the APK on the Android device. 279 // Install the APK on the Android device.
275 chromiumApk := filepath.Join(ChromiumBuildsDir, chromiumBuildName, ApkNa me) 280 chromiumApk := filepath.Join(ChromiumBuildsDir, chromiumBuildName, ApkNa me)
276 glog.Infof("Installing the APK at %s", chromiumApk) 281 glog.Infof("Installing the APK at %s", chromiumApk)
277 err := ExecuteCmd(BINARY_ADB, []string{"install", "-r", chromiumApk}, [] string{}, 282 err := ExecuteCmd(BINARY_ADB, []string{"install", "-r", chromiumApk}, [] string{},
278 ADB_INSTALL_TIMEOUT, nil, nil) 283 ADB_INSTALL_TIMEOUT, nil, nil)
279 if err != nil { 284 if err != nil {
280 return fmt.Errorf("Could not install the chromium APK at %s: %s" , chromiumBuildName, err) 285 return fmt.Errorf("Could not install the chromium APK at %s: %s" , chromiumBuildName, err)
281 } 286 }
282 return nil 287 return nil
283 } 288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698