Skip to content

Commit

Permalink
Merge pull request #109 from salcock/develop
Browse files Browse the repository at this point in the history
Extend packaging to include RPMs, plus prepare for 4.0.7 release
  • Loading branch information
salcock authored May 14, 2019
2 parents 772dd30 + 8d8846a commit b4c8ba1
Show file tree
Hide file tree
Showing 21 changed files with 312 additions and 12 deletions.
42 changes: 42 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,48 @@ build-amd64-ubuntu-cosmic:
only:
- tags

build-amd64-fedora-29:
stage: build
image: fedora:29
script:
- ./gitlab-build-rpm.sh fedora29
- mkdir -p built-packages/fedora_29/
- mv ~/rpmbuild/RPMS/x86_64/*.rpm built-packages/fedora_29/
artifacts:
paths:
- built-packages/*
expire_in: 1 day
only:
- tags

build-amd64-fedora-30:
stage: build
image: fedora:30
script:
- ./gitlab-build-rpm.sh fedora30
- mkdir -p built-packages/fedora_30/
- mv ~/rpmbuild/RPMS/x86_64/*.rpm built-packages/fedora_30/
artifacts:
paths:
- built-packages/*
expire_in: 1 day
only:
- tags

build-amd64-centos7:
stage: build
image: centos:7
script:
- ./gitlab-build-rpm.sh centos7
- mkdir -p built-packages/centos_7/
- mv ~/rpmbuild/RPMS/x86_64/*.rpm built-packages/centos_7/
artifacts:
paths:
- built-packages/*
expire_in: 1 day
only:
- tags

upload-packages:
stage: upload
image: ubuntu:bionic
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
libtrace 4.0.6
libtrace 4.0.7

---------------------------------------------------------------------------
Copyright (c) 2007-2019 The University of Waikato, Hamilton, New Zealand.
Expand Down
37 changes: 33 additions & 4 deletions bintray-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

set -e -o pipefail

BINTRAY_REPO="wand/libtrace"
BINTRAY_DEB_REPO="wand/libtrace"
BINTRAY_RPM_REPO="wand/libtrace-rpm"
BINTRAY_LICENSE="LGPL-3.0"

apt-get update && apt-get install -y curl
Expand All @@ -26,9 +27,37 @@ EOF
for path in `find built-packages/ -maxdepth 1 -type d`; do
IFS=_ read linux_version <<< $(basename "${path}")
for deb in `find "${path}" -maxdepth 1 -type f`; do
ext=${deb##*.}
pkg_filename=$(basename "${deb}")
IFS=_ read pkg_name pkg_version pkg_arch <<< $(basename -s ".deb" "${pkg_filename}")
jfrog bt package-create --licenses ${BINTRAY_LICENSE} --vcs-url ${CI_PROJECT_URL} ${BINTRAY_REPO}/${pkg_name} || true
jfrog bt upload --deb ${linux_version}/main/${pkg_arch} ${deb} ${BINTRAY_REPO}/${pkg_name}/${pkg_version} pool/${linux_version}/main/${pkg_name}/

if [ "$ext" = "deb" ]; then
IFS=_ read pkg_name pkg_version pkg_arch <<< $(basename -s ".deb" "${pkg_filename}")
jfrog bt package-create --licenses ${BINTRAY_LICENSE} --vcs-url ${CI_PROJECT_URL} ${BINTRAY_DEB_REPO}/${pkg_name} || true
jfrog bt upload --deb ${linux_version}/main/${pkg_arch} ${deb} ${BINTRAY_DEB_REPO}/${pkg_name}/${pkg_version} pool/${linux_version}/main/${pkg_name}/
fi

if [ "$ext" = "rpm" ]; then
rev_filename=`echo ${pkg_filename} | rev`

if [[ ${linux_version} =~ centos_* ]]; then
# centos
pkg_dist="centos"

else
# fedora
pkg_dist="fedora"
fi

pkg_name=`echo ${rev_filename} | cut -d '-' -f3- | rev`
pkg_version=`echo ${rev_filename} | cut -d '-' -f1-2 | rev | cut -d '.' -f1-3`
pkg_arch=`echo ${rev_filename} | cut -d '.' -f2 | rev`
pkg_rel=`echo ${rev_filename} | cut -d '.' -f3 | rev`
releasever="${pkg_rel:2}"


jfrog bt package-create --licenses ${BINTRAY_LICENSE} --vcs-url ${CI_PROJECT_URL} ${BINTRAY_RPM_REPO}/${pkg_name} || true
jfrog bt upload ${deb} ${BINTRAY_RPM_REPO}/${pkg_name}/${pkg_version} ${pkg_dist}/${releasever}/${pkg_arch}/

fi
done
done
4 changes: 2 additions & 2 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Now you only need to update the version number in two places - below,
# and in the README

AC_INIT([libtrace],[4.0.6],[contact@wand.net.nz],[libtrace])
AC_INIT([libtrace],[4.0.7],[contact@wand.net.nz],[libtrace])

LIBTRACE_MAJOR=4
LIBTRACE_MID=0
LIBTRACE_MINOR=6
LIBTRACE_MINOR=7

# OpenSolaris hides libraries like libncurses in /usr/gnu/lib, which is not
# searched by default - add it to LDFLAGS so we at least have a chance of
Expand Down
9 changes: 9 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
libtrace4 (4.0.7-1) unstable; urgency=medium

* New upstream release.
* Added new API for exploring in-stream meta-data records.
* Added new API for inspecting subsequent layer-2 headers.
* Added support for reading and writing TZSP sniffing streams.

-- Shane Alcock <shane.alcock@waikato.ac.nz> Thu, 02 May 2019 16:31:15 +1200

libtrace4 (4.0.6-2) unstable; urgency=low

* Fix bad dpdk dependencies in libtrace4 package
Expand Down
67 changes: 67 additions & 0 deletions gitlab-build-rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
set -x -e -o pipefail

export QA_RPATHS=$[ 0x0001 ]
SOURCENAME=`echo ${CI_COMMIT_REF_NAME} | cut -d '-' -f 1`


DISTRO=fedora
if [ "$1" = "centos7" ]; then
DISTRO=centos
fi

if [ "$1" = "centos6" ]; then
DISTRO=centos
fi

cat << EOF > /etc/yum.repos.d/bintray-wand-general-rpm.repo
#bintray-wand-general-rpm - packages by wand from Bintray
[bintray-wand-general-rpm]
name=bintray-wand-general-rpm
baseurl=https://dl.bintray.com/wand/general-rpm/${DISTRO}/\$releasever/\$basearch/
gpgkey=https://bintray.com/user/downloadSubjectPublicKey?username=wand
gpgcheck=0
repo_gpgcheck=1
enabled=1
EOF

cat << EOF > /etc/yum.repos.d/bintray-wand-libtrace-rpm.repo
#bintray-wand-libtrace-rpm - packages by wand from Bintray
[bintray-wand-libtrace-rpm]
name=bintray-wand-libtrace-rpm
baseurl=https://dl.bintray.com/wand/libtrace-rpm/${DISTRO}/\$releasever/\$basearch/
gpgkey=https://bintray.com/user/downloadSubjectPublicKey?username=wand
gpgcheck=0
repo_gpgcheck=1
enabled=1
EOF

yum install -y wget make gcc

if [ "$1" = "centos7" ]; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm || true
fi

if [ "$1" = "centos6" ]; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm || true
yum install -y epel-rpm-macros
fi


if [[ "$1" =~ fedora* ]]; then
dnf install -y rpm-build rpmdevtools 'dnf-command(builddep)' which
dnf group install -y "C Development Tools and Libraries"
dnf builddep -y rpm/libtrace4.spec
else
yum install -y rpm-build yum-utils rpmdevtools which
yum groupinstall -y 'Development Tools'
yum-builddep -y rpm/libtrace4.spec
fi

rpmdev-setuptree

./bootstrap.sh && ./configure && make dist
cp libtrace-*.tar.gz ~/rpmbuild/SOURCES/${SOURCENAME}.tar.gz
cp rpm/libtrace4.spec ~/rpmbuild/SPECS/

cd ~/rpmbuild && rpmbuild -bb --define "debug_package %{nil}" SPECS/libtrace4.spec

6 changes: 4 additions & 2 deletions gitlab-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ apt-get install -y equivs devscripts dpkg-dev quilt curl apt-transport-https \

echo "deb https://dl.bintray.com/wand/general $(lsb_release -sc) main" | \
tee -a /etc/apt/sources.list.d/wand.list
curl "https://bintray.com/user/downloadSubjectPublicKey?username=wand" \
-o /etc/apt/trusted.gpg.d/wand.gpg
echo "deb https://dl.bintray.com/wand/libtrace $(lsb_release -sc) main" | \
tee -a /etc/apt/sources.list.d/wand.list
curl --silent "https://bintray.com/user/downloadSubjectPublicKey?username=wand"\
| apt-key add -

apt-get update
apt-get upgrade -y
Expand Down
4 changes: 2 additions & 2 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ libtrace_la_SOURCES = trace.c trace_parallel.c common.h \
data-struct/buckets.c data-struct/simple_circular_buffer.c \
combiner_sorted.c combiner_unordered.c \
pthread_spinlock.c pthread_spinlock.h \
strndup.c
strndup.c format_pcapng.h format_tzsplive.h

if DAG2_4
nodist_libtrace_la_SOURCES = dagopts.c dagapi.c
endif

AM_CPPFLAGS= @ADD_INCLS@
libtrace_la_LIBADD = @LIBTRACE_LIBS@ @LTLIBOBJS@ $(DPDKLIBS)
libtrace_la_LDFLAGS=-version-info @LIBTRACE_MAJOR@:@LIBTRACE_MINOR@:@LIBTRACE_MID@ @ADD_LDFLAGS@
libtrace_la_LDFLAGS=-version-info 5:0:1 @ADD_LDFLAGS@
dagapi.c:
cp @DAG_TOOLS_DIR@/dagapi.c .

Expand Down
2 changes: 2 additions & 0 deletions lib/data-struct/simple_circular_buffer.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <sys/mman.h>
#include <stdlib.h>
Expand Down
2 changes: 2 additions & 0 deletions lib/format_atmhdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
*
*
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "config.h"
#include "common.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/format_dag25.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
*
*
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "config.h"
#include "common.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/format_dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
* RT-speaking programs.
*/

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "config.h"
#include "libtrace.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/format_erf.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
*
*/

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "config.h"
#include "common.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/format_etsilive.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
*
*/

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "config.h"
#include "common.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/format_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
*
*
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "config.h"
#include "common.h"
Expand Down
3 changes: 2 additions & 1 deletion lib/format_ndag.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
*
*/


