Skip to content

Instantly share code, notes, and snippets.

@cgwalters
Last active Apr 1, 2016
Embed
What would you like to do?
Patches to build some Project Atomic bits on CentOS using Fedora spec files
From 252613fff3142dc2be7e9a3c47fc9c4488ff75da Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 31 Mar 2016 21:27:24 -0400
Subject: [PATCH 1/2] Demote pytest/coverage to Fedora only
We aren't running the tests on CentOS due to dependency issues (whole
vast swath of Python modules to backport), so add these deps into %if
fedora as well.
---
python-docker-py.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python-docker-py.spec b/python-docker-py.spec
index 22ccc38..361c447 100644
--- a/python-docker-py.spec
+++ b/python-docker-py.spec
@@ -29,9 +29,9 @@ BuildRequires: python-setuptools
BuildRequires: python-mock >= 1.0.1
BuildRequires: python-flake8 >= 2.4.1
BuildRequires: python-pytest-cov
-%endif # fedora
BuildRequires: pytest >= 2.7.2
BuildRequires: python-coverage >= 3.7.1
+%endif # fedora
BuildRequires: python-six >= 1.4.0
BuildRequires: python-websocket-client >= 0.32.0
--
1.8.3.1
From 881ba19bab8428bb89fb93f509c1e46db4ef239c Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 31 Mar 2016 21:54:25 -0400
Subject: [PATCH 2/2] Define py2_build/install for CentOS as well
These macros don't exist there yet, so we need to cargo cult them.
---
python-docker-py.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/python-docker-py.spec b/python-docker-py.spec
index 361c447..64b3beb 100644
--- a/python-docker-py.spec
+++ b/python-docker-py.spec
@@ -2,6 +2,8 @@
%global with_python3 1
%else %if 0%{?centos}
%global with_python3 0
+%global py2_build %{__python} setup.py build
+%global py2_install %{__python} setup.py install --root %{buildroot}
%endif #fedora
# disable debug package cause archful
--
1.8.3.1
From 742a6cb5ffd67b933aa36846fd2a828080da187f Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 31 Mar 2016 09:01:19 -0400
Subject: [PATCH 1/2] build: Only require go-srpm-macros on Fedora
---
atomic.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/atomic.spec b/atomic.spec
index 1ef3d69..f2b7e1b 100644
--- a/atomic.spec
+++ b/atomic.spec
@@ -27,7 +27,9 @@ BuildRequires: %{pypkg}-setuptools
BuildRequires: %{pypkg}-tools
BuildRequires: policycoreutils-%{pypkg}
BuildRequires: go-md2man
+%if 0%{?fedora}
BuildRequires: go-srpm-macros
+%endif
BuildRequires: %{pypkg}-dbus
BuildRequires: %{pypkg}-docker-py
BuildRequires: rpm-%{pypkg}
--
1.8.3.1
From 14ab4d63186357bafb85339f6eb2568d1b7bdc2a Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 31 Mar 2016 11:54:31 -0400
Subject: [PATCH 2/2] Only use go_arches on Fedora
---
atomic.spec | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/atomic.spec b/atomic.spec
index f2b7e1b..cf17fe3 100644
--- a/atomic.spec
+++ b/atomic.spec
@@ -18,7 +18,11 @@ Release: 3.git%{shortcommit}%{?dist}
Summary: Tool for managing ProjectAtomic systems and containers
License: LGPLv2+
URL: https://github.com/projectatomic/atomic
+%if 0%{?fedora}
ExclusiveArch: %{go_arches}
+%else
+ExclusiveArch: x86_64
+%endif
Source0: https://github.com/projectatomic/%{name}/archive/%{commit}.tar.gz
BuildRequires: %{pypkg}-devel
--
1.8.3.1
From e0b28003b19ee027741f5039c0325112686eb91e Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Fri, 1 Apr 2016 14:06:13 -0400
Subject: [PATCH] build: Use plain gobuild if !with_bundled
Since centos-atomic-continuous isn't yet using go-srpm-macros.
---
etcd.spec | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/etcd.spec b/etcd.spec
index d5a3825..0df890d 100644
--- a/etcd.spec
+++ b/etcd.spec
@@ -256,10 +256,11 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
%endif
%if ! 0%{?with_bundled}
-export LDFLAGS="-X %{import_path}/version.GitSHA %{shortcommit}"
-%gobuild -o bin/etcd %{import_path}
-%gobuild -o bin/etcdctl %{import_path}/etcdctl
-%gobuild -o bin/etcd-top %{import_path}/tools/etcd-top
+function gobuild { go build -a -ldflags "-X %{import_path}/version.GitSHA %{shortcommit}" "$@"; }
+gobuild -o bin/etcd %{import_path}
+gobuild -o bin/etcdctl %{import_path}/etcdctl
+gobuild -o bin/etcd-top %{import_path}/tools/etcd-migrate
+gobuild -o bin/etcd-top %{import_path}/tools/etcd-top
%else
./build
%endif
--
1.8.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment