Archived
radiance 1.0.0
This commit is contained in:
commit
ae74a8aebf
616 files changed
+338692
No files matched your search
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
# docker/build.sh -- build the radiance image from a commit with BuildKit (docker buildx) and tag it.
|
||||
#
|
||||
# The build context is `git archive` of the commit, so the image holds exactly what is committed:
|
||||
# no build trees, no uncommitted edits, no model files. With -s the archive is streamed over ssh
|
||||
# to another machine's own `docker buildx`, which builds and keeps the image; that machine needs
|
||||
# Docker with buildx and nothing else.
|
||||
#
|
||||
# docker/build.sh HEAD, here
|
||||
# docker/build.sh -s HOST HEAD, built on and kept by HOST
|
||||
# docker/build.sh -r COMMIT another commit
|
||||
# docker/build.sh -t 'gfx1200;gfx1201' other GPU architectures (default gfx1201)
|
||||
# docker/build.sh -j 8 fewer compile jobs, for a host that is also serving
|
||||
# docker/build.sh --target build stop at a stage (tagged radiance-<stage>), e.g. for the
|
||||
# GPU test suites
|
||||
#
|
||||
# Tags: radiance:<project version>, radiance:<commit>, radiance:latest.
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
REV=HEAD
|
||||
HOST=
|
||||
TARGETS=gfx1201
|
||||
JOBS=
|
||||
STAGE=
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-s) shift; HOST="$1" ;;
|
||||
-r) shift; REV="$1" ;;
|
||||
-t) shift; TARGETS="$1" ;;
|
||||
-j) shift; JOBS="$1" ;;
|
||||
--target) shift; STAGE="$1" ;;
|
||||
*) echo "docker/build.sh: unknown option $1" >&2; exit 2 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
SHA=$(git rev-parse --short=12 "$REV^{commit}")
|
||||
VERSION=$(git show "$SHA:CMakeLists.txt" | sed -n 's/^project(radiance VERSION \([0-9.]*\).*/\1/p')
|
||||
[ -n "$VERSION" ] || { echo "docker/build.sh: no project version in CMakeLists.txt" >&2; exit 1; }
|
||||
|
||||
if [ -n "$STAGE" ]; then
|
||||
TAGS="-t radiance-$STAGE --target $STAGE"
|
||||
else
|
||||
TAGS="-t radiance:$VERSION -t radiance:$SHA -t radiance:latest"
|
||||
fi
|
||||
CMD="docker buildx build --load --build-arg GPU_TARGETS='$TARGETS' --build-arg JOBS='$JOBS'"
|
||||
CMD="$CMD --build-arg VERSION='$VERSION' --build-arg REVISION='$SHA' $TAGS -"
|
||||
|
||||
echo "radiance $VERSION ($SHA) for $TARGETS${HOST:+ on $HOST}${STAGE:+, stage $STAGE}"
|
||||
if [ -n "$HOST" ]; then
|
||||
git archive --format=tar "$SHA" | ssh "$HOST" "$CMD"
|
||||
else
|
||||
git archive --format=tar "$SHA" | sh -c "$CMD"
|
||||
fi
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/bin/sh
|
||||
# docker/licenses.sh ROOT FILE... -- the licenses of everything in the runtime image that radiance
|
||||
# did not write.
|
||||
#
|
||||
# FILE... are the paths, in the build image, of every file copied into ROOT from outside the
|
||||
# radiance install: the shared libraries, comgr, busybox, the GPU name table. Each is traced to the
|
||||
# package that installed it, or to the FFmpeg stage's /opt/ffmpeg. Every package's license files
|
||||
# are copied to ROOT/usr/share/doc/<package>/, the license texts Debian's copyright files refer to
|
||||
# go to ROOT/usr/share/common-licenses/, and ROOT/usr/share/doc/THIRD-PARTY lists each component
|
||||
# with its version, its license files and where its source is. A file that no package owns, or a
|
||||
# package that ships no license file, stops the build: the image would hold software whose license
|
||||
# is not recorded.
|
||||
set -eu
|
||||
R=$1; shift
|
||||
D=$R/usr/share/doc
|
||||
W=$(mktemp -d)
|
||||
mkdir -p "$D"
|
||||
|
||||
owner() { # owner PATH -- the package that installed PATH, under any name usrmerge gives it
|
||||
for p in "$1" "$(readlink -f "$1")"; do
|
||||
for q in "$p" "/usr$p" "${p#/usr}"; do
|
||||
o=$(dpkg-query -S "$q" 2>/dev/null | grep -v "^diversion " | head -1) || continue
|
||||
[ -n "$o" ] && { echo "${o%%:*}"; return 0; }
|
||||
done
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
licfiles() { # licfiles PACKAGE -- the license files PACKAGE installed that are present
|
||||
{ dpkg-query -L "$1" | grep -iE '/(copyright|licen[cs]e[^/]*|copying[^/]*|notice[^/]*)$' || true
|
||||
echo "/usr/share/doc/$1/copyright"; } |
|
||||
while read -r f; do [ -f "$f" ] && readlink -f "$f"; done | sort -u
|
||||
}
|
||||
|
||||
ffmpeg=
|
||||
for f in "$@"; do
|
||||
case "$f" in
|
||||
/opt/ffmpeg/*) ffmpeg=1 ;;
|
||||
*) p=$(owner "$f") || { echo "licenses.sh: no package owns $f" >&2; exit 1; }
|
||||
echo "$p $(basename "$f")" >> "$W/owned" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
rocm=$(cat /opt/rocm/.info/version 2>/dev/null || echo unknown)
|
||||
{
|
||||
cat <<EOF
|
||||
Third-party software in this image
|
||||
==================================
|
||||
|
||||
/opt/radiance is radiance, under the Apache License 2.0; its license and notices are in
|
||||
/opt/radiance/share/doc/radiance/. Everything else in the image is the software listed below, each
|
||||
under its own license. A package's license files are in /usr/share/doc/<package>/, and the license
|
||||
texts those files refer to are in /usr/share/common-licenses/.
|
||||
|
||||
The Ubuntu and ROCm packages are the distributions' binaries, copied unmodified. The source of an
|
||||
Ubuntu package is its source package at the version listed: \`apt-get source NAME=VERSION\`, or
|
||||
the Launchpad page given. The ROCm libraries are from AMD's ROCm $rocm; their source is at
|
||||
https://github.com/ROCm.
|
||||
EOF
|
||||
if [ -n "$ffmpeg" ]; then
|
||||
cat <<EOF
|
||||
|
||||
FFmpeg is built from the release tarball named below, unmodified, with the configure options in
|
||||
/usr/share/doc/ffmpeg/CONFIGURATION. Built without --enable-gpl and --enable-nonfree, it is under
|
||||
the GNU LGPL 2.1 or later. Its libraries are shared objects in /usr/lib/x86_64-linux-gnu and can
|
||||
be replaced.
|
||||
|
||||
ffmpeg
|
||||
source: $(cat /opt/ffmpeg/share/doc/ffmpeg/SOURCE)
|
||||
files: $(cd /opt/ffmpeg/lib && ls *.so.* | grep -E '\.so\.[0-9]+$' | tr '\n' ' ' | sed 's/ $//')
|
||||
license: /usr/share/doc/ffmpeg/LICENSE.md, /usr/share/doc/ffmpeg/COPYING.LGPLv2.1
|
||||
EOF
|
||||
fi
|
||||
for p in $(cut -d' ' -f1 "$W/owned" | sort -u); do
|
||||
files=$(grep "^$p " "$W/owned" | cut -d' ' -f2 | sort -u | tr '\n' ' ' | sed 's/ $//')
|
||||
lic=$(licfiles "$p")
|
||||
[ -n "$lic" ] || { echo "licenses.sh: package $p ships no license file" >&2; exit 1; }
|
||||
mkdir -p "$D/$p"
|
||||
dest=""
|
||||
for l in $lic; do
|
||||
t="$D/$p/$(basename "$l")"
|
||||
if [ -e "$t" ] && ! cmp -s "$l" "$t"; then
|
||||
t="$D/$p/$(basename "$(dirname "$l")")-$(basename "$l")"
|
||||
fi
|
||||
cp "$l" "$t"
|
||||
dest="$dest${dest:+, }${t#"$R"}"
|
||||
done
|
||||
ver=$(dpkg-query -W -f='${Version}' "$p")
|
||||
src=$(dpkg-query -W -f='${source:Package} ${source:Version}' "$p")
|
||||
echo
|
||||
echo "$p $ver"
|
||||
case "$(dpkg-query -L "$p")" in
|
||||
*/opt/rocm*) echo " source: ROCm $rocm, https://github.com/ROCm" ;;
|
||||
*) echo " source: $src (Ubuntu), https://launchpad.net/ubuntu/+source/${src% *}/${src#* }" ;;
|
||||
esac
|
||||
echo " files: $files"
|
||||
echo " license: $dest"
|
||||
done
|
||||
} > "$W/THIRD-PARTY"
|
||||
mv "$W/THIRD-PARTY" "$D/THIRD-PARTY"
|
||||
|
||||
if [ -n "$ffmpeg" ]; then
|
||||
mkdir -p "$D/ffmpeg"
|
||||
cp /opt/ffmpeg/share/doc/ffmpeg/* "$D/ffmpeg/"
|
||||
fi
|
||||
mkdir -p "$R/usr/share"
|
||||
cp -a /usr/share/common-licenses "$R/usr/share/"
|
||||
rm -rf "$W"
|
||||
Reference in new issue
Block a user