path: root/utils/br-reproduce-build
diff options
authorGravatar Yann E. MORIN <yann.morin.1998@free.fr>2015-04-12 14:42:13 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2015-04-12 19:29:08 +0200
commit9b15d30b0a003b8403e0ae12540bedf21d60a681 (patch)
tree5a0c831511728228901a19c8a5f3179bf68718ed /utils/br-reproduce-build
parentc6b5c6ca7912f4b2e017c2016c421f1512332d46 (diff)
br-reproduce-build: fix URL of gitid
The canonical URL to the results on the autobuilder server wants the sha1 to be prefixed with the first three letters of the sha1, like so: b52/b52c54eafc2ea8814bb49850823e55d8e034d33d Currently, this is done by a redirect on the server, but it is broken, so that requests that do not conform to that scheme return empty results. See for example the difference between those two calls: wget -O OK 'http://autobuild.buildroot.org/results/b2c/b2cefd7d362c12ed99b708d11b988704778d450c/defconfig' wget -O KO 'http://autobuild.buildroot.org/results/b2cefd7d362c12ed99b708d11b988704778d450c/defconfig' So, currently, passing only the sah1 on the command line of br-reproduce would not work, because the sha1 is used as-is to construct the URL. To make it work, a user had to pass the sha1 prefixed with the first three chars. However, this is not very convenient. Fix that: - internally reconstruct the canonical URL; - still accept a prefix-sha1 on the command line (for users that got used to that behaviour). Reported-by: Fabio Porcedda <fabio.porcedda@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'utils/br-reproduce-build')
1 files changed, 16 insertions, 1 deletions
diff --git a/utils/br-reproduce-build b/utils/br-reproduce-build
index 0ecfb54..9fcaa10 100755
--- a/utils/br-reproduce-build
+++ b/utils/br-reproduce-build
@@ -16,10 +16,25 @@ if [ $# -ne 1 ] ; then
exit 1 ;
+# The location where the results are stored on the server is
+# of the form 'xxx/xxxyyyyyyyy', where 'xxx' are the first
+# three chars of the sha1, and 'xxxyyyyyyyy' is the full sha1.
+# We accept the user to pass either the full sha1, or the full
+# sha1 prefixed with the 'xxx' part. So we just extract the sha1
+# from the value passed by the user
+# The build directory is only made of the full sha1, without the
+# leading 'xxx/' part
+# Now, we construct the BUILD-ID as it is expected to be on the server:
+# - extract the first three chars of the sha1: use some shell trickery:
+# - prepend those three chars and a '/' to the full sha1
mkdir -p "${BUILD_DIR}"
if [ $? -ne 0 ] ; then
echo "Cannot create output directory"