about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2022-12-15 10:44:43 -0800
committerRobert Schütz <github@dotlambda.de>2022-12-20 08:02:57 -0800
commitc1c6565edcbbd3ca187e38759929eb726a767bf6 (patch)
treee1fe1fe0d15a09c92b03c781d7a124021baddd7f /pkgs/tools
parent4ebafd962893a65c9b9fa3b2d886baa4ab9b3f9f (diff)
xe-guest-utilities: 6.2.0 -> 7.30.0
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/virtualization/xe-guest-utilities/default.nix99
-rw-r--r--pkgs/tools/virtualization/xe-guest-utilities/ip-address.patch16
2 files changed, 30 insertions, 85 deletions
diff --git a/pkgs/tools/virtualization/xe-guest-utilities/default.nix b/pkgs/tools/virtualization/xe-guest-utilities/default.nix
index ce4264bdf838b..3c2b170be2d99 100644
--- a/pkgs/tools/virtualization/xe-guest-utilities/default.nix
+++ b/pkgs/tools/virtualization/xe-guest-utilities/default.nix
@@ -1,82 +1,43 @@
-{ lib, stdenv, fetchurl, bzip2, lzo, zlib, xz, bash, python2, gnutar, gnused, gnugrep, which }:
+{ lib
+, buildGoModule
+, fetchFromGitHub
+}:
 
