diff options
author | Thomas S Hatch <thatch45@gmail.com> | 2010-12-12 10:23:58 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2010-12-12 10:23:58 +0000 |
commit | 5989c6746ae10b1da2a15dbefc3cf360a02e7a08 (patch) | |
tree | ee1b67d86c0a37f43e98385d05746b9d8ca41e0d | |
parent | 5e76af32db0f702124ae1c4933ee62697ccaf3d3 (diff) | |
download | febootstrap-5989c6746ae10b1da2a15dbefc3cf360a02e7a08.tar.gz febootstrap-5989c6746ae10b1da2a15dbefc3cf360a02e7a08.tar.xz febootstrap-5989c6746ae10b1da2a15dbefc3cf360a02e7a08.zip |
pacman: Update ArchLinux module.
If package is not in the main repos, check AUR.
Download and unpack the package.
-rw-r--r-- | febootstrap_pacman.ml | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/febootstrap_pacman.ml b/febootstrap_pacman.ml index 5076d85..760d0ef 100644 --- a/febootstrap_pacman.ml +++ b/febootstrap_pacman.ml @@ -48,33 +48,26 @@ let pacman_resolve_dependencies_and_download names = (* Download the packages. I could use wget `pacman -Sp`, but this * narrows the pacman -Sy window *) - let cmd = - sprintf "cd %s && mkdir -p var/lib/pacman && fakeroot pacman -Syw --noconfirm --cachedir=$(pwd) --root=$(pwd) %s" - (Filename.quote tmpdir) - (String.concat " " (List.map Filename.quote pkgs)) in - run_command cmd; - - (* Find out what pacman downloaded. *) - (*let files = Sys.readdir tmpdir in - - let pkgs = List.map ( + List.iter ( fun pkg -> - (* Look for 'pkg*.pkg.tar.xz' in the list of files. *) - let pre = pkg in - let r = ref "" in - try - for i = 0 to Array.length files - 1 do - if string_prefix pre files.(i) then ( - r := files.(i); - files.(i) <- ""; - raise Exit - ) - done; - eprintf "febootstrap: pacman: error: no file was downloaded corresponding to package %s\n" pkg; - exit 1 - with - Exit -> !r - ) pkgs in *) + let cmd = + sprintf "cd %s && mkdir -p var/lib/pacman && fakeroot pacman -Syw --noconfirm --cachedir=$(pwd) --root=$(pwd) %s" + (Filename.quote tmpdir) + pkg in + if Sys.command cmd <> 0 then ( + (* The package is not in the main repos, check the aur *) + let cmd = + sprintf "cd %s && wget http://aur.archlinux.org/packages/%s/%s.tar.gz && tar xf %s.tar.gz && cd %s && makepkg && mv %s-*.pkg.tar.xz %s" + (Filename.quote tmpdir) + pkg + pkg + pkg + pkg + pkg + (Filename.quote tmpdir) in + run_command cmd; + ) + ) pkgs; List.sort compare pkgs @@ -87,9 +80,13 @@ let pacman_list_files pkg = let pkgdir = tmpdir // pkg ^ ".d" in mkdir pkgdir 0o755; let cmd = - sprintf "tar -xf %s-* -C %s" - (tmpdir // pkg ) pkgdir in - run_command cmd; + sprintf "pacman -Q %s | awk '{print $2}'" + pkg in + let ver = List.hd (run_command_get_lines cmd) in + let cmd = + sprintf "fakeroot tar -xf %s-%s* -C %s" + (Filename.quote tmpdir // pkg ) ver (Filename.quote pkgdir) in + run_command cmd; let cmd = sprintf "cd %s && find ." pkgdir in let lines = run_command_get_lines cmd in |