From 2e08c6fd45e560d53bbf0c9f004161ea877c7bf8 Mon Sep 17 00:00:00 2001 From: Henrik Riomar Date: Wed, 10 Jan 2018 10:45:43 +0100 Subject: community/virt-what: move from testing --- .../0001-Missing-have_cpuinfo-check.patch | 25 +++++++++++ community/virt-what/0002-Remove-bashisms.patch | 48 ++++++++++++++++++++ ...uest-can-access-cpuid-from-Intel-CPUs-sta.patch | 35 +++++++++++++++ community/virt-what/APKBUILD | 52 ++++++++++++++++++++++ 4 files changed, 160 insertions(+) create mode 100644 community/virt-what/0001-Missing-have_cpuinfo-check.patch create mode 100644 community/virt-what/0002-Remove-bashisms.patch create mode 100644 community/virt-what/0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch create mode 100644 community/virt-what/APKBUILD (limited to 'community/virt-what') diff --git a/community/virt-what/0001-Missing-have_cpuinfo-check.patch b/community/virt-what/0001-Missing-have_cpuinfo-check.patch new file mode 100644 index 00000000000..9f56566effc --- /dev/null +++ b/community/virt-what/0001-Missing-have_cpuinfo-check.patch @@ -0,0 +1,25 @@ +From eefc1e7e3dd8fb422baf0f13aec1df9880541b83 Mon Sep 17 00:00:00 2001 +From: Jasper Lievisse Adriaanse +Date: Thu, 10 Aug 2017 08:44:01 +0100 +Subject: [PATCH] Missing have_cpuinfo check. + +--- + virt-what.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/virt-what.in b/virt-what.in +index 8c27b11..9050035 100644 +--- a/virt-what.in ++++ b/virt-what.in +@@ -308,7 +308,7 @@ if ! "$skip_qemu_kvm"; then + # option, since /proc/cpuinfo will not contain the QEMU + # string. QEMU 2.10 added a new CPUID leaf, so this + # problem only triggered for older QEMU +- if grep -q 'QEMU' "${root}/proc/cpuinfo"; then ++ if have_cpuinfo && grep -q 'QEMU' "${root}/proc/cpuinfo"; then + echo qemu + fi + fi +-- +2.15.0 + diff --git a/community/virt-what/0002-Remove-bashisms.patch b/community/virt-what/0002-Remove-bashisms.patch new file mode 100644 index 00000000000..02fe382e2aa --- /dev/null +++ b/community/virt-what/0002-Remove-bashisms.patch @@ -0,0 +1,48 @@ +From 9d90704a05dee7704470eff818a1c44aeef6c880 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Guido=20G=C3=BCnther?= +Date: Fri, 4 Aug 2017 12:02:08 -0300 +Subject: [PATCH] Remove bashisms + +Use [ instead of [[ so we fall back to test if necessary: + + http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html + +Gbp-Pq: Name Remove-bashisms.patch +--- + virt-what.in | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/virt-what.in b/virt-what.in +index 9050035..a05e0db 100644 +--- a/virt-what.in ++++ b/virt-what.in +@@ -360,20 +360,20 @@ if [ "$cpuid" = "OpenBSDVMM58" ]; then + fi + + # Check for LDoms +-if [[ "$arch" == sparc* && -e ${root}/dev/mdesc ]]; then ++if [ "${arch#sparc}" != "$arch" ] && [ -e "${root}/dev/mdesc" ]; then + echo ldoms +- if [[ -d ${root}/sys/class/vlds/ctrl && \ +- -d ${root}/sys/class/vlds/sp ]]; then ++ if [ -d "${root}/sys/class/vlds/ctrl" ] && \ ++ [ -d "${root}/sys/class/vlds/sp" ]; then + echo ldoms-control + else + echo ldoms-guest + fi + MDPROP="${root}/usr/lib/ldoms/mdprop.py" +- if [[ -x ${MDPROP} ]]; then +- if [[ -n $($MDPROP -v iodevice device-type=pciex) ]]; then ++ if [ -x "${MDPROP}" ]; then ++ if [ -n "$($MDPROP -v iodevice device-type=pciex)" ]; then + echo ldoms-root + echo ldoms-io +- elif [[ -n $($MDPROP -v iov-device vf-id=0) ]]; then ++ elif [ -n "$($MDPROP -v iov-device vf-id=0)" ]; then + echo ldoms-io + fi + fi +-- +2.15.0 + diff --git a/community/virt-what/0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch b/community/virt-what/0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch new file mode 100644 index 00000000000..f2f634c076f --- /dev/null +++ b/community/virt-what/0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch @@ -0,0 +1,35 @@ +From a821dc9961d457c086fffcc16a911cb6f9f8659a Mon Sep 17 00:00:00 2001 +From: xiliang +Date: Sun, 18 Jun 2017 00:33:28 +0800 +Subject: [PATCH] As xen pv guest can access cpuid from Intel CPUs started + IvyBridge onwards have CPUID Faulting, added one more check in virt-what. + +--- + virt-what.in | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/virt-what.in b/virt-what.in +index a05e0db..247348e 100644 +--- a/virt-what.in ++++ b/virt-what.in +@@ -1,6 +1,6 @@ + #!/bin/sh - + # @configure_input@ +-# Copyright (C) 2008-2015 Red Hat Inc. ++# Copyright (C) 2008-2017 Red Hat Inc. + # + # 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 +@@ -223,7 +223,8 @@ fi + + # Check for Xen. + +-if [ "$cpuid" = "XenVMMXenVMM" ]; then ++if [ "$cpuid" = "XenVMMXenVMM" ] && ++ ! echo "$dmi" | grep -q 'No SMBIOS nor DMI entry point found, sorry'; then + echo xen; echo xen-hvm + # Check for AWS + if echo "$dmi" | grep -q 'Version: [0-9]\.[0-9]\.amazon'; then +-- +2.15.0 + diff --git a/community/virt-what/APKBUILD b/community/virt-what/APKBUILD new file mode 100644 index 00000000000..77e53f30f4a --- /dev/null +++ b/community/virt-what/APKBUILD @@ -0,0 +1,52 @@ +# Contributor: Henrik Riomar +# Maintainer: Henrik Riomar +pkgname=virt-what +pkgver=1.18 +pkgrel=2 +pkgdesc="Detect if we are running in a virtual machine" +url="https://people.redhat.com/~rjones/virt-what/" +arch="x86 x86_64 ppc64le" +license="GPL-2.0-or-later" +checkdepends="checkbashisms" +makedepends="automake autoconf perl-dev" +subpackages="$pkgname-doc" +source="http://people.redhat.com/~rjones/$pkgname/files/$pkgname-$pkgver.tar.gz + 0001-Missing-have_cpuinfo-check.patch + 0002-Remove-bashisms.patch + 0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch + " +builddir="$srcdir/$pkgname-$pkgver" + +prepare() { + default_prepare + + cd "$builddir" + autoreconf -ivf +} + +build() { + cd "$builddir" + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --mandir=/usr/share/man + make +} + +check() { + cd "$builddir" + make check + + checkbashisms ./virt-what +} + +package() { + cd "$builddir" + make install DESTDIR="$pkgdir" +} + +sha512sums="8085a38111d5664f411f5bb9d2ee221bc22e5b0f2d993e8d518718b3f63b16ba73e052b1623c090493cf8fef52fd237ba823377503a32b4b7d03cc5380d5c613 virt-what-1.18.tar.gz +e910d197b172f7d9bf730238e0ea4cabd9db732051040233e2d25b44e07ed160c875ff9dd76048f0534ee269a77be14d01b2e8e66a51c8e9325109d25fb03d9b 0001-Missing-have_cpuinfo-check.patch +b57686e6f7af4d1c388b26d0a3e3a4964b5f74133aba47f4ed1f6771c8f22337f92f4519f01dd240a82e00e6fdbf0adaa7dd6040c4b9ec4924ce973b1fca9b33 0002-Remove-bashisms.patch +979c91b4f65ec95d85f2ad873e4148cd46e399534109ebeee03f8815c05327b590cf72a68a46f5ad655513591fb0c4a75cd08908446583d44213b87a75741c50 0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch" -- cgit v1.2.3