4fc9310
commit 4432b7407e6afbbb5e91ad24455556d0e679a4f9
4fc9310
Author: Denys Vlasenko <vda.linux@googlemail.com>
4fc9310
Date:   Thu Mar 4 20:37:10 2010 +0100
4fc9310
4fc9310
    abrt-debuginfo-install: use -debuginfo repos which match enabled "usual" repos
4fc9310
    
4fc9310
    Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4fc9310
4fc9310
diff --git a/src/Daemon/abrt-debuginfo-install b/src/Daemon/abrt-debuginfo-install
4fc9310
index 1b6af74..0d9401b 100755
4fc9310
--- a/src/Daemon/abrt-debuginfo-install
4fc9310
+++ b/src/Daemon/abrt-debuginfo-install
4fc9310
@@ -145,14 +145,12 @@ print_package_names() {
4fc9310
     else
4fc9310
 	echo "`count_words $missing_debuginfo_files` missing debuginfos, getting package list from repositories" >&2
4fc9310
     fi
4fc9310
-    # when we look for debuginfo we need only -debuginfo* repos, so we can disable the rest and thus make it faster
4fc9310
-    # also we want only fedora repositories, because abrt won't work for other packages anyway
4fc9310
     # --showduplicates: do not just show the latest package
4fc9310
     # (tried to use -R2 to abort on stuck yum lock but -R is not about that)
4fc9310
-    local cmd="yum $yumopts '--disablerepo=*' '--enablerepo=fedora-debuginfo*' '--enablerepo=updates-debuginfo*' --showduplicates --quiet provides $missing_debuginfo_files"
4fc9310
+    local cmd="yum $yumopts $yum_repo_opts --showduplicates --quiet provides $missing_debuginfo_files"
4fc9310
     echo "$cmd" >"yum_provides.$1.OUT"
4fc9310
     $debug && echo "Running: $cmd" >&2
4fc9310
-    # eval is needed to strip away ''s; cant remove them above and just use
4fc9310
+    # eval is needed to strip away ''s in $yum_repo_opts; cant remove them and just use
4fc9310
     # unquoted $cmd, that would perform globbing on '*'
4fc9310
     local yum_provides_OUT="`eval $cmd 2>&1`"
4fc9310
     local err=$?
4fc9310
@@ -199,9 +197,10 @@ download_packages() {
4fc9310
     for pkg in $packages; do
4fc9310
 	echo "Download $i/$num_packages: $pkg"
4fc9310
 	echo "Download $i/$num_packages: $pkg" >>yumdownloader.OUT
4fc9310
-	# We can't handle packages from non Fedora repos, so we look and download only
4fc9310
-	# from Fedora repos which makes it faster
4fc9310
-	yumdownloader --disablerepo="*" --enablerepo="fedora-debuginfo*" --enablerepo="updates-debuginfo*" --quiet $pkg >>yumdownloader.OUT 2>&1
4fc9310
+	cmd="yumdownloader $yum_repo_opts --quiet $pkg"
4fc9310
+	$debug && echo "Running: $cmd" >&2
4fc9310
+	# eval is needed to strip away ''s in $yum_repo_opts
4fc9310
+	eval $cmd >>yumdownloader.OUT 2>&1
4fc9310
 	err=$?
4fc9310
 	echo "exitcode:$err" >>yumdownloader.OUT
4fc9310
 	echo >>yumdownloader.OUT
4fc9310
@@ -299,6 +298,16 @@ build_ids=`printf "%s\n" "$eu_unstrip_OUT" \
4fc9310
 done | sort | uniq | xargs`
4fc9310
 $debug && echo "build_ids:$build_ids"
4fc9310
 
4fc9310
+
4fc9310
+# Prepare list of repos to use.
4fc9310
+# When we look for debuginfo we need only -debuginfo* repos, we can disable the rest
4fc9310
+# and thus make it faster.
4fc9310
+yum_repo_opts="'--disablerepo=*'"
4fc9310
+for enabled_repo in `yum repolist | grep 'enabled:' | cut -f1 -d' ' | grep -v -- '-debuginfo'`; do
4fc9310
+    yum_repo_opts="$yum_repo_opts '--enablerepo=${enabled_repo}-debuginfo*'"
4fc9310
+done
4fc9310
+
4fc9310
+
4fc9310
 # We try to not run yum without -C unless absolutely necessary.
4fc9310
 # Therefore we loop. yum is run by print_package_names function,
4fc9310
 # on first iteration it is run with -C, on second - without,