From 7bb1b86b6a67471553475b08cbf7dafb14c442fa Mon Sep 17 00:00:00 2001
From: Noel Cower <ncower@gmail.com>
Date: Wed, 5 Jun 2019 09:44:48 -0700
Subject: [PATCH] nomad: update to 0.9.2.

Nomad 0.9.2 addresses CVE-2019-12618 (hashicorp/nomad#5728).

Removes yarn build error -- no longer required as the assets are
vendored, so it's possible to build this on i686.

Removes nonvidia patch. The changes are upstream in 0.9.2.
---
 ...compiling-without-nvidia-integration.patch | 90 -------------------
 srcpkgs/nomad/template                        |  8 +-
 2 files changed, 2 insertions(+), 96 deletions(-)
 delete mode 100644 srcpkgs/nomad/patches/0001-Allow-compiling-without-nvidia-integration.patch

diff --git a/srcpkgs/nomad/patches/0001-Allow-compiling-without-nvidia-integration.patch b/srcpkgs/nomad/patches/0001-Allow-compiling-without-nvidia-integration.patch
deleted file mode 100644
index aadd907231f..00000000000
--- a/srcpkgs/nomad/patches/0001-Allow-compiling-without-nvidia-integration.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From a09e3bf1a130cdc70dd07b0d5adc5ab17d0f9131 Mon Sep 17 00:00:00 2001
-From: Mahmood Ali <mahmood@hashicorp.com>
-Date: Wed, 10 Apr 2019 09:07:08 -0400
-Subject: [PATCH] Allow compiling without nvidia integration
-
-nvidia library use of dynamic library seems to conflict with alpine and
-musl based OSes.  This adds a `nonvidia` tag to allow compiling nomad
-for alpine images.
-
-The nomad releases currently only support glibc based OS environments,
-so we default to compiling with nvidia.
----
- drivers/docker/driver.go                           |  6 ++++--
- helper/pluginutils/catalog/register_linux.go       |  2 --
- .../pluginutils/catalog/register_nvidia_linux.go   | 14 ++++++++++++++
- 3 files changed, 18 insertions(+), 4 deletions(-)
- create mode 100644 helper/pluginutils/catalog/register_nvidia_linux.go
-
-diff --git a/drivers/docker/driver.go b/drivers/docker/driver.go
-index 3403c2621..62830089b 100644
---- a/drivers/docker/driver.go
-+++ b/drivers/docker/driver.go
-@@ -18,7 +18,6 @@ import (
- 	multierror "github.com/hashicorp/go-multierror"
- 	plugin "github.com/hashicorp/go-plugin"
- 	"github.com/hashicorp/nomad/client/taskenv"
--	"github.com/hashicorp/nomad/devices/gpu/nvidia"
- 	"github.com/hashicorp/nomad/drivers/docker/docklog"
- 	"github.com/hashicorp/nomad/drivers/shared/eventer"
- 	nstructs "github.com/hashicorp/nomad/nomad/structs"
-@@ -56,6 +55,9 @@ var (
- 	// taskHandleVersion is the version of task handle which this driver sets
- 	// and understands how to decode driver state
- 	taskHandleVersion = 1
-+
-+	// Nvidia-container-runtime environment variable names
-+	nvidiaVisibleDevices = "NVIDIA_VISIBLE_DEVICES"
- )
- 
- type Driver struct {
-@@ -684,7 +686,7 @@ func (d *Driver) createContainerConfig(task *drivers.TaskConfig, driverConfig *T
- 		PidsLimit: driverConfig.PidsLimit,
- 	}
- 
--	if _, ok := task.DeviceEnv[nvidia.NvidiaVisibleDevices]; ok {
-+	if _, ok := task.DeviceEnv[nvidiaVisibleDevices]; ok {
- 		if !d.gpuRuntime {
- 			return c, fmt.Errorf("requested docker-runtime %q was not found", d.config.GPURuntimeName)
- 		}
-diff --git a/helper/pluginutils/catalog/register_linux.go b/helper/pluginutils/catalog/register_linux.go
-index bb5175d11..42314cb57 100644
---- a/helper/pluginutils/catalog/register_linux.go
-+++ b/helper/pluginutils/catalog/register_linux.go
-@@ -1,7 +1,6 @@
- package catalog
- 
- import (
--	"github.com/hashicorp/nomad/devices/gpu/nvidia"
- 	"github.com/hashicorp/nomad/drivers/rkt"
- )
- 
-@@ -10,5 +9,4 @@ import (
- // register_XXX.go file.
- func init() {
- 	RegisterDeferredConfig(rkt.PluginID, rkt.PluginConfig, rkt.PluginLoader)
--	Register(nvidia.PluginID, nvidia.PluginConfig)
- }
-diff --git a/helper/pluginutils/catalog/register_nvidia_linux.go b/helper/pluginutils/catalog/register_nvidia_linux.go
-new file mode 100644
-index 000000000..a50cbe833
---- /dev/null
-+++ b/helper/pluginutils/catalog/register_nvidia_linux.go
-@@ -0,0 +1,14 @@
-+// +build !nonvidia
-+
-+package catalog
-+
-+import (
-+	"github.com/hashicorp/nomad/devices/gpu/nvidia"
-+)
-+
-+// This file is where all builtin plugins should be registered in the catalog.
-+// Plugins with build restrictions should be placed in the appropriate
-+// register_XXX.go file.
-+func init() {
-+	Register(nvidia.PluginID, nvidia.PluginConfig)
-+}
--- 
-2.21.0
-
diff --git a/srcpkgs/nomad/template b/srcpkgs/nomad/template
index d5f7067bb2a..5b1e7a87d19 100644
--- a/srcpkgs/nomad/template
+++ b/srcpkgs/nomad/template
@@ -1,6 +1,6 @@
 # Template file for 'nomad'
 pkgname=nomad
-version=0.9.1
+version=0.9.2
 revision=1
 build_style=go
 go_import_path="github.com/hashicorp/${pkgname}"
@@ -13,13 +13,9 @@ maintainer="iaroki <iaroki@protonmail.com>"
 license="MPL-2.0"
 homepage="https://www.nomadproject.io/"
 distfiles="https://${go_import_path}/archive/v${version}.tar.gz"
-checksum=19da9f2bcc4c521b777a7889ed2c1a28182d2048e134a56099ff54e9fb6c2347
+checksum=5e3172cc51a925818c3bc892a2e99ee7da235b88ac2bdab3633a6a6289f0c692
 patch_args="-Np1"
 
-case "$XBPS_MACHINE" in
-	i686*) broken="yarn is broken on i686" ;;
-esac
-
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) go_build_tags+=" nonvidia" ;;
 esac
