Merge commit staging+systemd into closure-size

Many non-conflict problems weren't (fully) resolved in this commit yet.
This commit is contained in:
Vladimír Čunát
2015-10-03 13:33:37 +02:00
6304 changed files with 708451 additions and 130034 deletions
@@ -10,9 +10,16 @@ coverageReportPhase() {
mkdir -p $out/coverage
genhtml app.info $lcovExtraTraceFiles -o $out/coverage > log
# Grab the overall coverage percentage for use in release overviews.
# Grab the overall coverage percentage so that Hydra can plot it over time.
mkdir -p $out/nix-support
grep "Overall coverage rate" log | sed 's/^.*(\(.*\)%).*$/\1/' > $out/nix-support/coverage-rate
lineCoverage="$(sed 's/.*lines\.*: \([0-9\.]\+\)%.*/\1/; t ; d' log)"
functionCoverage="$(sed 's/.*functions\.*: \([0-9\.]\+\)%.*/\1/; t ; d' log)"
if [ -z "$lineCoverage" -o -z "$functionCoverage" ]; then
echo "failed to get coverage statistics"
exit 1
fi
echo "lineCoverage $lineCoverage %" >> $out/nix-support/hydra-metrics
echo "functionCoverage $functionCoverage %" >> $out/nix-support/hydra-metrics
echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products
}
+10 -4
View File
@@ -2,7 +2,7 @@ makeWrapper() {
local original=$1
local wrapper=$2
local params varName value command separator n fileNames
local flagsBefore flags
local argv0 flagsBefore flags
mkdir -p "$(dirname $wrapper)"
@@ -68,12 +68,18 @@ makeWrapper() {
n=$((n + 1))
flagsBefore="$flagsBefore $flags"
fi
if test "$p" = "--argv0"; then
argv0=${params[$((n + 1))]}
n=$((n + 1))
fi
done
# Note: extraFlagsArray is an array containing additional flags
# that may be set by --run actions.
echo exec "$original" $flagsBefore '"${extraFlagsArray[@]}"' '"$@"' >> $wrapper
echo exec ${argv0:+-a $argv0} "$original" \
$flagsBefore '"${extraFlagsArray[@]}"' '"$@"' >> $wrapper
chmod +x $wrapper
}
@@ -98,5 +104,5 @@ wrapProgram() {
local prog="$1"
local hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
mv $prog $hidden
makeWrapper $hidden $prog "$@"
makeWrapper $hidden $prog --argv0 '"$0"' "$@"
}
@@ -96,10 +96,13 @@ _multioutDocs() {
_moveToOutput share/man "${!outputMan}"
_moveToOutput share/info "${!outputInfo}"
_moveToOutput share/doc "${!outputDoc}"
# outputs TODO: perhaps have outputDevDoc for developer docs
# and maybe allow _moveToOutput move to "/dev/trash" or similar
_moveToOutput share/gtk-doc "${!outputDoc}"
# Remove empty share directory.
if [ -d "$out/share" ]; then
rmdir "$out/share" 2> /dev/null || true
rmdir "$out/share" --ignore-fail-on-non-empty
fi
}
@@ -5,7 +5,7 @@
# rewritten to /nix/store/<hash>/bin/python. Interpreters that are
# already in the store are left untouched.
fixupOutputHooks+=('if [ -z "$dontPatchShebangs" ]; then patchShebangs "$prefix"; fi')
fixupOutputHooks+=('if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')
patchShebangs() {
local dir="$1"
@@ -18,7 +18,7 @@ patchShebangs() {
local oldInterpreterLine
local newInterpreterLine
find "$dir" -type f -perm +0100 | while read f; do
find "$dir" -type f -perm -0100 | while read f; do
if [ "$(head -1 "$f" | head -c +2)" != '#!' ]; then
# missing shebang => not a script
continue
@@ -0,0 +1,44 @@
export NIX_LDFLAGS+=" --build-id"
export NIX_CFLAGS_COMPILE+=" -ggdb"
dontStrip=1
fixupOutputHooks+=(_separateDebugInfo)
_separateDebugInfo() {
local dst="${debug:-$out}"
if [ "$prefix" = "$dst" ]; then return; fi
dst="$dst/lib/debug/.build-id"
# Find executables and dynamic libraries.
local -a files=($(find "$prefix" -type f -a \( -perm /0100 -o -name "*.so" -o -name "*.so.*" \)))
local i magic
for i in "${files[@]}"; do
# Skip non-ELF files.
exec 10< "$i"
read -n 4 -u 10 magic
exec 10<&-
# Extract the Build ID. FIXME: there's probably a cleaner way.
local id="$(readelf -n "$i" | sed 's/.*Build ID: \([0-9a-f]*\).*/\1/; t; d')"
if [ "${#id}" != 40 ]; then
echo "could not find build ID of $i, skipping" >&2
continue
fi
# Extract the debug info.
header "separating debug info from $i (build ID $id)"
mkdir -p "$dst/${id:0:2}"
objcopy --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug" --compress-debug-sections
strip --strip-debug "$i"
done
}
# - We might prefer to compress the debug info during link-time already,
# but our ld doesn't support --compress-debug-sections=zlib (yet).
# - Debug info may cause problems due to excessive memory usage during linking.
# Using -Wa,--compress-debug-sections should help with that;
# further interesting information: https://gcc.gnu.org/wiki/DebugFission
# - Another related tool: https://fedoraproject.org/wiki/Features/DwarfCompressor
@@ -0,0 +1,41 @@
gappsWrapperArgs=()
find_gio_modules() {
if [ -d "$1"/lib/gio/modules ] && [ -n "$(ls -A $1/lib/gio/modules)" ] ; then
gappsWrapperArgs+=(--prefix GIO_EXTRA_MODULES : "$1/lib/gio/modules")
fi
}
envHooks+=(find_gio_modules)
wrapGAppsHook() {
if [ -n "$GDK_PIXBUF_MODULE_FILE" ]; then
gappsWrapperArgs+=(--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE")
fi
if [ -n "$XDG_ICON_DIRS" ]; then
gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS")
fi
if [ -n "$GSETTINGS_SCHEMAS_PATH" ]; then
gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH")
fi
if [ -d "$prefix/share" ]; then
gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "$prefix/share")
fi
for v in $wrapPrefixVariables GST_PLUGIN_SYSTEM_PATH_1_0 GI_TYPELIB_PATH GRL_PLUGIN_PATH; do
eval local dummy="\$$v"
gappsWrapperArgs+=(--prefix $v : "$dummy")
done
if [ -z "$dontWrapGApps" ]; then
for i in $prefix/bin/* $prefix/libexec/*; do
echo "Wrapping app $i"
wrapProgram "$i" "${gappsWrapperArgs[@]}"
done
fi
}
fixupOutputHooks+=(wrapGAppsHook)