diff --git a/debian/Makefile b/debian/Makefile new file mode 100644 index 0000000000..897b7a9c74 --- /dev/null +++ b/debian/Makefile @@ -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 +# 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: diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000..2fc21946ce --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +confluent-rest-utils (0.1~SNAPSHOT-1) unstable; urgency=low + + * Initial release. + + -- Confluent Packaging Tue, 30 Dec 2014 22:09:36 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/confluent-rest-utils.spec.in b/debian/confluent-rest-utils.spec.in new file mode 100644 index 0000000000..2af127cfd4 --- /dev/null +++ b/debian/confluent-rest-utils.spec.in @@ -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 +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 +- Initial import diff --git a/debian/control.in b/debian/control.in new file mode 100644 index 0000000000..3f5d866a76 --- /dev/null +++ b/debian/control.in @@ -0,0 +1,15 @@ +Source: confluent-rest-utils +Section: misc +Priority: optional +Maintainer: Confluent Packaging +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. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000..bb281777b6 --- /dev/null +++ b/debian/copyright @@ -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. diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000000..e91d7a3127 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,5 @@ +[DEFAULT] +upstream-tree=tag +upstream-tag=%(version)s +debian-tag=debian-%(version)s +debian-branch=debian-%(version)s diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000..16970d16ba --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +standard_build_layout.patch diff --git a/debian/patches/standard_build_layout.patch b/debian/patches/standard_build_layout.patch new file mode 100644 index 0000000000..2d96aebd82 --- /dev/null +++ b/debian/patches/standard_build_layout.patch @@ -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 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000..df489df8e3 --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ --with javahelper diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt)