summaryrefslogtreecommitdiffstats
path: root/src/Daemon
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-19 01:40:28 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-19 01:40:28 +0200
commita0ad2aada47afdc78d6b807e7c51c854d50accda (patch)
tree94a2fefdfa1e21b79ca1b4b5c359f1dd8becc105 /src/Daemon
parentd61b353da2093a6dba08e11d08f786f407f8588d (diff)
downloadabrt-a0ad2aada47afdc78d6b807e7c51c854d50accda.tar.gz
abrt-a0ad2aada47afdc78d6b807e7c51c854d50accda.tar.xz
abrt-a0ad2aada47afdc78d6b807e7c51c854d50accda.zip
wire up abrt-debuginfo-install to lib/Plugins/CCpp.cpp
Tested. Seems to work better than what we had before. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon')
-rwxr-xr-xsrc/Daemon/abrt-debuginfo-install62
1 files changed, 51 insertions, 11 deletions
diff --git a/src/Daemon/abrt-debuginfo-install b/src/Daemon/abrt-debuginfo-install
index d8d306a6..fe55250a 100755
--- a/src/Daemon/abrt-debuginfo-install
+++ b/src/Daemon/abrt-debuginfo-install
@@ -5,19 +5,28 @@ tempdir=$2
cachedir=$3
debug=false
+count_words() {
+ echo $#
+}
+
+exec 2>&1
+
+# Output goes to GUI as debigunfo install log.
+# "MISSING:xxxx" messages result in xxxx being prepended to backtrace
+
# Exitcodes:
# 0 - all debuginfos are installed
# 1 - not all debuginfos are installed
# 2+ - serious problem
test -f "$core" || exit 2
-# cahcedir is optional
+# cachedir is optional
test x"$cachedir" = x"" || test -d "$cachedir" || exit 2
# tempdir must not exist
-test -d "$tempdir" && exit 2
+test -e "$tempdir" && exit 2
+
mkdir "$tempdir" || exit 2
cd "$tempdir" || exit 2
-
$debug && echo "Installing rpms to $tempdir"
# eu-unstrip output example:
@@ -27,6 +36,7 @@ $debug && echo "Installing rpms to $tempdir"
# 0x7fff5cdff000+0x1000 0d3eb4326fd7489fcf9b598269f1edc420e2c560@0x7fff5cdff2f8 . - linux-vdso.so.1
# 0x3d15600000+0x208000 20196628d1bc062279622615cc9955554e5bb227@0x3d156001a0 /usr/lib64/libnotify.so.1.1.3 /usr/lib/debug/usr/lib64/libnotify.so.1.1.3.debug libnotify.so.1
# 0x7fd8ae931000+0x62d000 dd49f44f958b5a11a1635523b2f09cb2e45c1734@0x7fd8ae9311a0 /usr/lib64/libgtk-x11-2.0.so.0.1600.6 /usr/lib/debug/usr/lib64/libgtk-x11-2.0.so.0.1600.6.debug
+echo "Getting list of build IDs"
eu_unstrip_OUT=`eu-unstrip "--core=$core" -n 2>&1`
err=$?
printf "%s\nexitcode:%s\n" "$eu_unstrip_OUT" $err >eu_unstrip.OUT
@@ -53,9 +63,19 @@ $debug && echo "build_ids:$build_ids"
missing_debuginfo_files=`for build_id in $build_ids; do
build_id1=${build_id:0:2}
build_id2=${build_id:2}
+
file="usr/lib/debug/.build-id/$build_id1/$build_id2.debug"
+ if test x"$cachedir" != x"" && test x"$cachedir" != x"/" ; then
+ test -f "$cachedir/$file" && continue
+ if test -f "/$file"; then
+ mkdir -p "$cachedir/usr/lib/debug/.build-id/$build_id1"
+ # Note: this does not preserve symlinks. This is intentional
+ $debug && echo Copying "$file" to "$cachedir/$file" >&2
+ cp "$file" "$cachedir/$file"
+ continue
+ fi
+ fi
test -f "/$file" && continue
- test x"$cachedir" != x"" && test -f "$cachedir/$file" && continue
echo -n "/$file "
done`
$debug && echo "missing_debuginfo_files:$missing_debuginfo_files"
@@ -66,6 +86,7 @@ test x"$missing_debuginfo_files" = x"" && exit 0
# yum --enablerepo='*debuginfo*' --quiet provides \
# /usr/lib/debug/.build-id/bb/11528d59940983f495e9cb099cafb0cb206051.debug \
# /usr/lib/debug/.build-id/c5/b84c0ad3676509dc30bfa7d42191574dac5b06.debug ...
+echo "Determining list of packages for `count_words $missing_debuginfo_files` missing debuginfos"
yum_provides_OUT=`yum --enablerepo='*debuginfo*' --quiet provides $missing_debuginfo_files 2>&1`
err=$?
printf "%s\nexitcode:%s\n" "$yum_provides_OUT" $err >yum_provides.OUT
@@ -95,6 +116,7 @@ $debug && echo "packages:$packages"
test x"$packages" = x"" && exit 1
# Redirecting, since progress bar stuff only messes up our output
+echo "Downloading `count_words $packages` packages"
yumdownloader --enablerepo='*debuginfo*' --quiet $packages >yumdownloader.OUT 2>&1
err=$?
echo "exitcode:$err" >>yumdownloader.OUT
@@ -104,32 +126,50 @@ for f in *.rpm; do
# Happens if no .rpm's were downloaded (yumdownloader problem)
# In this case, $f is the literal "*.rpm" string
test -f "$f" || exit 2
- $debug && echo "Processing: $f"
+ echo "Unpacking: $f"
echo "Processing: $f" >>unpack.OUT
rpm2cpio <"$f" 2>>unpack.OUT | cpio -id >>unpack.OUT 2>&1
done
# Which debuginfo files are still missing, including those we just unpacked?
-missing_debuginfo_files2=`for build_id in $build_ids; do
+missing_build_ids=`for build_id in $build_ids; do
build_id1=${build_id:0:2}
build_id2=${build_id:2}
+
file="usr/lib/debug/.build-id/$build_id1/$build_id2.debug"
+
test -f "/$file" && continue
- test x"$cachedir" != x"" && test -f "$cachedir/$file" && continue
+ test x"$cachedir" != x"" \
+ && test x"$cachedir" != x"/" \
+ && test -f "$cachedir/$file" && continue
+
if test -f "$file"; then
# file is one of those we just installed.
# Cache it if cachedir is specified.
if test x"$cachedir" != x"" && test -d "$cachedir"; then
mkdir -p "$cachedir/usr/lib/debug/.build-id/$build_id1"
# Note: this does not preserve symlinks. This is intentional
- cp "$file" "$cachedir/$file"
+ $debug && echo Copying "$file" to "$cachedir/$file" >&2
+ cp --remove-destination "$file" "$cachedir/$file"
fi
continue
fi
- echo -n "/$file "
+ echo -n "$build_id "
done`
-$debug && echo "missing_debuginfo_files2:$missing_debuginfo_files2"
+$debug && echo "missing_build_ids:$missing_build_ids"
+
+# If cachedir is specified, tempdir is just a staging area. Delete it
+if test x"$cachedir" != x""; then
+ $debug && echo "Removing $tempdir"
+ rm -rf "$tempdir"
+fi
+
+test x"$missing_build_ids" = x"" && exit 0
+
+for missing in $missing_build_ids; do
+ echo "MISSING:$missing"
+done
-test x"$missing_debuginfo_files2" = x"" && exit 0
+echo "`count_words $missing_build_ids` debuginfos can't be found"
exit 1