Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions debian/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Dependencies you'll probably need to install to compile this: make, curl, git,
# zip, unzip, patch, java7-jdk | openjdk-7-jdk, maven.

SHELL=/bin/bash

ifndef VERSION
# Note that this is sensitive to this package's version being the first
# <version> tag in the pom.xml
VERSION=$(shell grep version pom.xml | head -n 1 | awk -F'>|<' '{ print $$3 }')
endif

ifndef SECURITY_SUFFIX
SECURITY_SUFFIX=
endif

export PACKAGE_TITLE=rest-utils
export FULL_PACKAGE_TITLE=confluent-rest-utils
export PACKAGE_NAME=$(FULL_PACKAGE_TITLE)-$(VERSION)$(SECURITY_SUFFIX)

# Whether we should apply patches. This only makes sense for alternate packaging
# systems that know how to apply patches themselves, e.g. Debian.
APPLY_PATCHES?=yes

# DESTDIR may be overriden by e.g. debian packaging
ifeq ($(DESTDIR),)
DESTDIR=$(CURDIR)/BUILD/
endif

ifeq ($(PACKAGE_TYPE),archive)
PREFIX=$(PACKAGE_NAME)
SYSCONFDIR=$(PREFIX)/etc/$(PACKAGE_TITLE)
else
PREFIX=/usr
SYSCONFDIR=/etc/$(PACKAGE_TITLE)
endif

# Whether we should run tests during the build.
SKIP_TESTS?=no

all: install


archive: install
rm -f $(CURDIR)/$(PACKAGE_NAME).tar.gz && cd $(DESTDIR) && tar -czf $(CURDIR)/$(PACKAGE_NAME).tar.gz $(PREFIX)
rm -f $(CURDIR)/$(PACKAGE_NAME).zip && cd $(DESTDIR) && zip -r $(CURDIR)/$(PACKAGE_NAME).zip $(PREFIX)

