Skip to content

Commit

Permalink
libguestfs: update to 1.26.7-1, improve packaging
Browse files Browse the repository at this point in the history
Changes:
 - Allow the python version to be changed (default to 3 instead of 2).
 - Disable OCaml to reduce dependencies.
 - Disable building static libraries.
 - Remove `-j3` from `make`, this option should be set in
   /etc/makepkg.conf using MAKEFLAGS.
 - To reduce bandwidth usage for RH, and to speed up the installation
   process, keep the downloaded appliance cached in /var/cache/guestfs.
 - Remove use of temporary directory for the appliance, saving 510 MiB
   in /tmp/.
 - Fix mixed tabs/spaces, trailing spaces.
 - Added check target, disabled due to spurious (?) failures.
 - Added file and fuse to depends, removing fuse from makedepends (fixes
   namcap warnings).
 - Avoid outputting download progress when output is not a tty (e.g. a
   file) to avoid spamming adding 1.8k lines to /var/log/pacman.log.
  • Loading branch information
Lekensteyn committed Aug 4, 2014
1 parent a5a4ebd commit 0e73d6f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 42 deletions.
51 changes: 33 additions & 18 deletions libguestfs/PKGBUILD
@@ -1,12 +1,13 @@
# Libguestfs: Installer: Arch
# Contributor: Peter Wu <peter@lekensteyn.nl>
# Contributor: Xiao-Long Chen <chenxiaolong@cxl.epac.to>
# Maintainer: Nikos Skalkotos <skalkoto (at) Gmail.com>
#
#
# special thanks go to Evaggelos Balaskas < ebalaskas _AT_ ebalaskas _DOT_ gr >
# for all the help

