Update rpm build scripts and README
authorBrenden Blanco <bblanco@plumgrid.com>
Fri, 19 Feb 2016 22:42:22 +0000 (14:42 -0800)
committerBrenden Blanco <bblanco@plumgrid.com>
Mon, 22 Feb 2016 07:48:29 +0000 (23:48 -0800)
Remove the unused Dockerfiles.

Create two flavors of spec files, one which includes steps to build
clang from source and link against it, and one which assumes clang is
already available and just builds bcc. The former is more appropriate
for official packaging, the latter for nightly and quick builds.

Also, introduce a numbering scheme for nightly rpm files. The format
will be:
`libbcc-$latest_git_tag-g$latest_git_hash.x86_64.rpm`
as in:
`libbcc-0.1.7-g73c4d1a.x86_64.rpm`

Update the INSTALL.md to mention the RPMs

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
17 files changed:
INSTALL.md
SPECS/Dockerfile.el6 [deleted file]
SPECS/Dockerfile.el6.in [deleted file]
SPECS/Dockerfile.el7 [deleted file]
SPECS/Dockerfile.el7.in [deleted file]
SPECS/Dockerfile.f22 [deleted file]
SPECS/Dockerfile.f22.in [deleted file]
SPECS/Dockerfile.fedora [new file with mode: 0644]
SPECS/bcc+clang.spec [moved from SPECS/bcc.f22.spec.in with 57% similarity]
SPECS/bcc.el6.spec [deleted file]
SPECS/bcc.el6.spec.in [deleted file]
SPECS/bcc.el7.spec [deleted file]
SPECS/bcc.el7.spec.in [deleted file]
SPECS/bcc.f22.spec [deleted file]
SPECS/bcc.spec
scripts/build-release-rpm.sh [new file with mode: 0755]
scripts/build-rpm.sh

index 2ff9b23..d144d05 100644 (file)
@@ -36,9 +36,9 @@ Install a 4.3+ kernel from http://kernel.ubuntu.com/~kernel-ppa/mainline,
 for example:
 
 ```bash
-VER=4.3.0-040300
+VER=4.4.2-040402
 PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.3-wily/
-REL=201511020949
+REL=201602171633
 wget ${PREFIX}/linux-headers-${VER}-generic_${VER}.${REL}_amd64.deb
 wget ${PREFIX}/linux-headers-${VER}_${VER}.${REL}_all.deb
 wget ${PREFIX}/linux-image-${VER}-generic_${VER}.${REL}_amd64.deb
@@ -48,8 +48,8 @@ sudo dpkg -i linux-*${VER}.${REL}*.deb
 
 Update PREFIX to the latest date, and you can browse the files in the PREFIX url to find the REL number.
 
-Tagged bcc binary packages are built for Ubuntu Trusty (14.04) and hosted at
-http://52.8.15.63/apt/.
+Tagged and signed bcc binary packages are built for Ubuntu Trusty (14.04) and
+hosted at http://52.8.15.63/apt/.
 
 To install:
 ```bash
@@ -76,18 +76,18 @@ Install a 4.2+ kernel from
 http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug, for example:
 
 ```bash
-sudo wget http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/fedora-rawhide-kernel-nodebug.repo -O /etc/yum.repos.d/fedora-rawhide-kernel-nodebug.repo
-sudo dnf install -y kernel-core-4.2.0-1.fc24.x86_64 kernel-4.2.0-1.fc24.x86_64 kernel-devel-4.2.0-1.fc24.x86_64 kernel-modules-4.2.0-1.fc24.x86_64 kernel-headers-4.2.0-1.fc24.x86_64
+sudo dnf config-manager --add-repo=http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/fedora-rawhide-kernel-nodebug.repo
+sudo dnf update
 # reboot
 ```
 
-Tagged bcc binary packages are built for Fedora 22 and hosted at
-http://52.8.15.63/yum/.
+Nightly bcc binary packages are built for Fedora 23 and 24, hosted at
+`http://52.8.15.63/yum/nightly/f{23,24}`.
 
