-# disable debug packages for go packages
-%define debug_package %{nil}
+# git rev-parse --short v2.0.11
+%define githash 777151f
Summary: A highly-available key value store for shared configuration
Name: etcd
-Version: 0.3.0
+Version: 2.0.11
Release: 1
License: Apache v2.0
Group: Daemons
Source0: https://github.com/coreos/etcd/archive/v%{version}/%{name}-%{version}.tar.gz
-# Source0-md5: 123d5b2143ad4b21cb89af3e56fd0852
+# Source0-md5: e928ca4a227930ae17bcef5cdf5478da
+Patch0: nogit.patch
URL: https://github.com/coreos/etcd/
-BuildRequires: golang
+BuildRequires: golang >= 1.2.1-3
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# disable debug packages for go packages
+%define debug_package %{nil}
+
+# this will fool adapter not to touch 'etcd'
+%define _sysconfdir __bogus__value
+
%description
A highly-available key value store for shared configuration.
%prep
%setup -q
-sed -i "s/^\(VER=\).*HEAD)/\1%{version}/" scripts/release-version
+%patch0 -p1
%build
-./build
+GIT_SHA=%{githash} \
+sh -xe build
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_bindir}
-install -p %{name} $RPM_BUILD_ROOT%{_bindir}
+install -p bin/etcd $RPM_BUILD_ROOT%{_bindir}
+install -p bin/etcdctl $RPM_BUILD_ROOT%{_bindir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc LICENSE README.md Documentation/internal-protocol-versioning.md
-%attr(755,root,root) %{_bindir}/%{name}
+%attr(755,root,root) %{_bindir}/etcd
+%attr(755,root,root) %{_bindir}/etcdctl
--- /dev/null
+--- etcd-2.0.11/build~ 2015-05-15 23:54:32.000000000 +0300
++++ etcd-2.0.11/build 2015-05-30 09:37:00.739376624 +0300
+@@ -11,7 +11,7 @@
+
+ eval $(go env)
+
+-GIT_SHA=`git rev-parse --short HEAD`
++GIT_SHA=${GIT_SHA:-`git rev-parse --short HEAD`}
+
+ # Static compilation is useful when etcd is run in a container
+ CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-s -X ${REPO_PATH}/version.GitSHA ${GIT_SHA}" -o bin/etcd ${REPO_PATH}