forked from virtuozzo/external-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request virtuozzo#1 from kolyshkin/spec
Add rpm build
- Loading branch information
Showing
48 changed files
with
251 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vzstorage-pd | ||
vzstorage-pd-*.tar.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM centos:7 | ||
ENTRYPOINT ["vzstorage-pd"] | ||
CMD -master=http://127.0.0.1:8080 -kubeconfig=/kube/config | ||
|
||
ADD virtuozzo.repo /etc/yum.repos.d/ | ||
RUN printf "upgrade \n install ploop gdisk \n run" | yum shell -y | ||
|
||
ADD vzstorage-pd /usr/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
NAME := vzstorage-pd | ||
BINS := vzstorage-pd | ||
BINDIR := /usr/bin | ||
GITID ?= $(shell git describe --always HEAD || true) | ||
TARNAME := $(NAME)-$(GITID) | ||
|
||
all: | ||
go build . | ||
.PHONY: all | ||
|
||
tar: $(TARNAME).tar.bz2 | ||
.PHONY: tar | ||
|
||
dist: tar | ||
.PHONY: dist | ||
|
||
rpm: tar | ||
sed -i "s/\(%global commit[[:space:]]*\).*$$/\1 $(GITID)/" $(NAME).spec | ||
rpmbuild -ba --define "_sourcedir $$PWD" $(NAME).spec | ||
.PHONY: rpm | ||
|
||
$(TARNAME).tar.bz2: | ||
(cd .. && git archive --format tar --prefix "$(TARNAME)/" $(GITID)) \ | ||
| bzip2 -9 > $@ | ||
|
||
install-bin: | ||
install -d $(DESTDIR)$(BINDIR) | ||
install $(BINS) $(DESTDIR)$(BINDIR)/ | ||
.PHONY: install-bin | ||
|
||
install: install-bin | ||
.PHONY: install | ||
|
||
clean: | ||
rm -f $(BINS) | ||
rm -f $(TARNAME).tar.bz2 | ||
.PHONY: clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
# If any of the following macros should be set otherwise, | ||
# you can wrap any of them with the following conditions: | ||
# - %%if 0%%{centos} == 7 | ||
# - %%if 0%%{?rhel} == 7 | ||
# - %%if 0%%{?fedora} == 23 | ||
# Or just test for particular distribution: | ||
# - %%if 0%%{centos} | ||
# - %%if 0%%{?rhel} | ||
# - %%if 0%%{?fedora} | ||
# | ||
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test | ||
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition. | ||
# (Don't forget to replace double percentage symbol with single one in order to apply a condition) | ||
|
||
# Generate devel rpm | ||
%global with_devel 0 | ||
# Build project from bundled dependencies | ||
%global with_bundled 0 | ||
# Build with debug info rpm | ||
%global with_debug 0 | ||
# Run tests in check section | ||
%global with_check 1 | ||
# Generate unit-test rpm | ||
%global with_unit_test 0 | ||
|
||
%if 0%{?with_debug} | ||
%global _dwz_low_mem_die_limit 0 | ||
%else | ||
%global debug_package %{nil} | ||
%endif | ||
|
||
|
||
%global provider github | ||
%global provider_tld com | ||
%global project kolyshkin | ||
%global repo external-storage | ||
# https://github.com/kolyshkin/external-storage | ||
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} | ||
%global import_path %{provider_prefix} | ||
%global commit 4655a1f | ||
%global shortcommit %(c=%{commit}; echo ${c:0:7}) | ||
|
||
Name: vzstorage-pd | ||
Version: 0.1.1 | ||
Release: 0.1.git%{shortcommit}%{?dist} | ||
Summary: Kubetnetes provisioner for Virtuozzo Storage | ||
License: ASL 2.0 | ||
URL: https://%{provider_prefix} | ||
Source0: %{name}-%{shortcommit}.tar.bz2 | ||
|
||
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required | ||
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}} | ||
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. | ||
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} | ||
|
||
Requires: ploop | ||
# Remove gdisk req once PSBM-62550 is fixed | ||
Requires: gdisk | ||
|
||
|
||
%description | ||
%{summary} | ||
|
||
%if 0%{?with_devel} | ||
%package devel | ||
Summary: %{summary} | ||
BuildArch: noarch | ||
|
||
%if 0%{?with_check} && ! 0%{?with_bundled} | ||
%endif | ||
|
||
|
||
|
||
%description devel | ||
%{summary} | ||
|
||
This package contains library source intended for | ||
building other packages which use import path with | ||
%{import_path} prefix. | ||
%endif | ||
|
||
%if 0%{?with_unit_test} && 0%{?with_devel} | ||
%package unit-test-devel | ||
Summary: Unit tests for %{name} package | ||
%if 0%{?with_check} | ||
#Here comes all BuildRequires: PACKAGE the unit tests | ||
#in %%check section need for running | ||
%endif | ||
|
||
# test subpackage tests code from devel subpackage | ||
Requires: %{name}-devel = %{version}-%{release} | ||
|
||
%if 0%{?with_check} && ! 0%{?with_bundled} | ||
%endif | ||
|
||
|
||
%description unit-test-devel | ||
%{summary} | ||
|
||
This package contains unit tests for project | ||
providing packages with %{import_path} prefix. | ||
%endif | ||
|
||
%prep | ||
#%setup -q -n %{repo}-%{commit} | ||
%setup -q -n %{name}-%{shortcommit} | ||
|
||
%build | ||
mkdir src | ||
DIR=src/github.com/kubernetes-incubator/external-storage | ||
mkdir -p $(dirname $DIR) | ||
ln -s ../../../ $DIR | ||
GOPATH=`pwd` | ||
cd $GOPATH/$DIR/%{name} | ||
make | ||
|
||
|
||
%install | ||
cd %{name} | ||
make DESTDIR="%{buildroot}" install | ||
# source codes for building projects | ||
%if 0%{?with_devel} | ||
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ | ||
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list | ||
# find all *.go but no *_test.go files and generate devel.file-list | ||
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go" | grep -v "vendor") ; do | ||
dirprefix=$(dirname $file) | ||
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix | ||
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file | ||
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list | ||
|
||
while [ "$dirprefix" != "." ]; do | ||
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list | ||
dirprefix=$(dirname $dirprefix) | ||
done | ||
done | ||
%endif | ||
|
||
# testing files for this project | ||
%if 0%{?with_unit_test} && 0%{?with_devel} | ||
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ | ||
# find all *_test.go files and generate unit-test-devel.file-list | ||
for file in $(find . -iname "*_test.go" | grep -v "vendor") ; do | ||
dirprefix=$(dirname $file) | ||
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix | ||
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file | ||
echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list | ||
|
||
while [ "$dirprefix" != "." ]; do | ||
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list | ||
dirprefix=$(dirname $dirprefix) | ||
done | ||
done | ||
%endif | ||
|
||
%if 0%{?with_devel} | ||
sort -u -o devel.file-list devel.file-list | ||
%endif | ||
|
||
%check | ||
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} | ||
%if ! 0%{?with_bundled} | ||
export GOPATH=%{buildroot}/%{gopath}:%{gopath} | ||
%else | ||
# Since we aren't packaging up the vendor directory we need to link | ||
# back to it somehow. Hack it up so that we can add the vendor | ||
# directory from BUILD dir as a gopath to be searched when executing | ||
# tests from the BUILDROOT dir. | ||
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor | ||
|
||
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} | ||
%endif | ||
|
||
%if ! 0%{?gotest:1} | ||
%global gotest go test | ||
%endif | ||
|
||
%endif | ||
|
||
#define license tag if not already defined | ||
%{!?_licensedir:%global license %doc} | ||
|
||
|
||
%if 0%{?with_devel} | ||
%files devel -f devel.file-list | ||
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} | ||
%endif | ||
|
||
%if 0%{?with_unit_test} && 0%{?with_devel} | ||
%files unit-test-devel -f unit-test-devel.file-list | ||
%endif | ||
|
||
%files | ||
%_bindir/%{name} | ||
%doc %{name}/README.md | ||
# examples | ||
%doc %{name}/claim.yaml | ||
%doc %{name}/class.yaml | ||
%doc %{name}/test-pod.yaml | ||
|
||
%changelog | ||
* Mon Mar 20 2017 Kir Kolyshkin <[email protected]> 0.1.1-1 | ||
- Initial packaging |