X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Ffebootstrap_pacman.ml;h=bd12f69cf070368636388cd4d1d2405351ffe028;hb=3b66c431e6b5477db8f5c186c14c16506a2df018;hp=6691ebe9a185891da6c7017a73f1b3d5de1df442;hpb=1d6f1a9cb0fb1be8467d8e2c0fbda1b7eca70c66;p=febootstrap.git diff --git a/src/febootstrap_pacman.ml b/src/febootstrap_pacman.ml index 6691ebe..bd12f69 100644 --- a/src/febootstrap_pacman.ml +++ b/src/febootstrap_pacman.ml @@ -34,7 +34,7 @@ let pacman_detect () = let pacman_resolve_dependencies_and_download names = let cmd = - sprintf "pactree -u %s | sort -u" + sprintf "(for p in %s; do pactree -u $p; done) | awk '{print $1}' | sort -u" (String.concat " " (List.map Filename.quote names)) in let pkgs = run_command_get_lines cmd in @@ -71,7 +71,10 @@ let pacman_resolve_dependencies_and_download names = List.sort compare pkgs -let pacman_list_files pkg = +let pacman_list_files ?(use_installed=false) pkg = + if use_installed then + failwith "pacman driver doesn't support --use-installed"; + debug "unpacking %s ..." pkg; (* We actually need to extract the file in order to get the @@ -80,13 +83,12 @@ let pacman_list_files pkg = let pkgdir = tmpdir // pkg ^ ".d" in mkdir pkgdir 0o755; let cmd = - sprintf "pacman -Q %s | awk '{print $2}'" - pkg in - let ver = List.hd (run_command_get_lines cmd) in - let cmd = - sprintf "umask 0000; fakeroot tar -xf %s-%s* -C %s" - (Filename.quote tmpdir // pkg ) ver (Filename.quote pkgdir) in - run_command cmd; + sprintf "ls -1 %s/%s-*.pkg.* | awk '/\\/%s-[^/-]*-[^/-]*-[^/-]*$/ { print $0 }'" + tmpdir pkg pkg in + let pkgfile = List.hd (run_command_get_lines cmd) in + let cmd = sprintf "umask 0000; fakeroot tar -xf %s -C %s" + (Filename.quote pkgfile) (Filename.quote pkgdir) in + run_command cmd; let cmd = sprintf "cd %s && find ." pkgdir in let lines = run_command_get_lines cmd in @@ -117,7 +119,10 @@ let pacman_list_files pkg = files (* Easy because we already unpacked the archive above. *) -let pacman_get_file_from_package pkg file = +let pacman_get_file_from_package ?(use_installed=false) pkg file = + if use_installed then + failwith "pacman driver doesn't support --use-installed"; + tmpdir // pkg ^ ".d" // file let () =