apply-patches: $(wildcard debian/patches/*)
ifeq ($(APPLY_PATCHES),yes)
git reset --hard HEAD
cat debian/patches/series | xargs -iPATCH bash -c 'patch -p1 < debian/patches/PATCH'
endif

build: apply-patches
ifeq ($(SKIP_TESTS),yes)
mvn -B -Dmaven.test.skip=true install
else
mvn -B install
endif

BINPATH=$(PREFIX)/bin
LIBPATH=$(PREFIX)/share/$(PACKAGE_TITLE)
DOCPATH=$(PREFIX)/share/doc/$(PACKAGE_TITLE)

INSTALL=install -D -m 644
INSTALL_X=install -D -m 755

install: build
rm -rf $(DESTDIR)$(PREFIX)
mkdir -p $(DESTDIR)$(PREFIX)
mkdir -p $(DESTDIR)$(BINPATH)
mkdir -p $(DESTDIR)$(LIBPATH)
mkdir -p $(DESTDIR)$(SYSCONFDIR)
pushd "package/target/rest-utils-package-$(VERSION)$(SECURITY_SUFFIX)-package" ; \
find . -type f | grep -v README[.]rpm | xargs -I XXX $(INSTALL) -o root -g root XXX $(DESTDIR)$(PREFIX)/XXX

clean:
rm -rf $(DESTDIR)
rm -rf $(CURDIR)/$(PACKAGE_NAME)*
rm -rf $(FULL_PACKAGE_TITLE)-$(RPM_VERSION)*rpm
rm -rf RPM_BUILDING

distclean: clean
git reset --hard HEAD
git status --ignored --porcelain | cut -d ' ' -f 2 | xargs rm -rf

test:

.PHONY: clean install

check:

debian-control:
@echo "Generating debian/control from debian/control.in with VERSION=$(DEB_VERSION)"
sed 's/##VERSION##/$(DEB_VERSION)/g' debian/control.in > debian/control
git add debian/control
git commit -m "Add control file."


RPM_VERSION=$(shell echo $(VERSION) | sed -e 's/-alpha[0-9]*//' -e 's/-beta[0-9]*//' -e 's/-rc[0-9]*//' -e 's/-SNAPSHOT//' -e 's/-cp[0-9]*//' -e 's/-hotfix[0-9]*//' -e 's/-[0-9]*//')
# Get any -alpha, -beta (preview), -rc (release candidate), -SNAPSHOT (nightly), -cp (confluent patch), -hotfix piece that we need to put into the Release part of
# the version since RPM versions don't support non-numeric
# characters. Ultimately, for something like 0.8.2-beta, we want to end up with
# Version=0.8.2 Release=0.X.beta
# where X is the RPM release # of 0.8.2-beta (the prefix 0. forces this to be
# considered earlier than any 0.8.2 final releases since those will start with
# Version=0.8.2 Release=1)
RPM_RELEASE_POSTFIX=$(subst -,,$(subst $(RPM_VERSION),,$(VERSION)))
ifneq ($(RPM_RELEASE_POSTFIX),)
RPM_RELEASE_POSTFIX_UNDERSCORE=_$(RPM_RELEASE_POSTFIX)
RPM_RELEASE_ID=0.$(REVISION).$(RPM_RELEASE_POSTFIX)
else
RPM_RELEASE_ID=$(REVISION)
endif



rpm: RPM_BUILDING/SOURCES/$(FULL_PACKAGE_TITLE)-$(RPM_VERSION).tar.gz
echo "Building the rpm"
rpmbuild --define="_topdir `pwd`/RPM_BUILDING" -tb $<
find RPM_BUILDING/{,S}RPMS/ -type f | xargs -n1 -iXXX mv XXX .
echo
echo "================================================="
echo "The rpms have been created and can be found here:"
@ls -laF $(FULL_PACKAGE_TITLE)*rpm
echo "================================================="

# Unfortunately, because of version naming issues and the way rpmbuild expects
# the paths in the tar file to be named, we need to rearchive the package. So
# instead of depending on archive, this target just uses the unarchived,
# installed version to generate a new archive. Note that we always regenerate
# the symlink because the RPM_VERSION doesn't include all the version info -- it
# can leave of things like -beta, -rc1, etc.
RPM_BUILDING/SOURCES/$(FULL_PACKAGE_TITLE)-$(RPM_VERSION).tar.gz: rpm-build-area install debian/$(FULL_PACKAGE_TITLE).spec.in RELEASE_$(RPM_VERSION)$(RPM_RELEASE_POSTFIX_UNDERSCORE)
rm -rf $(FULL_PACKAGE_TITLE)-$(RPM_VERSION)
mkdir $(FULL_PACKAGE_TITLE)-$(RPM_VERSION)
cp -R $(DESTDIR)/* $(FULL_PACKAGE_TITLE)-$(RPM_VERSION)
sed "s@##RPMVERSION##@$(RPM_VERSION)@g; s@##RPMRELEASE##@$(RPM_RELEASE_ID)@g" < debian/$(FULL_PACKAGE_TITLE).spec.in > $(FULL_PACKAGE_TITLE)-$(RPM_VERSION)/$(FULL_PACKAGE_TITLE).spec
rm -f $@ && tar -czf $@ $(FULL_PACKAGE_TITLE)-$(RPM_VERSION)
rm -rf $(FULL_PACKAGE_TITLE)-$(RPM_VERSION)

rpm-build-area: RPM_BUILDING/BUILD RPM_BUILDING/RPMS RPM_BUILDING/SOURCES RPM_BUILDING/SPECS RPM_BUILDING/SRPMS

RPM_BUILDING/%:
mkdir -p $@

RELEASE_%:
echo 0 > $@

check:
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
confluent-rest-utils (0.1~SNAPSHOT-1) unstable; urgency=low

* Initial release.

-- Confluent Packaging <packages@confluent.io> Tue, 30 Dec 2014 22:09:36 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
59 changes: 59 additions & 0 deletions debian/confluent-rest-utils.spec.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Summary: confluent-rest-utils are a small framework for building REST services with Jersey, Jackson, and Jetty
Name: confluent-rest-utils
Version: ##RPMVERSION##
Release: ##RPMRELEASE##
Group: Applications/Internet
License: Apache (v2)
Source0: confluent-rest-utils-%{version}.tar.gz
URL: http://confluent.io
BuildRoot: %{_tmpdir}/%{name}-%{version}-root
Vendor: Confluent, Inc.
Packager: Confluent Packaging <packages@confluent.io>
BuildArch: noarch

Requires: confluent-common = ##RPMVERSION##

%description

Confluent REST Utils provides a small framework and utilities for writing Java REST APIs using Jersey, Jackson, Jetty, and Hibernate Validator.

%define __jar_repack %{nil}

%pre

exit 0

%post

%preun

%postun

%prep

%setup

%build

%install

# Clean out any previous builds not on slash
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%{__mkdir_p} %{buildroot}
%{__cp} -R * %{buildroot}
# The spec file gets included, get rid of it
%{__rm} %{buildroot}/confluent-rest-utils.spec

%files
%defattr(-,root,root)
/usr/share/java/rest-utils
/usr/share/doc/rest-utils

%clean
#used to cleanup things outside the build area and possibly inside.
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%changelog
* Mon Dec 22 2014 Confluent Packaging <packages@confluent.io>
- Initial import
15 changes: 15 additions & 0 deletions debian/control.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Source: confluent-rest-utils
Section: misc
Priority: optional
Maintainer: Confluent Packaging <packages@confluent.io>
Build-Depends: debhelper (>= 9), javahelper (>= 0.40),
make, maven
Standards-Version: 3.9.3
Homepage: http://confluent.io

Package: confluent-rest-utils
Architecture: all
Depends: confluent-common (= ##VERSION##)
Description: Confluent utilities for writing Java REST APIs
Confluent REST Utils provides a small framework and utilities for writing Java
REST APIs using Jersey, Jackson, Jetty, and Hibernate Validator.
27 changes: 27 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: rest-utils
Source: https://github.com/confluentinc/rest-utils

Files: *
Copyright: 2014 Confluent, Inc.
License: Apache-2

Files: debian/*
Copyright: 2014 Confluent, Inc.
License: Apache-2

License: Apache-2
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 overning permissions and limitations under
the License.
.
On Debian systems, the Apache 2.0 license can be found in
/usr/share/common-licenses/Apache-2.0.
5 changes: 5 additions & 0 deletions debian/gbp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[DEFAULT]
upstream-tree=tag
upstream-tag=%(version)s
debian-tag=debian-%(version)s
debian-branch=debian-%(version)s
1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
standard_build_layout.patch
14 changes: 14 additions & 0 deletions debian/patches/standard_build_layout.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..3f83b80
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+clean:
+
+distclean:
+
+%:
+ cp debian/Makefile Makefile.debian
+ $(MAKE) -f Makefile.debian $@
+ rm -f Makefile.debian
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/make -f

%:
dh $@ --with javahelper
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)