Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from basho/jem-initial-refactor

Bring debian and rpm builds to proper spec and refactor basho-isms out
  • Loading branch information...
commit 37c8fdd008b51a4cac430ba5b80cb10b4a9877ce 2 parents 773c6ba + 4df4813
@jaredmorrow jaredmorrow authored
View
35 Makefile
@@ -0,0 +1,35 @@
+##
+## Export all variables to sub-invocation
+##
+export
+
+OS = $(shell uname -s)
+
+##
+## Support RPM and Debian based linux systems
+##
+ifeq ($(OS),Linux)
+ISRPM = $(shell cat /etc/redhat-release 2> /dev/null)
+ISDEB = $(shell cat /etc/debian_version 2> /dev/null)
+ifneq ($(ISRPM),)
+PKGERDIR = rpm
+else
+ifneq ($(ISDEB),)
+PKGERDIR = deb
+endif # deb
+endif # rpm
+endif # linux
+
+ifeq ($(OS),SunOS)
+PKGERDIR = solaris
+endif
+
+ifeq ($(OS),Darwin)
+PKGERDIR = osx
+endif
+
+.PHONY: ostype
+
+ostype:
+ $(if $(PKGERDIR),,$(error "Operating system '$(OS)' not supported by node_package"))
+ make -f $(PKG_ID)/deps/node_package/priv/templates/$(PKGERDIR)/Makefile.bootstrap
View
23 README.org
@@ -1,3 +1,24 @@
* node_package
** Overview
-node_package is a set of RPM/Debian/Solaris templates and scripts, suitable for packaging embedded Erlang nodes.
+node_package is a set of RPM/Debian/Solaris templates and scripts, suitable for packaging embedded Erlang nodes.
+** Variables
+The following variables describe a package
+*** Required Variables
+ * `package_name` - The name of the package
+ * `package_shortdesc` - A short (< one line) description of the package
+ * `package_install_name` - The name of the binary installed (can be different than the `package_name`)
+ * `package_install_user` - The user to create and run the daemon from
+ * `package_install_group` - The group to create and add the above user to
+ * `copyright` - The copyright holder (ex: 2011 Basho Technologies, Inc)
+ * `license_type` - The short desciption of what license the app is under
+ * `vendor_name` - The name of the person or company who is releasing this package
+ * `vendor_url` - The website of the person or company who is releasing this package
+ * `vendor_contact_name` - The name of the maintainer (ex: Basho Packaging)
+ * `vendor_contact_email` - The email address of the maintainer (ex: riak@basho.com)
+ * `solaris_pkgname` - Package names for Solaris follow a naming convention of MAINTapp (ex: BASHOriak)
+*** Optional Variables
+ * `license_full_text` - If the full text of a license needs to be included, use this variable
+ * `deb_depends` - Dependencies you require on deb sytems. This should be a comma separated list.
+ * `package_desc` - A long description of the package
+ * `solaris_depends` - (not supported yet) Dependencies specific to the solaris package
+ * `package_install_user_desc` - The description of the user created for the app
View
4 priv/base/env.sh
@@ -1,6 +1,8 @@
# -*- tab-width:4;indent-tabs-mode:nil -*-
# ex: ts=4 sw=4 et
+# installed by node_package (github.com/basho/node_package)
+
RUNNER_SCRIPT_DIR={{runner_script_dir}}
RUNNER_SCRIPT=${0##*/}
@@ -82,4 +84,4 @@ function node_up_check() {
echo "Node is not running!"
exit 1
fi
-}
+}
View
4 priv/base/erl
@@ -9,6 +9,8 @@
## Note that this script makes the assumption that there is a start_clean.boot
## file available in $ROOTDIR/release/VSN.
+## installed by node_package (github.com/basho/node_package)
+
# Determine the abspath of where this script is executing from.
ERTS_BIN_DIR=$(cd ${0%/*} && pwd)
@@ -31,4 +33,4 @@ export ROOTDIR
export BINDIR
export PROGNAME
-exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"}
+exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"}
View
2  priv/base/nodetool
@@ -5,6 +5,8 @@
%%
%% -------------------------------------------------------------------
+%% installed by node_package (github.com/basho/node_package)
+
main(Args) ->
%% Extract the args
{RestArgs, TargetNode} = process_args(Args, [], undefined),
View
2  priv/base/runner
@@ -2,6 +2,8 @@
# -*- tab-width:4;indent-tabs-mode:nil -*-
# ex: ts=4 sw=4 et
+# installed by node_package (github.com/basho/node_package)
+
# Pull environment for this install
source {{runner_bin_dir}}/lib/env.sh
View
7 priv/templates/deb/Makefile
@@ -1,11 +1,10 @@
default:
- export DEBFULLNAME="Basho Buildbot Packager"; \
- export DEBEMAIL="support@basho.com"; \
+ export DEBFULLNAME="{{vendor_contact_name}}"; \
+ export DEBEMAIL="{{vendor_contact_email}}"; \
dch --create --package {{package_name}} -v "$(PKG_VERSION)-$(PKG_BUILD)" \
"Build from $(PKG_VERSION)";\
- debuild --no-lintian \
- --prepend-path=$(ERLANG_BIN) \
+ debuild --prepend-path=$(ERLANG_BIN) \
-e REVISION=$(PKG_VERSION) \
-e RELEASE=$(PKG_BUILD) \
-e REBAR=$(REBAR) \
View
2  priv/templates/deb/Makefile.bootstrap
@@ -4,7 +4,7 @@
##
export
-default:
+bootstrap:
ln -s $(PKG_ID).tar.gz $(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
mkdir -p $(PKG_ID)/debian
cd $(PKG_ID)/debian && $(REBAR) -v create \
View
8 priv/templates/deb/control
@@ -1,14 +1,14 @@
Source: {{package_name}}
Section: net
Priority: extra
-Maintainer: Basho <support@basho.com>
+Maintainer: {{vendor_contact_name}} <{{vendor_contact_email}}>
Build-Depends: debhelper (>= 7)
-Standards-Version: 3.8.3
-Homepage: http://basho.com/
+Standards-Version: 3.9.2
+Homepage: {{vendor_url}}
Package: {{package_name}}
Architecture: any
-Depends: adduser, logrotate, ${shlibs:Depends}, ${misc:Depends}
+Depends: ${misc:Depends}, ${shlibs:Depends}, adduser, logrotate, sudo, {{deb_depends}}
Description: {{package_shortdesc}}
{{package_desc}}
View
8 priv/templates/deb/copyright
@@ -0,0 +1,8 @@
+Format: http://dep.debian.net/deps/dep5
+Upstream-Name: {{package_name}}
+Upstream-Contact: {{vendor_contact_name}} <{{vendor_contact_email}}>
+
+Files: *
+Copyright: {{copyright}}
+License: {{license_type}}
+ {{license_full_text}}
View
22 priv/templates/deb/deb.template
@@ -1,10 +1,20 @@
+%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%%
-%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%%
-{variables, [{package_name, "riak"},
- {package_install_name, "riak"},
- {package_install_user, "riak"},
- {package_install_group, "riak"}]}.
+{variables, [
+ {package_name, "package_name"},
+ {package_install_name, "package_install_name"},
+ {package_install_user, "package_install_user"},
+ {package_install_user_desc, "package_install_user_desc"},
+ {package_install_group, "package_install_group"},
+ {vendor_name, "vendor_name"},
+ {vendor_url, "vendor_url"},
+ {vendor_contact_name, "vendor_contact_name"},
+ {vendor_contact_email, "vendor_contact_email"},
+ {copyright, "copyright"},
+ {license_type, "license_type"},
+ {license_full_text, ""}
+ ]
+}.
{template, "Makefile", "Makefile"}.
{template, "compat", "compat"}.
{template, "control", "control"}.
View
6 priv/templates/deb/postinst
@@ -1,10 +1,12 @@
#!/bin/sh
-# postinst script for riak
+# postinst script for {{package_name}}
#
# see: dh_installdeb(1)
set -e
+# install startup script
+update-rc.d {{package_install_name}} defaults >/dev/null
# create group
if ! getent group {{package_install_group}} >/dev/null; then
@@ -17,7 +19,7 @@ if ! getent passwd {{package_install_user}} >/dev/null; then
--home /var/lib/{{package_install_name}} \
--disabled-password \
--system --shell /bin/bash --no-create-home \
- --gecos "Riak Data Store" {{package_install_user}}
+ --gecos "{{package_install_user_desc}}" {{package_install_user}}
fi
for i in lib run log; do
View
7 priv/templates/deb/postrm
@@ -1,5 +1,5 @@
#!/bin/sh
-# postrm script for riak
+# postrm script for {{package_name}}
#
# see: dh_installdeb(1)
@@ -17,10 +17,15 @@
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
+set -e
case "$1" in
purge)
rm -f /etc/default/{{package_install_name}}
+
+ # ensure we remove the rc.d scripts installed by postinst
+ update-rc.d {{package_install_name}} remove >/dev/null
+
if [ -d /var/lib/{{package_install_name}} ]; then
rm -r /var/lib/{{package_install_name}}
fi
View
25 priv/templates/deb/rules
@@ -6,13 +6,16 @@
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
+# modified for node_package by dizzyd@basho.com and jared@basho.com
+
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
-build:
- ## Clear variables that may confound our build of erlang_js; also
- ## note that it is necessary to use overlay_vars relative to .. as
- ## the generate command EXECUTES in rel/
+
+## Clear variables that may confound our build of sub-projects; also
+## note that it is necessary to use overlay_vars relative to .. as
+## the generate command EXECUTES in rel/
+build:
unset CC CFLAGS CPPFLAGS LDFLAGS CXX CXXFLAGS \
&& OVERLAY_VARS="overlay_vars=../debian/vars.config" make rel
touch build
@@ -22,6 +25,11 @@ clean:
rm -f build
make clean
+## TODO: Need to add a way to loop through a list of further things to install
+## like man pages and scripts -jared
+##
+## dh_shlibdeps was added to figure out the dependencies on shared libraries
+## and will populate the ${shlibs:Depends} callout in the control file
install: build
dh_testdir
dh_testroot
@@ -57,14 +65,11 @@ install: build
install -m755 debian/init.script \
debian/{{package_name}}/etc/init.d/{{package_install_name}}
- # install -p -D -m 0644 doc/man/man1/riak.1.gz \
- # debian/{{package_name}}/usr/share/man/man1/riak.1.gz
- # install -p -D -m 0644 doc/man/man1/riak-admin.1.gz \
- # debian/{{package_name}}/usr/share/man/man1/riak-admin.1.gz
- # chmod 555 debian/{{package_name}}/usr/lib/riak/lib/riak_jmx-*/priv/riak_jmx.sh
+ dh_shlibdeps
-binary-indep: install
# We have nothing to do by default.
+binary-indep: install build-stamp
+build-stamp:
# Build architecture-dependent files here.
binary-arch: install
View
2  priv/templates/deb/vars.config
@@ -1,5 +1,3 @@
-
-
{data_dir, "/var/lib/{{package_install_name}}"}.
{runner_script_dir, "/usr/sbin"}.
View
2  priv/templates/rpm/Makefile.bootstrap
@@ -4,7 +4,7 @@
##
export
-default:
+bootstrap:
$(REBAR) -v create \
package_name=$(PKG_NAME) \
template_dir=$(PKG_ID)/deps/node_package/priv/templates \
View
17 priv/templates/rpm/rpm.template
@@ -1,10 +1,19 @@
+%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%%
-%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%%
-{variables, [{package_name, "package_name"},
+{variables, [
+ {package_name, "package_name"},
{package_install_name, "package_install_name"},
{package_install_user, "package_install_user"},
- {package_install_group, "package_install_group"}]}.
+ {package_install_user_desc, "package_install_user_desc"},
+ {package_install_group, "package_install_group"},
+ {license_type, "license_type"},
+ {license_full_text, "license_full_text"},
+ {vendor_name, "vendor_name"},
+ {vendor_url, "vendor_url"},
+ {vendor_contact_name, "vendor_contact"},
+ {vendor_contact_email, "vendor_contact_email"}
+ ]
+}.
{template, "Makefile", "Makefile"}.
{template, "specfile", "specfile"}.
{template, "init.script", "init.script"}.
View
9 priv/templates/rpm/specfile
@@ -7,12 +7,12 @@
Name: {{package_name}}
Version: %{_version}
Release: %{_release}%{?dist}
-License: Proprietary
+License: {{license_type}}
Group: Development/Libraries
Source: %{name}-%{_revision}.tar.gz
-URL: http://basho.com
-Vendor: Basho Technologies
-Packager: Basho Technologies <support@basho.com>
+URL: {{vendor_url}}
+Vendor: {{vendor_name}}
+Packager: {{vendor_contact_name}} <{{vendor_contact_email}}>
BuildRoot: %{_tmppath}/%{name}-%{_revision}-%{release}-root
Summary: {{package_shortdesc}}
Obsoletes: {{package_name}}
@@ -91,6 +91,7 @@ if getent passwd {{package_install_user}} >/dev/null 2>&1; then
else
useradd -r -g {{package_install_group}} \
--home %{_localstatedir}/lib/{{package_install_name}} \
+ --comment "{{package_install_user_desc}}" \
{{package_install_user}}
fi
View
3  src/node_package.app.src
@@ -1,3 +1,6 @@
+%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ft=erlang ts=4 sw=4 et
+
{application, node_package,
[{description, "RPM/Debian/Solaris packaging templates for Erlang Nodes"},
{vsn, git},
Please sign in to comment.
Something went wrong with that request. Please try again.