pkgname=libguestfs
pkgver=1.26.5
pkgver=1.26.7
pkgver_short=${pkgver%.*}
pkgrel=1
pkgdesc="Access and modify virtual machine disk image"
Expand All @@ -16,23 +17,25 @@ license=("GPL2" "LGPL2.1")
backup=("etc/libguestfs-tools.conf")
# backup=("etc/libguestfs-tools.conf" "etc/php.d/guestfs_php.ini")
install="appliance.install"
_pythonver=3
depends=("qemu"
# "febootstrap>=3.21"
"augeas"
"hivex>=1.3.2"
"libconfig"
"libvirt"
"fuse"
"file"
"cpio"
"wget")
"wget")
makedepends=("qemu"
"pcre"
"fuse"
"cdrkit"
"libvirt"
"libconfig"
"libxml2"
"gperf"
"python2"
"python$_pythonver"
"perl"
"perl-string-shellquote"
"perl-libintl-perl"
Expand All @@ -44,9 +47,10 @@ makedepends=("qemu"
# "gjs"
# "php"
# "gobject-introspection"
"ocaml-findlib"
"ocaml")
optdepends=("python2: Python bindings"
# "ocaml-findlib"
# "ocaml"
)
optdepends=("python$_pythonver: Python bindings"
# "ruby: Ruby Bindings"
# "gjs: Javascript Bindings for GNOME"
# "php: PHP bindings"
Expand All @@ -55,32 +59,43 @@ optdepends=("python2: Python bindings"
# "lua: Lua Bindings"
"perl: Perl Bindings"
"perl-sys-virt: Sys-Virt tools"
"ocaml: Ocaml libs")
# "ocaml: Ocaml libs"
)
provides=("guestfish=${pkgver}")
options=()
source=("http://libguestfs.org/download/${pkgver_short}-stable/${pkgname}-${pkgver}.tar.gz"
"update-libguestfs-appliance")
sha512sums=('c60d1d645dfcc53f6c18251e7575ca00edf13499aa6e2501bd84a4cde68f32d8968259698b9a4ce0a4854e8c53b62b87330db7b932c776d21c1fc2d23889eed8'
'35c127c9bbc222a45442bd4cbf0d947389a9367cd662a69692248e476846060ce2c7e57edcbc274ac546dcd160317befaf5fee76c4213e4f575cd1d55222fd62')
sha512sums=('110bd3339d0944ba8be5762c8832f1892e3bded71704b612b7fbab5b6a815c65b33e35c35c1e51ba00186500355e2a925508d4e86dd92c8da84ba1908bb0d6e5'
'1c3fcdf1585391722eab0ae6acb70029a89cf651cb4814a13780e56cc5f011f8788b6683c49ef6e518f1d0731444d43182940ecf1f20fe63a95f8b246adcd19a')

check() {
# test-lock fails, perhaps related to:
# http://lists.gnu.org/archive/html/bug-gnulib/2013-10/msg00059.html
# test-thread_create failed too.
: make check
}

build() {
cd "${srcdir}/${pkgname}-${pkgver}"

# Currently lua, erlang, php, haskel, ruby, ghc, GObject and java bindings are
# disabled. If you want to create any of the aforementioned language bindings
# uncomment the appropriate line in makedepends and remove the --disable-*
# option in ./configure
# Currently OCaml lua, erlang, php, haskel, ruby, ghc, GObject and java bindings
# are disabled. If you want to create any of the aforementioned language
# bindings uncomment the appropriate line in makedepends and remove the
# --disable-* option in ./configure

./configure \
PYTHON=python2 \
PYTHON=python$_pythonver \
--prefix=/usr \
--libdir=/usr/lib \
--mandir=/usr/share/man \
--sysconfdir=/etc \
--disable-static \
--disable-probes \
--disable-appliance \
--disable-daemon \
--without-java \
--enable-introspection=no \
--disable-ocaml \
--disable-lua \
--disable-erlang \
--disable-php \
Expand All @@ -89,13 +104,13 @@ build() {
--disable-gobject \
--disable-golang

make -j3
make
}

package() {
cd "${srcdir}/${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install

mkdir -p "$pkgdir/usr/lib/guestfs"
mkdir -p "$pkgdir/usr/lib/guestfs" "$pkgdir/var/cache/guestfs"
install -Dm755 "${srcdir}/update-libguestfs-appliance" "$pkgdir/usr/bin/update-libguestfs-appliance"
}
13 changes: 9 additions & 4 deletions libguestfs/appliance.install
@@ -1,15 +1,20 @@
post_install() {
usr/sbin/update-libguestfs-appliance
usr/sbin/update-libguestfs-appliance
}

remove_old_appliance() {
rm -f usr/lib/guestfs/{kernel,initrd,root,README.fixed}
}

pre_remove() {
rm -f usr/lib/guestfs/{kernel,initrd,root,README.fixed}
remove_old_appliance
rm -f /var/cache/guestfs/appliance-*
}

pre_upgrade() {
pre_remove
remove_old_appliance
}

post_upgrade() {
post_install
post_install
}
42 changes: 22 additions & 20 deletions libguestfs/update-libguestfs-appliance
Expand Up @@ -2,17 +2,17 @@
#
# update-guestfs-appliance: download and install a guestfs binary appliance
# Copyright (C) 2013 Nikos Skalkotos <skalkoto@gmail.com>
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Expand All @@ -21,36 +21,38 @@ VERSION=1.26.0
SHA512SUM="5d493ed6e8601dde8d5a45debfee71696b96a36d0f69d428388a6f2a2d49e12c0a66bcee210fe606fc9b2b41cb42d0d2a9f5d12425f2b234423194b2609f081f"

set -e
umask 022

if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" >&2
exit 1
echo "This script must be run as root" >&2
exit 1
fi

echo >&2
echo "Downloading binary appliance v$VERSION for libguestfs ... " >&2
echo >&2

TMP=$(mktemp -d)
trap "rm -rf $TMP" EXIT

cd $TMP
wget http://libguestfs.org/download/binaries/appliance/appliance-${VERSION}.tar.xz
# Cache file to avoid redownloading it on a second run
mkdir -p /var/cache/guestfs
cd /var/cache/guestfs
silent=
if [ ! -t 1 ]; then
echo "Output is not a TTY, not outputting progress (be patient!)" >&2
silent=-nv
fi
wget $silent --continue -O appliance-${VERSION}.tar.xz \
http://libguestfs.org/download/binaries/appliance/appliance-${VERSION}.tar.xz

echo -n "Checking checksum ... " >&2

checksum=$(mktemp --tmpdir="$TMP")
echo "$SHA512SUM appliance-${VERSION}.tar.xz" > "$checksum"

sha512sum -c "$checksum"
echo "$SHA512SUM appliance-${VERSION}.tar.xz" | sha512sum -c

echo >&2
echo "Extracting binary appliance files:" >&2
tar -xvf appliance-${VERSION}.tar.xz
echo "Extracting binary appliance files to /usr/lib/guestfs:" >&2
tar -xvf appliance-${VERSION}.tar.xz -C /usr/lib/guestfs \
--no-same-owner --strip-components=1

echo >&2
echo "Copying appliance files to /usr/lib/guestfs: " >&2
install -v -m644 -o root -g root --backup=none "$TMP/appliance/"{kernel,initrd,root,README.fixed} /usr/lib/guestfs
echo "Correcting permissions:" >&2
chmod -v 644 "/usr/lib/guestfs/"{kernel,initrd,root,README.fixed}

echo >&2
echo "Binary appliance installation finished successfully!" >&2

0 comments on commit 0e73d6f

Please sign in to comment.