-stdenv.mkDerivation (rec {
+buildGoModule rec {
   pname = "xe-guest-utilities";
-  version = "6.2.0";
-  meta = {
-    description = "Citrix XenServer Tools";
-    homepage = "http://citrix.com/English/ps2/products/product.asp?contentID=683148&ntref=hp_nav_US";
-    maintainers = with lib.maintainers; [ benwbooth ];
-    platforms = lib.platforms.linux;
-    license = [ lib.licenses.gpl2 lib.licenses.lgpl21 ];
-    # never built on aarch64-linux since first introduction in nixpkgs
-    broken = stdenv.isLinux && stdenv.isAarch64;
-  };
-  src = fetchurl {
-    url = "https://sources.archlinux.org/other/community/xe-guest-utilities/xe-guest-utilities_${version}-1120.tar.gz";
-    sha256 = "f9593cd9588188f80253e736f48d8dd94c5b517abb18316085f86acffab48794";
+  version = "7.30.0";
+
+  src = fetchFromGitHub {
+    owner = "xenserver";
+    repo = "xe-guest-utilities";
+    rev = "v${version}";
+    hash = "sha256-gMb8QIUg8t0SiTtUzqeh4XM5hHgCXuf5KlV3OeoU0LI=";
   };
-  buildInputs = [ bzip2 gnutar gnused python2 lzo zlib xz gnugrep which ];
-  patches = [ ./ip-address.patch ];
-  postPatch = ''
-    tar xf "$NIX_BUILD_TOP/$name/xenstore-sources.tar.bz2"
-  '';
 
-  # Workaround build failure on -fno-common toolchains:
-  #   ld: utils.o:xenstore/utils.h:27:
-  #     multiple definition of `xprintf'; xenstored_core.o:xenstore/utils.h:27: first defined here
-  NIX_CFLAGS_COMPILE = "-fcommon";
+  vendorHash = "sha256-zhpDvo8iujE426/gxJY+Pqfv99vLNKHqyMQbbXIKodY=";
 
   buildPhase = ''
-    export CC=gcc
-    export CFLAGS='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess'
-    export PYTHON=python2
-    cd "$NIX_BUILD_TOP/$name/uclibc-sources"
-    for file in Config.mk tools/libxc/Makefile tools/misc/Makefile tools/misc/lomount/Makefile tools/xenstore/Makefile; do
-      substituteInPlace "$file" --replace -Werror ""
-    done
-    make -C tools/include
-    make -C tools/libxc
-    make -C tools/xenstore
+    runHook preBuild
+
+    make RELEASE=nixpkgs
+
+    runHook postBuild
   '';
 
   installPhase = ''
-    export CFLAGS+='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess'
-    if [[ $CARCH == x86_64 ]]; then
-      export LIBLEAFDIR_x86_64=lib
-    fi
-    for f in include libxc xenstore; do
-      [[ ! -d $NIX_BUILD_TOP/$name/uclibc-sources/tools/$f ]] && continue
-      make -C "$NIX_BUILD_TOP/$name/uclibc-sources/tools/$f" DESTDIR="$out" BINDIR=/bin SBINDIR=/bin INCLUDEDIR=/include LIBDIR=/lib install
-    done
-    rm -r "$out"/var
+    runHook preInstall
 
-    cd "$NIX_BUILD_TOP/$name"
-    install -Dm755 xe-update-guest-attrs "$out/bin/xe-update-guest-attrs"
-    install -Dm755 xe-daemon "$out/bin/xe-daemon"
-    install -Dm644 xen-vcpu-hotplug.rules "$out/lib/udev/rules.d/10-xen-vcpu-hotplug.rules"
-    substituteInPlace "$out/bin/xe-daemon" --replace sbin bin
-    substituteInPlace "$out/bin/xe-daemon" --replace /usr/ "$out/"
-    substituteInPlace "$out/bin/xe-update-guest-attrs" --replace /usr/ "$out/"
-    substituteInPlace "$out/bin/xe-update-guest-attrs" --replace 'export PATH=' 'export PATH=$PATH:'
-    substituteInPlace "$out/lib/udev/rules.d/10-xen-vcpu-hotplug.rules" --replace /bin/sh '${bash}/bin/sh'
+    install -Dt "$out"/bin build/stage/usr/{,s}bin/*
+    install -Dt "$out"/etc/udev/rules.d build/stage/etc/udev/rules.d/*
 
-    cat <<'EOS' >"$out/bin/xe-linux-distribution"
-    #!${bash}/bin/bash -eu
-    . /etc/os-release
-    if [[ $# -gt 0 ]]; then
-      mkdir -p "$(dirname "$1")"
-      exec 1>"$1"
-    fi
-    cat <<EOF
-    os_distro="$ID"
-    os_majorver="''${VERSION_ID%%.*}"
-    os_minorver="''${VERSION_ID#*.}"
-    os_uname="$(uname -r)"
-    os_name="$PRETTY_NAME"
-    EOF
-    EOS
-    chmod 0755 "$out/bin/xe-linux-distribution"
+    runHook postInstall
   '';
 
-})
+  meta = {
+    description = "XenServer guest utilities";
+    homepage = "https://github.com/xenserver/xe-guest-utilities";
+    license = lib.licenses.bsd2;
+    maintainers = with lib.maintainers; [ ];
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/pkgs/tools/virtualization/xe-guest-utilities/ip-address.patch b/pkgs/tools/virtualization/xe-guest-utilities/ip-address.patch
deleted file mode 100644
index 185f259ef7086..0000000000000
--- a/pkgs/tools/virtualization/xe-guest-utilities/ip-address.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff -uNr a/xe-update-guest-attrs b/xe-update-guest-attrs
---- a/xe-update-guest-attrs	2012-09-25 12:45:14.000000000 +0200
-+++ b/xe-update-guest-attrs	2012-11-21 16:46:35.000000000 +0100
-@@ -177,9 +177,9 @@
- #           collisions:0 txqueuelen:0 
- #           RX bytes:3604609 (3.4 MiB)  TX bytes:3604609 (3.4 MiB)
- 
--ifs=`/sbin/ifconfig | sed -n -e 's/^\([a-z0-9]\+\).*/name \1/p' \
--    -e 's/.*inet addr:\('$IPADDR_RE'\) .*/ipv4 \1/p' \
--    -e 's+.*inet6 addr: \('$IPADDR6_RE'\)/.*+ipv6 \1+p' | \
-+ifs=`ip addr show | sed -n -e 's/^[[:digit:]]*: \([a-z0-9]*\): .*/name \1 /gp;' \
-+    -e 's/^[[:space:]]\{4\}inet \('${IPADDR_RE}'\)\/.*/ipv4 \1 /gp;' \
-+    -e 's/^[[:space:]]\{4\}inet6 \('${IPADDR6_RE}'\)\/.*/ipv6 \1 /gp;' | \
- while read tag value; do
-     case "${tag}" in
-         name)
\ No newline at end of file