-To install:
+To install (change 'f23' to 'f24' for rawhide):
 ```bash
-sudo wget http://52.8.15.63/yum/main/f22/iovisor.repo -O /etc/yum.repos.d/iovisor.repo
-sudo dnf install -y libbcc libbcc-examples python-bcc
+echo -e '[iovisor]\nbaseurl=http://52.8.15.63/yum/nightly/f23/$basearch\nenabled=1\ngpgcheck=0' | sudo tee /etc/yum.repos.d/iovisor.repo
+sudo dnf install bcc-tools
 ```
 
 ## Arch - AUR
@@ -157,8 +157,6 @@ sudo tar xf clang+llvm-3.7.0-x86_64-fedora22.tar.xz -C /usr/local --strip 1
 ```
 git clone https://github.com/iovisor/bcc.git
 mkdir bcc/build; cd bcc/build
-# optional
-export CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++
 cmake .. -DCMAKE_INSTALL_PREFIX=/usr
 make
 sudo make install
@@ -174,7 +172,7 @@ cd llvm/tools; git clone http://llvm.org/git/clang.git
 cd ..; mkdir -p build/install; cd build
 cmake -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
   -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/install ..
-make -j4
+make
 make install
 export PATH=$PWD/install/bin:$PATH
 ```
diff --git a/SPECS/Dockerfile.el6 b/SPECS/Dockerfile.el6
deleted file mode 100644 (file)
index 184fe24..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) PLUMgrid, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-
-FROM centos:6
-
-MAINTAINER Brenden Blanco <bblanco@plumgrid.com>
-
-RUN yum -y install bison cmake flex gcc gcc-c++ git glibc-devel glibc-utils python2-devel rpm-build svn tar texinfo-tex wget zip zlib-devel
-
-WORKDIR /root
-RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS}
-RUN cd SOURCES && wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
-RUN cd SOURCES && wget https://ftp.gnu.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.gz
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
-RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.7.tar.gz
-
-RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.7/SPECS/bcc.el6.spec
-#COPY SPECS/bcc.el6.spec SPECS/
-
-RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el6.spec
diff --git a/SPECS/Dockerfile.el6.in b/SPECS/Dockerfile.el6.in
deleted file mode 100644 (file)
index 8793320..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) PLUMgrid, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-
-FROM centos:6
-
-MAINTAINER Brenden Blanco <bblanco@plumgrid.com>
-
-RUN yum -y install bison cmake flex gcc gcc-c++ git glibc-devel glibc-utils python2-devel rpm-build svn tar texinfo-tex wget zip zlib-devel
-
-WORKDIR /root
-RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS}
-RUN cd SOURCES && wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
-RUN cd SOURCES && wget https://ftp.gnu.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.gz
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
-RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@REVISION_LAST@.tar.gz
-
-RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v@REVISION_LAST@/SPECS/bcc.el6.spec
-#COPY SPECS/bcc.el6.spec SPECS/
-
-RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el6.spec
diff --git a/SPECS/Dockerfile.el7 b/SPECS/Dockerfile.el7
deleted file mode 100644 (file)
index d6f5114..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) PLUMgrid, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-
-FROM centos:7
-
-MAINTAINER Brenden Blanco <bblanco@plumgrid.com>
-
-RUN yum -y install bison cmake flex gcc gcc-c++ make python2-devel rpm-build wget zlib-devel
-
-WORKDIR /root
-RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS}
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
-RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.7.tar.gz
-
-RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.7/SPECS/bcc.el7.spec
-#COPY SPECS/bcc.el7.spec SPECS/
-
-RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el7.spec
diff --git a/SPECS/Dockerfile.el7.in b/SPECS/Dockerfile.el7.in
deleted file mode 100644 (file)
index 5a82058..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) PLUMgrid, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-
-FROM centos:7
-
-MAINTAINER Brenden Blanco <bblanco@plumgrid.com>
-
-RUN yum -y install bison cmake flex gcc gcc-c++ make python2-devel rpm-build wget zlib-devel
-
-WORKDIR /root
-RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS}
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
-RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@REVISION_LAST@.tar.gz
-
-RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v@REVISION_LAST@/SPECS/bcc.el7.spec
-#COPY SPECS/bcc.el7.spec SPECS/
-
-RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el7.spec
diff --git a/SPECS/Dockerfile.f22 b/SPECS/Dockerfile.f22
deleted file mode 100644 (file)
index c4c996b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) PLUMgrid, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-
-FROM fedora:22
-
-MAINTAINER Brenden Blanco <bblanco@plumgrid.com>
-
-RUN dnf -y install bison cmake flex gcc gcc-c++ libstdc++-static make python2-devel rpm-build wget zlib-devel
-
-WORKDIR /root
-RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS}
-
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
-RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.7.tar.gz
-
-RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.7/SPECS/bcc.f22.spec
-#COPY SPECS/bcc.f22.spec SPECS/
-
-RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.f22.spec
diff --git a/SPECS/Dockerfile.f22.in b/SPECS/Dockerfile.f22.in
deleted file mode 100644 (file)
index 5b32d4d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) PLUMgrid, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-
-FROM fedora:22
-
-MAINTAINER Brenden Blanco <bblanco@plumgrid.com>
-
-RUN dnf -y install bison cmake flex gcc gcc-c++ libstdc++-static make python2-devel rpm-build wget zlib-devel
-
-WORKDIR /root
-RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS}
-
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
-RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
-RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@REVISION_LAST@.tar.gz
-
-RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v@REVISION_LAST@/SPECS/bcc.f22.spec
-#COPY SPECS/bcc.f22.spec SPECS/
-
-RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.f22.spec
diff --git a/SPECS/Dockerfile.fedora b/SPECS/Dockerfile.fedora
new file mode 100644 (file)
index 0000000..2ecbb0b
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright (c) PLUMgrid, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License")
+
+FROM fedora:rawhide
+
+MAINTAINER Brenden Blanco <bblanco@plumgrid.com>
+
+RUN dnf -y install bison cmake flex gcc gcc-c++ git libxml2-devel make python2-devel rpm-build wget zlib-devel
+
+WORKDIR /root
+
+RUN wget http://llvm.org/releases/3.7.1/{cfe,llvm}-3.7.1.src.tar.xz
+
+RUN tar -xf llvm-3.7.1.src.tar.xz && mkdir llvm-3.7.1.src/tools/clang && tar -xf cfe-3.7.1.src.tar.xz -C llvm-3.7.1.src/tools/clang --strip 1 && mkdir llvm-3.7.1.src/build
+RUN cd llvm-3.7.1.src/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;BPF" -DCMAKE_INSTALL_PREFIX=/usr
+RUN cd llvm-3.7.1.src/build && make -j8
+
+COPY . bcc
+WORKDIR /root/bcc
+RUN PATH=/root/llvm-3.7.1.src/build/bin:$PATH ./scripts/build-rpm.sh
similarity index 57%
rename from SPECS/bcc.f22.spec.in
rename to SPECS/bcc+clang.spec
index 32cd9a4..e73c43e 100644 (file)
@@ -1,20 +1,20 @@
 %define debug_package %{nil}
