Skip to content

Instantly share code, notes, and snippets.

@jehiah jehiah/nsq.spec
Created Aug 20, 2015

Embed
What would you like to do?
example RPM specfile for nsq - http://nsq.io/
%define name nsq
%define version 0.3.6.alpha
%define release 1
%define path usr/local
%define __os_install_post %{nil}
%define github_account bitly
%define github_project nsq
%define clone_account bitly
%define commit 925f82a0fa7d6abe3652bb31c4834699a8b1c318
Summary: nsq
Name: %{name}
Version: %{version}
Release: %{release}
Group: Database/Applications
Packager: Jehiah Czebotar <jehiah@gmail.com>
License: Apache
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
AutoReqProv: no
# BuildRequires: go-devel = go1.4.2
# BuildRequires: gpm
%description
nsq
https://github.com/bitly/nsq
http://nsq.io/
%prep
export GOPATH=$RPM_BUILD_DIR/%{name}-%{version}-%{release}
mkdir -p $GOPATH/src/github.com/bitly
mkdir -p $GOPATH/bin
mkdir -p $GOPATH/pkg
cd $GOPATH/src/github.com/%{github_account}
git clone https://github.com/%{clone_account}/%{github_project}
cd nsq
git checkout %{commit}
SHORT_COMMIT=$(echo "%{commit}" | cut -c0-8)
sed -i -e "s/Binary = \"\(.*\)\"/Binary = \"\1+build.%{release}.$SHORT_COMMIT\"/g" internal/version/binary.go
%build
export GOPATH=$RPM_BUILD_DIR/%{name}-%{version}-%{release}
DIR=$GOPATH/src/github.com/%{github_account}/%github_project
cd $DIR
mkdir -p $DIR/.godeps
export GOPATH=$DIR/.godeps:$GOPATH
GOPATH=$DIR/.godeps gpm install
if [ $? != "0" ]; then
exit 1
fi
make PREFIX=/%{path}
%install
export DONT_STRIP=1
export GOPATH=$RPM_BUILD_DIR/%{name}-%{version}-%{release}
rm -rf $RPM_BUILD_ROOT
cd $GOPATH/src/github.com/%{github_account}/%github_project
make PREFIX=/%{path} DATADIR=/%{path} DESTDIR=$RPM_BUILD_ROOT install
%files
/%{path}/bin/nsqadmin
/%{path}/bin/nsqd
/%{path}/bin/nsqlookupd
/%{path}/bin/nsq_pubsub
/%{path}/bin/nsq_to_file
/%{path}/bin/nsq_to_http
/%{path}/bin/nsq_to_nsq
/%{path}/bin/nsq_tail
/%{path}/bin/nsq_stat
/%{path}/bin/to_nsq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.