Skip to content

Instantly share code, notes, and snippets.

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

What would you like to do?
example RPM specfile for nsq -
%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 <>
License: Apache
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
AutoReqProv: no
# BuildRequires: go-devel = go1.4.2
# BuildRequires: gpm
export GOPATH=$RPM_BUILD_DIR/%{name}-%{version}-%{release}
mkdir -p $GOPATH/src/
mkdir -p $GOPATH/bin
mkdir -p $GOPATH/pkg
cd $GOPATH/src/{github_account}
git clone{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
export GOPATH=$RPM_BUILD_DIR/%{name}-%{version}-%{release}
cd $DIR
mkdir -p $DIR/.godeps
export GOPATH=$DIR/.godeps:$GOPATH
GOPATH=$DIR/.godeps gpm install
if [ $? != "0" ]; then
exit 1
make PREFIX=/%{path}
export DONT_STRIP=1
export GOPATH=$RPM_BUILD_DIR/%{name}-%{version}-%{release}
cd $GOPATH/src/{github_account}/%github_project
make PREFIX=/%{path} DATADIR=/%{path} DESTDIR=$RPM_BUILD_ROOT install
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.