-%define llvmver 3.7.0
+%define llvmver 3.7.1
 
 Name:           bcc
-Version:        @REVISION_LAST@
-Release:        1%{?dist}
+Version:        @REVISION@
+Release:        @GIT_REV_COUNT@
 Summary:        BPF Compiler Collection (BCC)
 
 Group:          Development/Languages
 License:        ASL 2.0
 URL:            https://github.com/iovisor/bcc
 Source0:        https://github.com/iovisor/bcc/archive/v%{version}.tar.gz
-Source1:        http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz
-Source2:        http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz
+Source1:        http://llvm.org/releases/%{llvmver}/llvm-%{llvmver}.src.tar.xz
+Source2:        http://llvm.org/releases/%{llvmver}/cfe-%{llvmver}.src.tar.xz
 
 BuildArch:      x86_64
-BuildRequires:  bison, cmake >= 2.8.7, flex, gcc, gcc-c++, python2-devel
+BuildRequires:  bison, cmake >= 2.8.7, flex, gcc, gcc-c++, libxml2-devel, python2-devel
 
 %description
 Python bindings for BPF Compiler Collection (BCC). Control a BPF program from
@@ -25,7 +25,7 @@ userspace.
 %setup -T -b 1 -n llvm-%{llvmver}.src
 mkdir tools/clang
 tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1
-%setup -D -n bcc-%{version}
+%setup -D -n bcc
 
 %build
 
@@ -36,15 +36,15 @@ export PATH="%{_builddir}/usr/bin":$PATH
 pushd %{_builddir}/llvm-%{llvmver}.src
 mkdir build
 cd build