#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "config.h"
#include "common.h"
Expand Down
3 changes: 3 additions & 0 deletions lib/format_pcapng.c
Original file line number Diff line number Diff line change
Expand Up @@ -2070,11 +2070,13 @@ static libtrace_meta_datatype_t pcapng_get_datatype(uint32_t section, uint32_t o
case(PCAPNG_META_IF_TSOFFSET): return TRACE_META_UINT64;
case(PCAPNG_META_IF_HARDWARE): return TRACE_META_STRING;
}
break;
case(PCAPNG_OLD_PACKET_TYPE):
switch(option) {
case(PCAPNG_META_OLD_FLAGS): return TRACE_META_UINT32;
case(PCAPNG_META_OLD_HASH): return TRACE_META_STRING;
}
break;
case(PCAPNG_SIMPLE_PACKET_TYPE):
/* simple packets should not contain any options */
return TRACE_META_UNKNOWN;
Expand All @@ -2090,6 +2092,7 @@ static libtrace_meta_datatype_t pcapng_get_datatype(uint32_t section, uint32_t o
case(PCAPNG_META_EPB_HASH): return TRACE_META_STRING;
case(PCAPNG_META_EPB_DROPCOUNT): return TRACE_META_UINT64;
}
break;
case(PCAPNG_DECRYPTION_SECRETS_TYPE):
/* todo - needs to handle decryption secrets options along with
* normal options */
Expand Down
2 changes: 2 additions & 0 deletions lib/format_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
*
*/

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include "config.h"
#include "common.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
*
*/

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "common.h"
#include "config.h"
#include <assert.h>
Expand Down
2 changes: 2 additions & 0 deletions lib/trace_parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
*
*/

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "common.h"
#include "config.h"
#include <assert.h>
Expand Down
Loading

0 comments on commit b4c8ba1

Please sign in to comment.