aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Baylis <charles.baylis@linaro.org>2017-03-29 19:21:59 +0100
committerCharles Baylis <charles.baylis@linaro.org>2017-03-30 14:38:01 +0000
commitb341b658be6a9ed6c946a8a44e7010a20247d0b5 (patch)
treeefb517d5c13de70db469efdb65aa63ee5a393200
parentbedfba8730d2e7889f616799b5229a07ad6fd9e0 (diff)
Add --list-artifacts option
Add a new option to record the location of artifacts. Example usage $ abe.sh --list-artifacts foo.txt --build all ... $ cat foo.txt manifest=.../gcc-linaro-6.3.1~linaro-gcc-6-branch@fb2367e1-20170330-linux-manifest.txt runtime=.../runtime-gcc-linaro-6.3.1~linaro-gcc-6-branch@fb2367e1-20170330-aarch64-linux-gnu.tar.xz runtime_asc=.../runtime-gcc-linaro-6.3.1~linaro-gcc-6-branch@fb2367e1-20170330-aarch64-linux-gnu.tar.xz.asc toolchain=.../gcc-linaro-6.3.1~linaro-gcc-6-branch@fb2367e1-20170330-x86_64_aarch64-linux-gnu.tar.xz toolchain_asc=.../gcc-linaro-6.3.1~linaro-gcc-6-branch@fb2367e1-20170330-x86_64_aarch64-linux-gnu.tar.xz.asc sysroot=.../sysroot-glibc-linaro-2.23~linaro-2.23-master@058b5a41-20170330-aarch64-linux-gnu.tar.xz sysroot_asc=.../sysroot-glibc-linaro-2.23~linaro-2.23-master@058b5a41-20170330-aarch64-linux-gnu.tar.xz.asc This starts implementing TCWG-860 (Clean up use of find for artifacts). Further changes will be required in jenkins-scripts and in the tcwg-* jenkins jobs. Change-Id: Ibcf36885e7e7ca4930f2dc011bccbd512f7bc592
-rwxr-xr-xabe.sh15
-rw-r--r--lib/globals.sh15
-rw-r--r--lib/package.sh27
3 files changed, 51 insertions, 6 deletions
diff --git a/abe.sh b/abe.sh
index c2dd60bf..a3b170b3 100755
--- a/abe.sh
+++ b/abe.sh
@@ -30,6 +30,7 @@ usage()
[--extraconfig <tool>=<path>] [--extraconfigdir <dir>]
[--force] [--help] [--host <host_triple>]
[--infrastructure] [--interactive]
+ [--list-artifacts <output_file>]
[--manifest <manifest_file>]
[--space <space needed>]
[--release <release_version_string>]
@@ -216,6 +217,11 @@ OPTIONS
--interactive Interactively select packages from the snapshots file.
+ --list-artifacts
+
+ Output a machine-readable list of paths to generated
+ artifacts.
+
--manifest <manifest_file>
Source the <manifest_file> to override the default
@@ -853,6 +859,11 @@ while test $# -gt 0; do
do_manifest=$2
shift
;;
+ --list-artifacts)
+ check_directive list-artifacts $2
+ list_artifacts=$2
+ shift
+ ;;
# download and install the infrastructure libraries GCC depends on
--infrastructure)
infrastructure
@@ -1098,6 +1109,10 @@ while test $# -gt 0; do
fi
done
+if [ "${list_artifacts:+set}" = "set" ]; then
+ rm -f "${list_artifacts}"
+fi
+
if [ x"$tarsrc" = x"yes" ]; then
set_build_steps tarsrc
fi
diff --git a/lib/globals.sh b/lib/globals.sh
index 68c19127..8692f510 100644
--- a/lib/globals.sh
+++ b/lib/globals.sh
@@ -116,6 +116,8 @@ jenkins_job_name=""
jenkins_job_url=""
sources_conf="${sources_conf:-${abe_path}/config/sources.conf}"
+list_artifacts=""
+
# source a user specific config file for commonly used configure options.
# These overide any of the above values.
if test -e ~/.aberc; then
@@ -256,3 +258,16 @@ get_component_list()
echo "${builds}"
}
+#
+# record_artifact() adds an artifact to the artifacts list file, if one
+# was configured on the command line
+#
+record_artifact()
+{
+ local artifact=$1
+ local path=$(readlink $2)
+ notice "Artifact ${artifact} created at ${path}."
+ if [ "${list_artifacts:+set}" = "set" -a x"${dryrun}" != xyes ]; then
+ echo "${1}=${2}" >> "${list_artifacts}"
+ fi
+}
diff --git a/lib/package.sh b/lib/package.sh
index f877ed89..fde7b798 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -114,10 +114,13 @@ binary_runtime()
# make the tarball from the tree we just created.
notice "Making binary tarball for runtime libraries, please wait..."
- dryrun "tar Jcf ${local_snapshots}/${tag}.tar.xz --directory ${local_builds}/tmp.$$ ${tag}"
+ local tarball=${local_snapshots}/${tag}.tar.xz
+ dryrun "tar Jcf ${tarball} --directory ${local_builds}/tmp.$$ ${tag}"
+ record_artifact runtime "${tarball}"
rm -f ${local_snapshots}/${tag}.tar.xz.asc
- dryrun "md5sum ${local_snapshots}/${tag}.tar.xz | sed -e 's:${local_snapshots}/::' > ${local_snapshots}/${tag}.tar.xz.asc"
+ dryrun "md5sum ${local_snapshots}/${tag}.tar.xz | sed -e 's:${local_snapshots}/::' > ${tarball}.asc"
+ record_artifact runtime_asc "${tarball}.asc"
rm -fr ${local_builds}/tmp.$$
@@ -211,12 +214,17 @@ binary_toolchain()
notice "Removing .la files."
find ${destdir} -name '*.la' -exec rm '{}' ';'
+
+
# make the tarball from the tree we just created.
notice "Making binary tarball for toolchain, please wait..."
- dryrun "tar Jcf ${local_snapshots}/${tag}.tar.xz --directory=${local_builds}/tmp.$$ ${exclude} ${tag}"
+ local tarball=${local_snapshots}/${tag}.tar.xz
+ dryrun "tar Jcf ${tarball} --directory=${local_builds}/tmp.$$ ${exclude} ${tag}"
+ record_artifact toolchain "${tarball}"
rm -f ${local_snapshots}/${tag}.tar.xz.asc
- dryrun "md5sum ${local_snapshots}/${tag}.tar.xz | sed -e 's:${local_snapshots}/::' > ${local_snapshots}/${tag}.tar.xz.asc"
+ dryrun "md5sum ${local_snapshots}/${tag}.tar.xz | sed -e 's:${local_snapshots}/::' > ${tarball}.asc"
+ record_artifact toolchain_asc "${tarball}".asc
rm -fr ${local_builds}/tmp.$$
@@ -238,11 +246,15 @@ binary_sysroot()
dryrun "ln -sfnT ${abe_top}/sysroots ${destdir}"
fi
+ local tarball=${local_snapshots}/${tag}.tar.xz
+
notice "Making binary tarball for sysroot, please wait..."
- dryrun "tar Jcfh ${local_snapshots}/${tag}.tar.xz --directory=${local_builds}/tmp.$$ ${tag}"
+ dryrun "tar Jcfh ${tarball} --directory=${local_builds}/tmp.$$ ${tag}"
+ record_artifact sysroot "${tarball}"
rm -fr ${local_snapshots}/${tag}.tar.xz.asc ${local_builds}/tmp.$$
- dryrun "md5sum ${local_snapshots}/${tag}.tar.xz > ${local_snapshots}/${tag}.tar.xz.asc"
+ dryrun "md5sum ${local_snapshots}/${tag}.tar.xz > ${tarball}.asc"
+ record_artifact sysroot_asc "${tarball}".asc
return 0
}
@@ -343,6 +355,9 @@ manifest()
if test -e ${outfile}; then
mv -f ${outfile} ${outfile}.bak
fi
+
+ record_artifact manifest "${outfile}"
+
echo "manifest_format=${manifest_version:-1.0}" > ${outfile}
echo "" >> ${outfile}
echo "# Note that for ABE, these parameters are not used" >> ${outfile}