-../configure --disable-assertions --enable-optimized --prefix="%{_builddir}/usr"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
+cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;BPF" -DCMAKE_INSTALL_PREFIX=/usr
+make %{?_smp_mflags}
+make install DESTDIR="%{_builddir}"
 popd
 
 mkdir build
 pushd build
-cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr
-make -j`grep -c ^process /proc/cpuinfo`
+cmake .. -DREVISION_LAST=%{version} -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr
+make %{?_smp_mflags}
 popd
 
 %install
@@ -62,17 +62,24 @@ Shared Library for BPF Compiler Collection (BCC)
 
 %package -n libbcc-examples
 Summary: Examples for BPF Compiler Collection (BCC)
+Requires: libbcc
 %description -n libbcc-examples
 Examples for BPF Compiler Collection (BCC)
 
 %package -n python-bcc
 Summary: Python bindings for BPF Compiler Collection (BCC)
+Requires: libbcc
 %description -n python-bcc
 Python bindings for BPF Compiler Collection (BCC)
 
+%package -n bcc-tools
+Summary: Command line tools for BPF Compiler Collection (BCC)
+Requires: python-bcc
+%description -n bcc-tools
+Command line tools for BPF Compiler Collection (BCC)
+
 %files -n python-bcc
 %{python_sitelib}/bcc*
