-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
966d97f
commit 9ad31ad
Showing
10 changed files
with
361 additions
and
1 deletion.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/python | ||
#!/usr/bin/python3 | ||
|
||
# ------------------------------------------------ | ||
# act_latency.py | ||
|
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,139 @@ | ||
#!/usr/bin/env bash | ||
# ------------------------------------------------------------------------------ | ||
# Copyright 2012-2015 Aerospike, Inc. | ||
# | ||
# Portions may be licensed to Aerospike, Inc. under one or more contributor | ||
# license agreements. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# ------------------------------------------------------------------------------ | ||
|
||
OPT_LONG=0 | ||
|
||
if [ "$1" = "-long" ] | ||
then | ||
OPT_LONG=1 | ||
fi | ||
|
||
error() { | ||
echo 'error:' $* >&2 | ||
} | ||
|
||
main() { | ||
|
||
local kernel='' | ||
local distro_id='' | ||
local distro_version='' | ||
local distro_long='' | ||
local distro_short='' | ||
|
||
# Make sure this script is running on Linux | ||
# The script is not designed to work on non-Linux | ||
# operating systems. | ||
kernel=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
if [ "$kernel" != 'linux' ] | ||
then | ||
error "$kernel is not supported." | ||
exit 1 | ||
fi | ||
|
||
if [ -f /etc/os-release ] | ||
then | ||
. /etc/os-release | ||
distro_id=${ID,,} | ||
distro_version=${VERSION_ID} | ||
elif [ -f /etc/issue ] | ||
then | ||
issue=$(cat /etc/issue | tr '[:upper:]' '[:lower:]') | ||
case "$issue" in | ||
*'centos'* ) | ||
distro_id='centos' | ||
;; | ||
*'redhat'* | *'rhel'* ) | ||
distro_id='rhel' | ||
;; | ||
*'debian'* ) | ||
distro_id='debian' | ||
;; | ||
* ) | ||
error "/etc/issue contained an unsupported linux distibution: $issue" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
case "$distro_id" in | ||
'centos' | 'rhel' ) | ||
local release='' | ||
if [ -f /etc/centos-release ]; then | ||
release=$(cat /etc/centos-release | tr '[:upper:]' '[:lower:]') | ||
elif [ -f /etc/redhat-release ]; then | ||
release=$(cat /etc/redhat-release | tr '[:upper:]' '[:lower:]') | ||
fi | ||
release_version=${release##*release} | ||
distro_version=${release_version%.*} | ||
;; | ||
'debian' ) | ||
debian_version=$(cat /etc/debian_version | tr '[:upper:]' '[:lower:]') | ||
distro_version=${debian_version%%.*} | ||
;; | ||
* ) | ||
error "/etc/issue contained an unsupported linux distibution: $issue" | ||
exit 1 | ||
;; | ||
esac | ||
fi | ||
|
||
distro_id=${distro_id//[[:space:]]/} | ||
distro_version=${distro_version//[[:space:]]/} | ||
|
||
case "$distro_id" in | ||
'centos' ) | ||
distro_long="${distro_id}${distro_version%%.*}" | ||
distro_short="el${distro_version%%.*}" | ||
;; | ||
'rhel' | 'redhat' | 'red hat' ) | ||
distro_long="${distro_id}${distro_version%%.*}" | ||
distro_short="el${distro_version%%.*}" | ||
;; | ||
'fedora' ) | ||
if [ "$distro_version" -gt "15" ] | ||
then | ||
distro_version=7 | ||
elif [ "$distro_version" -gt "10" ] | ||
then | ||
distro_version=6 | ||
else | ||
error "Unsupported linux distibution: $distro_id $distro_version" | ||
exit 1 | ||
fi | ||
distro_long="centos${distro_version}" | ||
distro_short="el${distro_version}" | ||
;; | ||
'amzn' ) | ||
distro_long="ami" | ||
distro_short="ami" | ||
;; | ||
* ) | ||
distro_long="${distro_id}${distro_version}" | ||
distro_short="${distro_id}${distro_version}" | ||
;; | ||
esac | ||
|
||
if [ "$OPT_LONG" = "1" ] | ||
then | ||
echo "${distro_long}" | ||
else | ||
echo "${distro_short}" | ||
fi | ||
exit 0 | ||
} | ||
|
||
main |
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,10 @@ | ||
#!/bin/bash | ||
|
||
rev=`git describe` | ||
subbuild=`echo $rev | awk -F'-' '{print $2}'` | ||
|
||
if [ "$subbuild" != "" ] | ||
then | ||
rev=`echo $rev | awk -F'-' '{printf("%s-%s\n",$1,$2)}'` | ||
fi | ||
echo $rev |
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,53 @@ | ||
# Build act distribution. | ||
|
||
export DEB_SOURCE_ROOT = $(shell echo `pwd`/dist) | ||
export DEB_BUILD_ROOT = $(DEB_SOURCE_ROOT)/BUILD | ||
export CL_BASE = $(DEB_BUILD_ROOT)/opt/aerospike | ||
export ETC_BASE = $(DEB_BUILD_ROOT)/etc/aerospike | ||
|
||
REV = $(shell build/version) | ||
#REV = 6.2.0 | ||
OS = $(shell build/os_version) | ||
MANIFEST_DIR = manifest/TEMP | ||
|
||
.PHONY: default | ||
default: dist | ||
|
||
.PHONY: dist | ||
dist: | ||
|
||
# Build tools package. | ||
rm -rf $(DEB_BUILD_ROOT)/* | ||
mkdir -p $(DEB_BUILD_ROOT)/DEBIAN | ||
mkdir -p $(DEB_BUILD_ROOT)/usr/bin | ||
mkdir -p pkg/deb/DEBS | ||
install -m 755 pkg/deb/postinst $(DEB_BUILD_ROOT)/DEBIAN/postinst | ||
install -m 755 pkg/deb/prerm $(DEB_BUILD_ROOT)/DEBIAN/prerm | ||
install -m 644 pkg/deb/control $(DEB_BUILD_ROOT)/DEBIAN/control | ||
|
||
mkdir -p $(CL_BASE) | ||
mkdir -p $(ETC_BASE) | ||
mkdir -p $(CL_BASE)/bin | ||
|
||
# act | ||
install -m 755 target/bin/act_* $(CL_BASE)/bin/ | ||
install -m 755 analysis/act_latency.py $(CL_BASE)/bin/ | ||
install -m 755 config/act_index.conf $(ETC_BASE)/ | ||
install -m 755 config/act_storage.conf $(ETC_BASE)/ | ||
|
||
# Create symlinks to /usr/bin | ||
mkdir -p $(DEB_BUILD_ROOT)/usr/bin | ||
ln -sf /opt/aerospike/bin/act_index $(DEB_BUILD_ROOT)/usr/bin/act_index | ||
ln -sf /opt/aerospike/bin/act_prep $(DEB_BUILD_ROOT)/usr/bin/act_prep | ||
ln -sf /opt/aerospike/bin/act_storage $(DEB_BUILD_ROOT)/usr/bin/act_storage | ||
ln -sf /opt/aerospike/bin/act_latency.py $(DEB_BUILD_ROOT)/usr/bin/act_latency.py | ||
|
||
|
||
sed 's/@VERSION@/'$(REV)'/g' <pkg/deb/control >$(DEB_BUILD_ROOT)/DEBIAN/control | ||
|
||
fakeroot dpkg-deb --build $(DEB_BUILD_ROOT) pkg/deb/DEBS | ||
rm -rf dist | ||
|
||
distclean: | ||
rm -rf $(DEB_SOURCE_ROOT) | ||
rm -rf pkg/deb/DEBS |
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,44 @@ | ||
# Build aerospike rpm distribution. | ||
|
||
export RPM_SOURCE_ROOT = $(shell echo `pwd`/dist) | ||
export RPM_BUILD_ROOT = $(RPM_SOURCE_ROOT)/BUILD | ||
export CL_BASE = $(RPM_BUILD_ROOT)/opt/aerospike | ||
export ETC_BASE = $(RPM_BUILD_ROOT)/etc/aerospike | ||
|
||
MANIFEST_DIR = manifest/TEMP | ||
TOOLS_VERSION = $(shell build/version | sed 's/-/_/g') | ||
OS = $(shell build/os_version) | ||
#TOOLS_VERSION = $(shell git describe 2>/dev/null; if [ $${?} != 0 ]; then echo 'unknown'; fi) | ||
OS = el8 | ||
TOOLS_VERSION = 6.2.0 | ||
|
||
.PHONY: default | ||
default: dist | ||
mkdir -p pkg/rpm/RPMS/x86_64 | ||
mkdir -p $(RPM_BUILD_ROOT) | ||
mkdir -p $(RPM_SOURCE_ROOT)/RPMS/x86_64 | ||
mkdir -p $(RPM_BUILD_ROOT)/usr/bin | ||
|
||
sed 's/@VERSION@/'$(TOOLS_VERSION)'/g' <pkg/rpm/act.spec >pkg/act_v.spec | ||
sed -i 's/@RELEASE@/'$(OS)'/g' pkg/act_v.spec | ||
|
||
rpmbuild -bb -vv --define "dist .$(OS)" --buildroot $(RPM_BUILD_ROOT) pkg/act_v.spec | ||
find $(RPM_SOURCE_ROOT)/RPMS -type f -exec mv {} pkg/rpm/RPMS/x86_64 \; | ||
rm -rf pkg/act_v.spec dist | ||
|
||
distclean: | ||
rm -rf $(RPM_BUILD_ROOT) | ||
rm -rf pkg/rpm/RPMS/x86_64/* | ||
|
||
.PHONY: dist | ||
dist: | ||
|
||
mkdir -p $(CL_BASE) | ||
mkdir -p $(ETC_BASE) | ||
mkdir -p $(CL_BASE)/bin | ||
|
||
# act | ||
install -m 755 target/bin/act_* $(CL_BASE)/bin/ | ||
install -m 755 analysis/act_latency.py $(CL_BASE)/bin/ | ||
install -m 755 config/act_index.conf $(ETC_BASE)/ | ||
install -m 755 config/act_storage.conf $(ETC_BASE)/ |
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 @@ | ||
Package: act | ||
Version: @VERSION@ | ||
Section: Databases | ||
Priority: optional | ||
Architecture: amd64 | ||
Depends: libc6 (>= 2.7) | ||
Maintainer: Aerospike, Inc. <[email protected]> | ||
Description: Aerospike Certification Tool |
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,25 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
case "$1" in | ||
configure) | ||
|
||
echo Installing /opt/aerospike/bim/act | ||
|
||
# create aerospike group if it isn't already there | ||
if ! getent group aerospike >/dev/null; then | ||
groupadd -r aerospike | ||
fi | ||
|
||
# create aerospike user if it isn't already there | ||
if ! getent passwd aerospike >/dev/null; then | ||
useradd -r -d /opt/aerospike -c 'Aerospike server' -g aerospike aerospike | ||
fi | ||
|
||
chown -R aerospike:aerospike /opt/aerospike | ||
|
||
;; | ||
esac | ||
|
||
exit 0 |
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,13 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
case "$1" in | ||
remove) | ||
|
||
echo Removing /opt/aerospike/bin/act | ||
rm -f /opt/aerospike/bin/act_* | ||
;; | ||
esac | ||
|
||
exit 0 |
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,55 @@ | ||
Name: act | ||
Version: @VERSION@ | ||
Release: 1%{?dist} | ||
Summary: The Aerospike Certification Tool | ||
License: Apache 2.0 license | ||
Group: Application | ||
BuildArch: x86_64 | ||
%description | ||
ACT provides a pair of programs for testing and certifying flash/SSD devices' performance for Aerospike Database data and index storage. | ||
%define _topdir dist | ||
%define __spec_install_post /usr/lib/rpm/brp-compress | ||
|
||
%package tools | ||
Summary: The Aerospike Certification Tool | ||
Group: Applications | ||
%description tools | ||
Tools for use with the Aerospike database | ||
%files | ||
%defattr(-,aerospike,aerospike) | ||
/opt/aerospike/bin/act_index | ||
/opt/aerospike/bin/act_prep | ||
/opt/aerospike/bin/act_storage | ||
/opt/aerospike/bin/act_latency.py | ||
%defattr(-,root,root) | ||
/usr/bin/act_index | ||
/usr/bin/act_prep | ||
/usr/bin/act_storage | ||
/usr/bin/act_latency.py | ||
|
||
%config(noreplace) | ||
/etc/aerospike/act_storage.conf | ||
/etc/aerospike/act_index.conf | ||
|
||
%prep | ||
ln -sf /opt/aerospike/bin/act_index %{buildroot}/usr/bin/act_index | ||
ln -sf /opt/aerospike/bin/act_prep %{buildroot}/usr/bin/act_prep | ||
ln -sf /opt/aerospike/bin/act_storage %{buildroot}/usr/bin/act_storage | ||
ln -sf /opt/aerospike/bin/act_latency.py %{buildroot}/usr/bin/act_latency.py | ||
|
||
%pre tools | ||
echo Installing /opt/aerospike/act | ||
if ! id -g aerospike >/dev/null 2>&1; then | ||
echo "Adding group aerospike" | ||
/usr/sbin/groupadd -r aerospike | ||
fi | ||
if ! id -u aerospike >/dev/null 2>&1; then | ||
echo "Adding user aerospike" | ||
/usr/sbin/useradd -r -d /opt/aerospike -c 'Aerospike server' -g aerospike aerospike | ||
fi | ||
|
||
%preun tools | ||
if [ $1 -eq 0 ] | ||
then | ||
echo Removing /opt/aerospike/act | ||
fi |