AC_CHECK_PROG(APT_CACHE,[apt-cache],[apt-cache],[no])
AC_CHECK_PROG(DPKG,[dpkg],[dpkg],[no])
+dnl Include workaround for broken apt-cache depends --recurse (Ubuntu 10.04)?
+if test "x$APT_CACHE" != "xno"; then
+ AC_MSG_CHECKING([if apt-cache depends --recurse is broken])
+ if ! $APT_CACHE depends --recurse -i bash | grep -q '^libc6$'; then
+ AC_MSG_RESULT([yes])
+ APT_CACHE_DEPENDS_RECURSE_BROKEN=true
+ else
+ AC_MSG_RESULT([no])
+ APT_CACHE_DEPENDS_RECURSE_BROKEN=false
+ fi
+ AC_SUBST([APT_CACHE_DEPENDS_RECURSE_BROKEN])
+fi
+
dnl For ArchLinux handler.
AC_CHECK_PROG(PACMAN,[pacman],[pacman],[no])
file_exists "/etc/debian_version" &&
Config.aptitude <> "no" && Config.apt_cache <> "no" && Config.dpkg <> "no"
-let debian_resolve_dependencies_and_download names =
+let rec debian_resolve_dependencies_and_download names =
let cmd =
sprintf "%s depends --recurse -i %s | grep -v '^[<[:space:]]'"
Config.apt_cache
(String.concat " " (List.map Filename.quote names)) in
let pkgs = run_command_get_lines cmd in
+ let pkgs =
+ if Config.apt_cache_depends_recurse_broken then
+ workaround_broken_apt_cache_depends_recurse (sort_uniq pkgs)
+ else
+ pkgs in
(* Exclude packages matching [--exclude] regexps on the command line. *)
let pkgs =
List.sort compare pkgs
+(* On Ubuntu 10.04 LTS, apt-cache depends --recurse is broken. It
+ * doesn't return the full list of dependencies. Therefore recurse
+ * into these dependencies one by one until we reach a fixpoint.
+ *)
+and workaround_broken_apt_cache_depends_recurse names =
+ debug "workaround for broken 'apt-cache depends --recurse' command:\n %s"
+ (String.concat " " names);
+
+ let names' =
+ List.map (
+ fun name ->
+ let cmd =
+ sprintf "%s depends --recurse -i %s | grep -v '^[<[:space:]]'"
+ Config.apt_cache (Filename.quote name) in
+ run_command_get_lines cmd
+ ) names in
+ let names' = List.flatten names' in
+ let names' = sort_uniq names' in
+ if names <> names' then
+ workaround_broken_apt_cache_depends_recurse names'
+ else
+ names
+
let debian_list_files pkg =
debug "unpacking %s ..." pkg;