diff options
Diffstat (limited to 'recipes-devtools')
-rw-r--r-- | recipes-devtools/bazel/bazel-native_0.21.0.bb | 4 | ||||
-rw-r--r-- | recipes-devtools/bazel/files/0001-HttpDownloader-save-download-tarball-to-distdir.patch | 87 |
2 files changed, 90 insertions, 1 deletions
diff --git a/recipes-devtools/bazel/bazel-native_0.21.0.bb b/recipes-devtools/bazel/bazel-native_0.21.0.bb index b8d17a8..c80cc30 100644 --- a/recipes-devtools/bazel/bazel-native_0.21.0.bb +++ b/recipes-devtools/bazel/bazel-native_0.21.0.bb @@ -5,7 +5,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" SRC_URI[md5sum] = "8c8240b178a35c0f3c1bc03017550270" SRC_URI[sha256sum] = "6ccb831e683179e0cfb351cb11ea297b4db48f9eab987601c038aa0f83037db4" -SRC_URI = "https://github.com/bazelbuild/bazel/releases/download/${PV}/bazel-${PV}-dist.zip" +SRC_URI = "https://github.com/bazelbuild/bazel/releases/download/${PV}/bazel-${PV}-dist.zip \ + file://0001-HttpDownloader-save-download-tarball-to-distdir.patch \ +" inherit native diff --git a/recipes-devtools/bazel/files/0001-HttpDownloader-save-download-tarball-to-distdir.patch b/recipes-devtools/bazel/files/0001-HttpDownloader-save-download-tarball-to-distdir.patch new file mode 100644 index 0000000..605756a --- /dev/null +++ b/recipes-devtools/bazel/files/0001-HttpDownloader-save-download-tarball-to-distdir.patch @@ -0,0 +1,87 @@ +From e31a37bc9cb53de5085e885b190652f994209cf6 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia <hongxu.jia@windriver.com> +Date: Tue, 23 Apr 2019 05:21:40 -0400 +Subject: [PATCH] HttpDownloader: save download tarball to distdir + +It is helpful for collecting tarball url which supports offline build. + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> +--- + .../repository/downloader/HttpDownloader.java | 50 ++++++++++++++-------- + 1 file changed, 32 insertions(+), 18 deletions(-) + +diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpDownloader.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpDownloader.java +index 18d10d2..cf71ac4 100755 +--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpDownloader.java ++++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpDownloader.java +@@ -204,26 +204,29 @@ public class HttpDownloader { + eventHandler.handle(Event.warn("distdir " + dir + " is not a directory")); + } else { + boolean match = false; +- Path candidate = dir.getRelative(destination.getBaseName()); +- try { +- match = RepositoryCache.getChecksum(KeyType.SHA256, candidate).equals(sha256); +- } catch (IOException e) { +- // Not finding anything in a distdir is a normal case, so handle it absolutely +- // quietly. In fact, it is not uncommon to specify a whole list of dist dirs, +- // with the asumption that only one will contain an entry. +- } +- if (match) { +- if (isCachingByProvidedSha256) { +- try { +- repositoryCache.put(sha256, candidate, KeyType.SHA256); +- } catch (IOException e) { +- eventHandler.handle( +- Event.warn("Failed to copy " + candidate + " to repository cache: " + e)); ++ String[] basenames = {destination.getBaseName(), destination.getBaseName()+"_"+sha256}; ++ for (String basename: basenames) { ++ Path candidate = dir.getRelative(basename); ++ try { ++ match = RepositoryCache.getChecksum(KeyType.SHA256, candidate).equals(sha256); ++ } catch (IOException e) { ++ // Not finding anything in a distdir is a normal case, so handle it absolutely ++ // quietly. In fact, it is not uncommon to specify a whole list of dist dirs, ++ // with the asumption that only one will contain an entry. ++ } ++ if (match) { ++ if (isCachingByProvidedSha256) { ++ try { ++ repositoryCache.put(sha256, candidate, KeyType.SHA256); ++ } catch (IOException e) { ++ eventHandler.handle( ++ Event.warn("Failed to copy " + candidate + " to repository cache: " + e)); ++ } + } ++ FileSystemUtils.createDirectoryAndParents(destination.getParentDirectory()); ++ FileSystemUtils.copyFile(candidate, destination); ++ return destination; + } +- FileSystemUtils.createDirectoryAndParents(destination.getParentDirectory()); +- FileSystemUtils.copyFile(candidate, destination); +- return destination; + } + } + } +@@ -264,6 +267,17 @@ public class HttpDownloader { + eventHandler.handle(Event.info("SHA256 (" + urls.get(0) + ") = " + newSha256)); + } + ++ for (Path dir : distdir) { ++ if (!dir.exists()) ++ FileSystemUtils.createDirectoryAndParents(dir); ++ ++ if (dir.isDirectory()) { ++ Path dl_mirror = dir.getRelative(destination.getBaseName()+"_"+sha256); ++ if (!dl_mirror.exists()) ++ FileSystemUtils.copyFile(destination, dl_mirror); ++ } ++ } ++ + return destination; + } + +-- +2.8.1 + |