-%exclude %{python_sitelib}/*.egg-info
 
 %files -n libbcc
 /usr/lib64/*
@@ -80,3 +87,13 @@ Python bindings for BPF Compiler Collection (BCC)
 
 %files -n libbcc-examples
 /usr/share/bcc/examples/*
+%exclude /usr/share/bcc/examples/*.pyc
+%exclude /usr/share/bcc/examples/*.pyo
+%exclude /usr/share/bcc/examples/*/*.pyc
+%exclude /usr/share/bcc/examples/*/*.pyo
+%exclude /usr/share/bcc/examples/*/*/*.pyc
+%exclude /usr/share/bcc/examples/*/*/*.pyo
+
+%files -n bcc-tools
+/usr/share/bcc/tools/*
+/usr/share/bcc/man/*
diff --git a/SPECS/bcc.el6.spec b/SPECS/bcc.el6.spec
deleted file mode 100644 (file)
index f25e34a..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright (c) PLUMgrid, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-
-%define debug_package %{nil}
-%define llvmver 3.7.0
-%define gccver 5.1.0
-%define pythonver 2.7.10
-
-Name:           bcc
-Version:        0.1.7
-Release:        1%{?dist}
-Summary:        BPF Compiler Collection (BCC)
-
-Group:          Development/Languages
-License:        ASL 2.0
-URL:            https://github.com/iovisor/bcc
-Source0:        https://github.com/iovisor/bcc/archive/v%{version}.tar.gz
-Source1:        https://ftp.gnu.org/gnu/gcc/gcc-%{gccver}/gcc-%{gccver}.tar.gz
-Source2:        https://www.python.org/ftp/python/%{pythonver}/Python-%{pythonver}.tgz
-Source3:        http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz
-Source4:        http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz
-
-BuildArch:      x86_64
-BuildRequires:  bison, bzip2, cmake >= 2.8.7, file, flex, gcc, gcc-c++, git, glibc-devel, glibc-utils, python2-devel, rpm-build, svn, tar, texinfo-tex, wget, zip, zlib-devel
-
-%description
-Python bindings for BPF Compiler Collection (BCC). Control a BPF program
-from userspace.
-
-
-%prep
-%setup -T -b 1 -n gcc-%{gccver}
-%setup -T -D -b 2 -n Python-%{pythonver}
-%setup -T -D -b 3 -n llvm-%{llvmver}.src
-mkdir tools/clang
-tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1
-%setup -D -n bcc-%{version}
-
-%build
-
-export LD_LIBRARY_PATH="%{_builddir}/usr/lib64"
-export PATH="%{_builddir}/usr/bin":$PATH
-
-# build gcc to bootstrap llvm build
-pushd %{_builddir}/gcc-%{gccver}
-./contrib/download_prerequisites
-mkdir build
-cd build
-../configure --disable-multilib --prefix="%{_builddir}/usr"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-echo "%{_builddir}/usr/lib64" > /etc/ld.so.conf.d/usrLocalLib64.conf
-ldconfig
-
-# build newer python for llvm
-pushd %{_builddir}/Python-%{pythonver}
-./configure --prefix="%{_builddir}/usr"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-# build llvm with local gcc
-pushd %{_builddir}/llvm-%{llvmver}.src
-mkdir build
-cd build
-cmake .. -DCMAKE_INSTALL_PREFIX="%{_builddir}/usr" -DCMAKE_C_COMPILER="%{_builddir}/usr/bin/gcc" -DCMAKE_CXX_COMPILER="%{_builddir}/usr/bin/g++" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;BPF"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-rm /etc/ld.so.conf.d/usrLocalLib64.conf
-ldconfig
-
-mkdir build
-cd build
-cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER="%{_builddir}/usr/bin/gcc" -DCMAKE_CXX_COMPILER="%{_builddir}/usr/bin/g++"
-make -j`grep -c ^process /proc/cpuinfo`
-
-%install
-cd build
-make install/strip DESTDIR=%{buildroot}
-
-%changelog
-* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2
-- Initial RPM Release
-
-%package -n libbcc
-Summary: Shared Library for BPF Compiler Collection (BCC)
-%description -n libbcc
-Shared Library for BPF Compiler Collection (BCC)
-
-%package -n libbcc-examples
-Summary: Examples for BPF Compiler Collection (BCC)
-%description -n libbcc-examples
-Examples for BPF Compiler Collection (BCC)
-
-%package -n python-bcc
-Summary: Python bindings for BPF Compiler Collection (BCC)
-%description -n python-bcc
-Python bindings for BPF Compiler Collection (BCC)
-
-%files -n python-bcc
-%{python_sitelib}/bcc*
-%exclude %{python_sitelib}/*.egg-info
-
-%files -n libbcc
-/usr/lib64/*
-/usr/include/bcc/*
-
-%files -n libbcc-examples
-/usr/share/bcc/examples/*
diff --git a/SPECS/bcc.el6.spec.in b/SPECS/bcc.el6.spec.in
deleted file mode 100644 (file)
index 4493f9f..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright (c) PLUMgrid, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-
-%define debug_package %{nil}
-%define llvmver 3.7.0
-%define gccver 5.1.0
-%define pythonver 2.7.10
-
-Name:           bcc
-Version:        @REVISION_LAST@
-Release:        1%{?dist}
-Summary:        BPF Compiler Collection (BCC)
-
-Group:          Development/Languages
-License:        ASL 2.0
-URL:            https://github.com/iovisor/bcc
-Source0:        https://github.com/iovisor/bcc/archive/v%{version}.tar.gz
-Source1:        https://ftp.gnu.org/gnu/gcc/gcc-%{gccver}/gcc-%{gccver}.tar.gz
-Source2:        https://www.python.org/ftp/python/%{pythonver}/Python-%{pythonver}.tgz
-Source3:        http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz
-Source4:        http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz
-
-BuildArch:      x86_64
-BuildRequires:  bison, bzip2, cmake >= 2.8.7, file, flex, gcc, gcc-c++, git, glibc-devel, glibc-utils, python2-devel, rpm-build, svn, tar, texinfo-tex, wget, zip, zlib-devel
-
-%description
-Python bindings for BPF Compiler Collection (BCC). Control a BPF program
-from userspace.
-
-
-%prep
-%setup -T -b 1 -n gcc-%{gccver}
-%setup -T -D -b 2 -n Python-%{pythonver}
-%setup -T -D -b 3 -n llvm-%{llvmver}.src
-mkdir tools/clang
-tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1
-%setup -D -n bcc-%{version}
-
-%build
-
-export LD_LIBRARY_PATH="%{_builddir}/usr/lib64"
-export PATH="%{_builddir}/usr/bin":$PATH
-
-# build gcc to bootstrap llvm build
-pushd %{_builddir}/gcc-%{gccver}
-./contrib/download_prerequisites
-mkdir build
-cd build
-../configure --disable-multilib --prefix="%{_builddir}/usr"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-echo "%{_builddir}/usr/lib64" > /etc/ld.so.conf.d/usrLocalLib64.conf
-ldconfig
-
-# build newer python for llvm
-pushd %{_builddir}/Python-%{pythonver}
-./configure --prefix="%{_builddir}/usr"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-# build llvm with local gcc
-pushd %{_builddir}/llvm-%{llvmver}.src
-mkdir build
-cd build
-cmake .. -DCMAKE_INSTALL_PREFIX="%{_builddir}/usr" -DCMAKE_C_COMPILER="%{_builddir}/usr/bin/gcc" -DCMAKE_CXX_COMPILER="%{_builddir}/usr/bin/g++" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;BPF"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-rm /etc/ld.so.conf.d/usrLocalLib64.conf
-ldconfig
-
-mkdir build
-cd build
-cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER="%{_builddir}/usr/bin/gcc" -DCMAKE_CXX_COMPILER="%{_builddir}/usr/bin/g++"
-make -j`grep -c ^process /proc/cpuinfo`
-
-%install
-cd build
-make install/strip DESTDIR=%{buildroot}
-
-%changelog
-* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2
-- Initial RPM Release
-
-%package -n libbcc
-Summary: Shared Library for BPF Compiler Collection (BCC)
-%description -n libbcc
-Shared Library for BPF Compiler Collection (BCC)
-
-%package -n libbcc-examples
-Summary: Examples for BPF Compiler Collection (BCC)
-%description -n libbcc-examples
-Examples for BPF Compiler Collection (BCC)
-
-%package -n python-bcc
-Summary: Python bindings for BPF Compiler Collection (BCC)
-%description -n python-bcc
-Python bindings for BPF Compiler Collection (BCC)
-
-%files -n python-bcc
-%{python_sitelib}/bcc*
-%exclude %{python_sitelib}/*.egg-info
-
-%files -n libbcc
-/usr/lib64/*
-/usr/include/bcc/*
-
-%files -n libbcc-examples
-/usr/share/bcc/examples/*
diff --git a/SPECS/bcc.el7.spec b/SPECS/bcc.el7.spec
deleted file mode 100644 (file)
index 6a99d62..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-%define debug_package %{nil}
-%define llvmver 3.7.0
-
-Name:           bcc
-Version:        0.1.7
-Release:        1%{?dist}
-Summary:        BPF Compiler Collection (BCC)
-
-Group:          Development/Languages
-License:        ASL 2.0
-URL:            https://github.com/iovisor/bcc
-Source0:        https://github.com/iovisor/bcc/archive/v%{version}.tar.gz
-Source1:        http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz
-Source2:        http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz
-
-BuildArch:      x86_64
-BuildRequires:  bison, cmake >= 2.8.7, flex, gcc, gcc-c++, python2-devel
-
-%description
-Python bindings for BPF Compiler Collection (BCC). Control a BPF program from
-userspace.
-
-
-%prep
-%setup -T -b 1 -n llvm-%{llvmver}.src
-mkdir tools/clang
-tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1
-%setup -D -n bcc-%{version}
-
-%build
-
-export LD_LIBRARY_PATH="%{_builddir}/usr/lib64"
-export PATH="%{_builddir}/usr/bin":$PATH
-
-# build llvm
-pushd %{_builddir}/llvm-%{llvmver}.src
-mkdir build
-cd build
-../configure --disable-assertions --enable-optimized --prefix="%{_builddir}/usr"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-mkdir build
-pushd build
-cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr
-make -j`grep -c ^process /proc/cpuinfo`
-popd
-
-%install
-pushd build
-make install/strip DESTDIR=%{buildroot}
-
-%changelog
-* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2
-- Initial RPM Release
-
-%package -n libbcc
-Summary: Shared Library for BPF Compiler Collection (BCC)
-%description -n libbcc
-Shared Library for BPF Compiler Collection (BCC)
-
-%package -n libbcc-examples
-Summary: Examples for BPF Compiler Collection (BCC)
-%description -n libbcc-examples
-Examples for BPF Compiler Collection (BCC)
-
-%package -n python-bcc
-Summary: Python bindings for BPF Compiler Collection (BCC)
-%description -n python-bcc
-Python bindings for BPF Compiler Collection (BCC)
-
-%files -n python-bcc
-%{python_sitelib}/bcc*
-%exclude %{python_sitelib}/*.egg-info
-
-%files -n libbcc
-/usr/lib64/*
-/usr/include/bcc/*
-
-%files -n libbcc-examples
-/usr/share/bcc/examples/*
diff --git a/SPECS/bcc.el7.spec.in b/SPECS/bcc.el7.spec.in
deleted file mode 100644 (file)
index 32cd9a4..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-%define debug_package %{nil}
-%define llvmver 3.7.0
-
-Name:           bcc
-Version:        @REVISION_LAST@
-Release:        1%{?dist}
-Summary:        BPF Compiler Collection (BCC)
-
-Group:          Development/Languages
-License:        ASL 2.0
-URL:            https://github.com/iovisor/bcc
-Source0:        https://github.com/iovisor/bcc/archive/v%{version}.tar.gz
-Source1:        http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz
-Source2:        http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz
-
-BuildArch:      x86_64
-BuildRequires:  bison, cmake >= 2.8.7, flex, gcc, gcc-c++, python2-devel
-
-%description
-Python bindings for BPF Compiler Collection (BCC). Control a BPF program from
-userspace.
-
-
-%prep
-%setup -T -b 1 -n llvm-%{llvmver}.src
-mkdir tools/clang
-tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1
-%setup -D -n bcc-%{version}
-
-%build
-
-export LD_LIBRARY_PATH="%{_builddir}/usr/lib64"
-export PATH="%{_builddir}/usr/bin":$PATH
-
-# build llvm
-pushd %{_builddir}/llvm-%{llvmver}.src
-mkdir build
-cd build
-../configure --disable-assertions --enable-optimized --prefix="%{_builddir}/usr"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-mkdir build
-pushd build
-cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr
-make -j`grep -c ^process /proc/cpuinfo`
-popd
-
-%install
-pushd build
-make install/strip DESTDIR=%{buildroot}
-
-%changelog
-* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2
-- Initial RPM Release
-
-%package -n libbcc
-Summary: Shared Library for BPF Compiler Collection (BCC)
-%description -n libbcc
-Shared Library for BPF Compiler Collection (BCC)
-
-%package -n libbcc-examples
-Summary: Examples for BPF Compiler Collection (BCC)
-%description -n libbcc-examples
-Examples for BPF Compiler Collection (BCC)
-
-%package -n python-bcc
-Summary: Python bindings for BPF Compiler Collection (BCC)
-%description -n python-bcc
-Python bindings for BPF Compiler Collection (BCC)
-
-%files -n python-bcc
-%{python_sitelib}/bcc*
-%exclude %{python_sitelib}/*.egg-info
-
-%files -n libbcc
-/usr/lib64/*
-/usr/include/bcc/*
-
-%files -n libbcc-examples
-/usr/share/bcc/examples/*
diff --git a/SPECS/bcc.f22.spec b/SPECS/bcc.f22.spec
deleted file mode 100644 (file)
index 6a99d62..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-%define debug_package %{nil}
-%define llvmver 3.7.0
-
-Name:           bcc
-Version:        0.1.7
-Release:        1%{?dist}
-Summary:        BPF Compiler Collection (BCC)
-
-Group:          Development/Languages
-License:        ASL 2.0
-URL:            https://github.com/iovisor/bcc
-Source0:        https://github.com/iovisor/bcc/archive/v%{version}.tar.gz
-Source1:        http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz
-Source2:        http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz
-
-BuildArch:      x86_64
-BuildRequires:  bison, cmake >= 2.8.7, flex, gcc, gcc-c++, python2-devel
-
-%description
-Python bindings for BPF Compiler Collection (BCC). Control a BPF program from
-userspace.
-
-
-%prep
-%setup -T -b 1 -n llvm-%{llvmver}.src
-mkdir tools/clang
-tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1
-%setup -D -n bcc-%{version}
-
-%build
-
-export LD_LIBRARY_PATH="%{_builddir}/usr/lib64"
-export PATH="%{_builddir}/usr/bin":$PATH
-
-# build llvm
-pushd %{_builddir}/llvm-%{llvmver}.src
-mkdir build
-cd build
-../configure --disable-assertions --enable-optimized --prefix="%{_builddir}/usr"
-make -j`grep -c ^process /proc/cpuinfo`
-make install
-popd
-
-mkdir build
-pushd build
-cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr
-make -j`grep -c ^process /proc/cpuinfo`
-popd
-
-%install
-pushd build
-make install/strip DESTDIR=%{buildroot}
-
-%changelog
-* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2
-- Initial RPM Release
-
-%package -n libbcc
-Summary: Shared Library for BPF Compiler Collection (BCC)
-%description -n libbcc
-Shared Library for BPF Compiler Collection (BCC)
-
-%package -n libbcc-examples
-Summary: Examples for BPF Compiler Collection (BCC)
-%description -n libbcc-examples
-Examples for BPF Compiler Collection (BCC)
-
-%package -n python-bcc
-Summary: Python bindings for BPF Compiler Collection (BCC)
-%description -n python-bcc
-Python bindings for BPF Compiler Collection (BCC)
-
-%files -n python-bcc
-%{python_sitelib}/bcc*
-%exclude %{python_sitelib}/*.egg-info
-
-%files -n libbcc
-/usr/lib64/*
-/usr/include/bcc/*
-
-%files -n libbcc-examples
-/usr/share/bcc/examples/*
index 08e13fe..8937def 100644 (file)
@@ -1,8 +1,8 @@
 %define debug_package %{nil}
 
 Name:           bcc
-Version:        0.1.7
-Release:        1%{?dist}
+Version:        @REVISION@
+Release:        @GIT_REV_COUNT@
 Summary:        BPF Compiler Collection (BCC)
 
 Group:          Development/Languages
@@ -26,7 +26,7 @@ userspace.
 mkdir build
 pushd build
 cmake .. -DREVISION_LAST=%{version} -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr
-make -j`grep -c ^process /proc/cpuinfo`
+make %{?_smp_mflags}
 popd
 
 %install
diff --git a/scripts/build-release-rpm.sh b/scripts/build-release-rpm.sh
new file mode 100755 (executable)
index 0000000..26a039a
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+set -x
+set -e
+
+TMP=$(mktemp -d /tmp/rpmbuild.XXXXXX)
+
+function cleanup() {
+  [[ -d $TMP ]] && rm -rf $TMP
+}
+trap cleanup EXIT
+
+mkdir $TMP/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+
+llvmver=3.7.1
+# only the most recent tag
+git_tag_latest=$(git describe --abbrev=0)
+git_rev_count=$(git rev-list $git_tag_latest.. --count)
+release=0
+if [[ "$git_rev_count" != "0" ]]; then
+  release=$(git log --pretty='g%h' -n 1)
+fi
+revision=${git_tag_latest:1}
+
+git archive HEAD --prefix=bcc/ --format=tar.gz -o $TMP/SOURCES/$git_tag_latest.tar.gz
+wget -P $TMP/SOURCES http://llvm.org/releases/$llvmver/{cfe,llvm}-$llvmver.src.tar.xz
+
+sed \
+  -e "s/^\(Version:\s*\)@REVISION@/\1$revision/" \
+  -e "s/^\(Release:\s*\)@GIT_REV_COUNT@/\1$release/" \
+  SPECS/bcc+clang.spec > $TMP/SPECS/bcc.spec
+
+pushd $TMP
+rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.spec
+popd
+
+cp $TMP/RPMS/*/*.rpm .
+cp $TMP/SRPMS/*.rpm .
index 1f8728b..a6678fd 100755 (executable)
@@ -11,8 +11,24 @@ function cleanup() {
 trap cleanup EXIT
 
 mkdir $TMP/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+
+llvmver=3.7.1
+# only the most recent tag
+git_tag_latest=$(git describe --abbrev=0)
+git_rev_count=$(git rev-list $git_tag_latest.. --count)
+release=0
+if [[ "$git_rev_count" != "0" ]]; then
+  release=$(git log --pretty='g%h' -n 1)
+fi
+revision=${git_tag_latest:1}
+
 git archive HEAD --prefix=bcc/ --format=tar.gz -o $TMP/SOURCES/bcc.tar.gz
-cp SPECS/bcc.spec $TMP/SPECS/
+
+sed \
+  -e "s/^\(Version:\s*\)@REVISION@/\1$revision/" \
+  -e "s/^\(Release:\s*\)@GIT_REV_COUNT@/\1$release/" \
+  SPECS/bcc.spec > $TMP/SPECS/bcc.spec
+
 pushd $TMP
 rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.spec
 popd