Accepting request 85864 from home:-miska-

new package (libguestfs)

OBS-URL: https://build.opensuse.org/request/show/85864
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=1
This commit is contained in:
Cristian Rodríguez 2011-10-02 18:45:11 +00:00 committed by Git OBS Bridge
commit ddc77aadf5
11 changed files with 591 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
guestfs.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a6b7c12033e4aa004b5eac0cdf27e112404f1fde4ec36644f9cf5b5dcc5a83df
size 40260936

View File

@ -0,0 +1,28 @@
Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -886,22 +886,7 @@ AS_IF([test "x$enable_php" != "xno"],
])
AM_CONDITIONAL([HAVE_PHP], [test "x$PHP" != "xno" && test "x$PHPIZE" != "xno"])
-dnl Erlang
-AC_ARG_ENABLE([erlang],
- AS_HELP_STRING([--disable-erlang], [Disable Erlang language bindings]),
- [],
- [enable_erlang=yes])
-AS_IF([test "x$enable_erlang" != "xno"],
- [
- AC_ERLANG_PATH_ERLC([no])
-
- if test "x$ERLC" != "xno"; then
- AC_ERLANG_CHECK_LIB([erl_interface], [],
- [AC_MSG_FAILURE([Erlang erl_interface library not installed. Use --disable-erlang to disable.])])
- AC_ERLANG_SUBST_LIB_DIR
- fi
- ])
-AM_CONDITIONAL([HAVE_ERLANG], [test "x$ERLC" != "xno"])
+AM_CONDITIONAL([HAVE_ERLANG], [test "xno" != "xno"])
dnl Check for Perl modules needed by Perl virt tools (virt-df, etc.)
AS_IF([test "x$PERL" != "xno"],

View File

@ -0,0 +1,16 @@
Index: src/launch.c
===================================================================
--- src/launch.c.orig
+++ src/launch.c
@@ -521,10 +521,7 @@ launch_appliance (guestfs_h *g)
* since it falls back through various different acceleration
* modes, so try that first (thanks Markus Armbruster).
*/
- if (qemu_supports (g, "-machine")) {
- add_cmdline (g, "-machine");
- add_cmdline (g, "accel=kvm:tcg");
- } else {
+ if (1) {
/* qemu sometimes needs this option to enable hardware
* virtualization, but some versions of 'qemu-kvm' will use KVM
* regardless (even where this option appears in the help text).

View File

@ -0,0 +1,33 @@
Index: src/appliance.c
===================================================================
--- src/appliance.c.orig
+++ src/appliance.c
@@ -44,6 +44,7 @@
/* Old-style appliance is going to be obsoleted. */
static const char *kernel_name = "vmlinuz." host_cpu;
static const char *initrd_name = "initramfs." host_cpu ".img";
+static const char *appliance_name = "rootfs." host_cpu ".img";
static int find_path (guestfs_h *g, int (*pred) (guestfs_h *g, const char *pelem, void *data), void *data, char **pelem);
static int dir_contains_file (const char *dir, const char *file);
@@ -171,9 +172,10 @@ guestfs___build_appliance (guestfs_h *g,
size_t len = strlen (path);
*kernel = safe_malloc (g, len + strlen (kernel_name) + 2);
*initrd = safe_malloc (g, len + strlen (initrd_name) + 2);
+ *appliance = safe_malloc (g, len + strlen (appliance_name) + 2);
sprintf (*kernel, "%s/%s", path, kernel_name);
sprintf (*initrd, "%s/%s", path, initrd_name);
- *appliance = NULL;
+ sprintf (*appliance, "%s/%s", path, appliance_name);
free (path);
return 0;
@@ -187,7 +189,7 @@ guestfs___build_appliance (guestfs_h *g,
static int
contains_ordinary_appliance (guestfs_h *g, const char *path, void *data)
{
- return dir_contains_files (path, kernel_name, initrd_name, NULL);
+ return dir_contains_files (path, kernel_name, initrd_name, appliance_name, NULL);
}
static int

View File

@ -0,0 +1,15 @@
Index: ruby/Makefile.am
===================================================================
--- ruby/Makefile.am.orig
+++ ruby/Makefile.am
@@ -53,6 +53,10 @@ TESTS_ENVIRONMENT = \
all: $(generator_built)
rake build
+ sed -i 's|-Wl,-R\ -Wl,\$$(libdir)||' $(top_builddir)/ruby/ext/guestfs/Makefile
+ sed -i 's|-Wl,-R\$$(libdir)||' $(top_builddir)/ruby/ext/guestfs/Makefile
+ sed -i 's|-Wl,-R[^[:blank:]]*/src/.libs||' $(top_builddir)/ruby/ext/guestfs/Makefile
+ make -C $(top_builddir)/ruby/ext/guestfs clean all
rake rdoc
RUBY_SITELIB := $(shell ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")

View File

@ -0,0 +1,231 @@
Index: src/guestfs-internal.h
===================================================================
--- src/guestfs-internal.h.orig
+++ src/guestfs-internal.h
@@ -359,11 +359,11 @@ extern void guestfs___call_callbacks_mes
extern void guestfs___call_callbacks_array (guestfs_h *g, uint64_t event, const uint64_t *array, size_t array_len);
extern int guestfs___is_file_nocase (guestfs_h *g, const char *);
extern int guestfs___is_dir_nocase (guestfs_h *g, const char *);
-#if defined(HAVE_HIVEX)
-extern int guestfs___check_for_filesystem_on (guestfs_h *g, const char *device, int is_block, int is_partnum);
extern char *guestfs___download_to_tmp (guestfs_h *g, struct inspect_fs *fs, const char *filename, const char *basename, int64_t max_size);
extern char *guestfs___case_sensitive_path_silently (guestfs_h *g, const char *);
extern struct inspect_fs *guestfs___search_for_root (guestfs_h *g, const char *root);
+#if defined(HAVE_HIVEX)
+extern int guestfs___check_for_filesystem_on (guestfs_h *g, const char *device, int is_block, int is_partnum);
extern int guestfs___parse_unsigned_int (guestfs_h *g, const char *str);
extern int guestfs___parse_unsigned_int_ignore_trailing (guestfs_h *g, const char *str);
extern int guestfs___parse_major_minor (guestfs_h *g, struct inspect_fs *fs);
Index: src/inspect.c
===================================================================
--- src/inspect.c.orig
+++ src/inspect.c
@@ -498,98 +498,6 @@ guestfs__inspect_get_hostname (guestfs_h
return safe_strdup (g, fs->hostname ? : "unknown");
}
-/* Download a guest file to a local temporary file. The file is
- * cached in the temporary directory, and is not downloaded again.
- *
- * The name of the temporary (downloaded) file is returned. The
- * caller must free the pointer, but does *not* need to delete the
- * temporary file. It will be deleted when the handle is closed.
- *
- * Refuse to download the guest file if it is larger than max_size.
- * On this and other errors, NULL is returned.
- *
- * There is actually one cache per 'struct inspect_fs *' in order
- * to handle the case of multiple roots.
- */
-char *
-guestfs___download_to_tmp (guestfs_h *g, struct inspect_fs *fs,
- const char *filename,
- const char *basename, int64_t max_size)
-{
- char *r;
- int fd;
- char devfd[32];
- int64_t size;
-
- /* Make the basename unique by prefixing it with the fs number. */
- if (asprintf (&r, "%s/%ld-%s", g->tmpdir, fs - g->fses, basename) == -1) {
- perrorf (g, "asprintf");
- return NULL;
- }
-
- /* If the file has already been downloaded, return. */
- if (access (r, R_OK) == 0)
- return r;
-
- /* Check size of remote file. */
- size = guestfs_filesize (g, filename);
- if (size == -1)
- /* guestfs_filesize failed and has already set error in handle */
- goto error;
- if (size > max_size) {
- error (g, _("size of %s is unreasonably large (%" PRIi64 " bytes)"),
- filename, size);
- goto error;
- }
-
- fd = open (r, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0600);
- if (fd == -1) {
- perrorf (g, "open: %s", r);
- goto error;
- }
-
- snprintf (devfd, sizeof devfd, "/dev/fd/%d", fd);
-
- if (guestfs_download (g, filename, devfd) == -1) {
- unlink (r);
- close (fd);
- goto error;
- }
-
- if (close (fd) == -1) {
- perrorf (g, "close: %s", r);
- unlink (r);
- goto error;
- }
-
- return r;
-
- error:
- free (r);
- return NULL;
-}
-
-struct inspect_fs *
-guestfs___search_for_root (guestfs_h *g, const char *root)
-{
- if (g->nr_fses == 0) {
- error (g, _("no inspection data: call guestfs_inspect_os first"));
- return NULL;
- }
-
- size_t i;
- struct inspect_fs *fs;
- for (i = 0; i < g->nr_fses; ++i) {
- fs = &g->fses[i];
- if (fs->is_root && STREQ (root, fs->device))
- return fs;
- }
-
- error (g, _("%s: root device not found: only call this function with a root device previously returned by guestfs_inspect_os"),
- root);
- return NULL;
-}
-
#else /* no hivex at compile time */
/* XXX These functions should be in an optgroup. */
@@ -725,6 +633,12 @@ guestfs__inspect_is_multipart (guestfs_h
NOT_IMPL(-1);
}
+char *
+guestfs___case_sensitive_path_silently (guestfs_h *g, const char *path)
+{
+ NOT_IMPL(NULL);
+}
+
#endif /* no hivex at compile time */
void
@@ -770,3 +684,96 @@ guestfs___feature_available (guestfs_h *
return r == 0 ? 1 : 0;
}
+
+/* Download a guest file to a local temporary file. The file is
+ * cached in the temporary directory, and is not downloaded again.
+ *
+ * The name of the temporary (downloaded) file is returned. The
+ * caller must free the pointer, but does *not* need to delete the
+ * temporary file. It will be deleted when the handle is closed.
+ *
+ * Refuse to download the guest file if it is larger than max_size.
+ * On this and other errors, NULL is returned.
+ *
+ * There is actually one cache per 'struct inspect_fs *' in order
+ * to handle the case of multiple roots.
+ */
+char *
+guestfs___download_to_tmp (guestfs_h *g, struct inspect_fs *fs,
+ const char *filename,
+ const char *basename, int64_t max_size)
+{
+ char *r;
+ int fd;
+ char devfd[32];
+ int64_t size;
+
+ /* Make the basename unique by prefixing it with the fs number. */
+ if (asprintf (&r, "%s/%ld-%s", g->tmpdir, fs - g->fses, basename) == -1) {
+ perrorf (g, "asprintf");
+ return NULL;
+ }
+
+ /* If the file has already been downloaded, return. */
+ if (access (r, R_OK) == 0)
+ return r;
+
+ /* Check size of remote file. */
+ size = guestfs_filesize (g, filename);
+ if (size == -1)
+ /* guestfs_filesize failed and has already set error in handle */
+ goto error;
+ if (size > max_size) {
+ error (g, _("size of %s is unreasonably large (%" PRIi64 " bytes)"),
+ filename, size);
+ goto error;
+ }
+
+ fd = open (r, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0600);
+ if (fd == -1) {
+ perrorf (g, "open: %s", r);
+ goto error;
+ }
+
+ snprintf (devfd, sizeof devfd, "/dev/fd/%d", fd);
+
+ if (guestfs_download (g, filename, devfd) == -1) {
+ unlink (r);
+ close (fd);
+ goto error;
+ }
+
+ if (close (fd) == -1) {
+ perrorf (g, "close: %s", r);
+ unlink (r);
+ goto error;
+ }
+
+ return r;
+
+ error:
+ free (r);
+ return NULL;
+}
+
+struct inspect_fs *
+guestfs___search_for_root (guestfs_h *g, const char *root)
+{
+ if (g->nr_fses == 0) {
+ error (g, _("no inspection data: call guestfs_inspect_os first"));
+ return NULL;
+ }
+
+ size_t i;
+ struct inspect_fs *fs;
+ for (i = 0; i < g->nr_fses; ++i) {
+ fs = &g->fses[i];
+ if (fs->is_root && STREQ (root, fs->device))
+ return fs;
+ }
+
+ error (g, _("%s: root device not found: only call this function with a root device previously returned by guestfs_inspect_os"),
+ root);
+ return NULL;
+}
+

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6bf9d1627a712b583c91e0cd0ecf973024761e4428c465e3cd675af06b5fbe02
size 3891453

27
libguestfs.changes Normal file
View File

@ -0,0 +1,27 @@
-------------------------------------------------------------------
Sat Oct 1 08:30:45 CEST 2011 - mhrusecky@suse.cz
- disabling dependencies not present in Factory
* will enable them once they will be available
-------------------------------------------------------------------
Thu Sep 29 20:55:55 CEST 2011 - mhrusecky@suse.cz
- shrinking virtual image
- making virtual machine data dependent on libguestfs
-------------------------------------------------------------------
Tue Sep 27 14:00:44 CEST 2011 - mhrusecky@suse.cz
- enabling more dependencies (fuse, hivex, libconfig)
- providing ruby bindings
-------------------------------------------------------------------
Tue Sep 27 00:33:09 CEST 2011 - mhrusecky@suse.cz
- Initial package (version 1.13.14)
* no bindings yet
* no fuse
* no febootstrap
* sample virtual machine included

211
libguestfs.spec Normal file
View File

@ -0,0 +1,211 @@
# Copyright (c) 2011 Michal Hrusecky <mhrusecky@novell.com>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# norootforbuild
Name: libguestfs
BuildRequires: gcc gcc-c++ libtool automake autoconf pkg-config ruby gperf genisoimage qemu kvm pcre-devel libvirt-devel ncurses-devel readline-devel xz ruby-devel rubygem-rake hivex-devel
# libconfig-devel fuse-devel libulockmgr1
Url: http://libguestfs.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
License: GPLv2
Summary: Tools for accessing and modifying virtual machine disk images
Group: System/Filesystems
Version: 1.13.14
Release: 1
Patch1: libguestfs-1.13.14-disable-erlang.patch
Patch2: libguestfs-1.13.14-provided-appliance.patch
Patch3: libguestfs-1.13.14-no-machine.patch
Patch5: libguestfs-1.13.14-ruby.patch
Source0: %{name}-%{version}.tar.bz2
Source1: guestfs.tar.xz
Recommends: %{name}-data
%description
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%package doc
License: GPLv2
Summary: Documentation for libguestfs
Group: System/Filesystems
%description doc
Documentation for libguestfs.
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%package -n rubygem-libguestfs
License: GPLv2
Summary: Ruby bindings for libguestfs
Group: System/Filesystems
%description -n rubygem-libguestfs
Ruby bindings for libguestfs.
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%package data
License: GPLv2
Summary: Virtual machine needed for libguestfs
Version: 15
Requires: %{name}
Group: System/Filesystems
%description data
libguestfs needs for it's run virtual machine image. This package provides such
an image.
%package devel
License: GPLv2
Summary: Development files for libguestfs
Group: System/Filesystems
%description devel
Development files for libguestfs.
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%package -n libguestfs0
License: GPLv2
Summary: libguestfs library
Group: System/Filesystems
%description -n libguestfs0
Library for libguestfs.
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%prep
%setup -q
%patch1
%patch2
%patch3
%patch5
%build
autoreconf -fi
export vmchannel_test=no
%configure --disable-appliance --disable-perl --disable-python --disable-ocaml --disable-haskell --disable-php --enable-rpath=no --disable-rpath --disable-static
make %{?jobs:-j%jobs}
%install
%makeinstall
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.{l,}a
xz -cd %{S:1} | tar -C $RPM_BUILD_ROOT/%{_libdir} -xvf -
%find_lang %{name}
%clean
rm -rf $RPM_BUILD_ROOT
%post -n libguestfs0 -p /sbin/ldconfig
%postun -n libguestfs0 -p /sbin/ldconfig
%files doc
%defattr(-,root,root)
%{_datadir}/doc/libguestfs
%files data
%defattr(-,root,root)
%{_libdir}/guestfs
%files -n rubygem-libguestfs
%defattr(-,root,root)
%{_libdir}/ruby
%files -n libguestfs0
%defattr(-,root,root)
%{_libdir}/*.so.*
%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/pkgconfig
%{_includedir}/guestfs.h
%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING README
%{_bindir}/*
%config(noreplace) /etc/libguestfs-tools.conf
%config(noreplace) /etc/bash_completion.d/guestfish-bash-completion.sh
%{_mandir}/*/*
%changelog