[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] ArchLinux port



On Thu, Dec 9, 2010 at 1:30 AM, Richard W.M. Jones <rjones redhat com> wrote:
On Thu, Dec 09, 2010 at 12:08:23AM -0700, Thomas S Hatch wrote:
> I have febootstrap ported to and working on Arch, but there are a few
> packages missing from the main Arch repos, and the packages need to be in
> the main repos for the febootstrap sequence to work.
> So I have a few quick questions, first,
> how well does the supermin app work, without augeas,
> are zfs, gfs and hfs used only for mounting those filesystems inside the vm
> image,

It's possible to use libguestfs without various features compiled in.
These features can be detected at runtime by programs using the API:

http://libguestfs.org/guestfs.3.html#availability

The lack of filesystem support just means that programs will encounter
an error when they try to mount or create those filesystems.  For the
ones you mentioned it's not really important.

Augeas (lack of) is going to be a problem: currently the inspection
API will fail if Augeas is not available in the appliance.  This is
basically a bug in the inspection API:

http://git.annexia.org/?p=libguestfs.git;a=blob;f=src/inspect.c;h=8b21026830d9a6711cca6220369a040b52da23a5;hb=HEAD#l2181

but instead of fixing this I think it's better to package Augeas since
it's a tremendously useful tool for distros to include.

> and I noticed that there is an option to load a mirror for fedora to use
> when building, can that option be used to pass data into the package manager
> handler?

I believe this option should be gone with the latest building code.
Maybe I missed something?

We use the ./configure --with-febootstrap-yum-config option when
building on Fedora builders, where there is no network access.  The
way it works is convoluted, but I suggest starting here:

http://pkgs.fedoraproject.org/gitweb/?p=libguestfs.git;a=blob;f=libguestfs.spec;h=33f588678054f2e3408042db2f6f9a4512e80004;hb=HEAD#l429

> In which case I can solve everything by adding a secondary binary
> repository location to the package build.
>
> But beside these problems, the pacman package handler is working!

Excellent, look forward to the patches :-)

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top
is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top

I found a better way! Here are the patches, one for febootstrap and one for the packages list in libguestfs.

One quick question about the packages, where do I pass the option to use the ArchLinux section in the packages list?

Also, thanks for being patient with me and helping me get this put together. :)

-Tom
From 35062c01572c8c9479dc22624cb85cd84b4fc654 Mon Sep 17 00:00:00 2001
From: thatch <thatch heimdal (none)>
Date: Thu, 9 Dec 2010 22:04:24 -0700
Subject: [PATCH] Added packages for Archlinux support

---
 appliance/packagelist.in |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index e852f4d..23d1ef4 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -7,6 +7,7 @@
  *   REDHAT=1     For Fedora, RHEL, EPEL and workalikes.
  *   DEBIAN=1     For Debian.
  *   UBUNTU=1     For Ubuntu.
+ *   ARCHLINUX=1  For Archlinux.
  */
 
 /* Basically the same with a few minor tweaks. */
@@ -65,6 +66,27 @@
   zfs-fuse
 #endif /* DEBIAN */
 
+#ifdef ARCHLINUX
+  kernel26
+  vim
+  btrfs-progs-unstable
+  cryptsetup
+  diffutils
+  augeas
+  zfs-fuse
+  hfsprogs
+  e2fsprogs
+  grub
+  iputils
+  nilfs-utils
+  ntfsprogs
+  ntfs-3g
+  reiserfsprogs
+  udev
+  util-linux-ng
+  xz
+#endif /* ARCHLINUX */
+
 bash
 binutils
 coreutils
-- 
1.7.3.3

From 496371dc251c593499632686f166f270ed89d9e5 Mon Sep 17 00:00:00 2001
From: thatch <thatch heimdal (none)>
Date: Thu, 9 Dec 2010 22:00:35 -0700
Subject: [PATCH] Changed pacman module to use bacman so we can include more packages

---
 febootstrap_pacman.ml |   53 ++++++++++++++++++++----------------------------
 1 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/febootstrap_pacman.ml b/febootstrap_pacman.ml
index 5076d85..8932794 100644
--- a/febootstrap_pacman.ml
+++ b/febootstrap_pacman.ml
@@ -45,36 +45,23 @@ let pacman_resolve_dependencies_and_download names =
         not (List.exists (fun re -> Str.string_match re name 0) excludes)
     ) pkgs in
 
-  (* Download the packages. I could use wget `pacman -Sp`, but this
-   * narrows the pacman -Sy window
+  (* Recreate packages from the installed packages, filesystem kills bacman, so
+   * we check for it and use wget.
    *)
-  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 wget =
+        sprintf "wget $(pacman -Sp %s)" pkg in
+      let bacman =
+        sprintf "bacman %s" pkg in
+      let graber = 
+        if pkg = "filesystem" then wget else bacman in
+      let cmd =
+        sprintf "cd %s && %s"
+          (Filename.quote tmpdir)
+          graber in
+      run_command cmd;
+  ) pkgs;
 
   List.sort compare pkgs
 
@@ -87,8 +74,12 @@ 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
+    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"
+      (tmpdir // pkg ) ver pkgdir in
   run_command cmd;
 
   let cmd = sprintf "cd %s && find ." pkgdir in
@@ -109,7 +100,7 @@ let pacman_list_files pkg =
       (* No per-file metadata like in RPM, but we can synthesize it
        * from the path.
        *)
-      let config = statbuf.st_kind = S_REG && string_prefix "/etc/" path in
+      let config = statbuf.st_kind = S_REG && string_prefix path "/etc/" in
 
       let mode = statbuf.st_perm in
 
-- 
1.7.3.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]