Skip to content

Commit

Permalink
Update for new relase code
Browse files Browse the repository at this point in the history
  • Loading branch information
Licenser committed Sep 4, 2017
1 parent e197466 commit 8ce19b5
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 77 deletions.
28 changes: 3 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
APP=fifo_zlogin
include config.mk
REBAR = $(shell pwd)/rebar3

.PHONY: deps rel package quick-test tree dist
.PHONY: deps rel quick-test tree

uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_V6 := $(shell sh -c 'uname -v 2>/dev/null | cut -c-6 || echo not')
Expand All @@ -23,27 +25,3 @@ version:

version_header: version
@echo "-define(VERSION, <<\"$(shell cat fifo_zlogin.version)\">>)." > apps/fifo_zlogin/src/fifo_zlogin_version.hrl

dist: ${PLATFORM} ;

package: rel
make -C rel/pkg package

freebsd: update ${PLATFORM}/rel
gmake -C rel/pkgng package

freebsd/rel: apps/fifo_zlogin/priv/runpty version_header
$(REBAR) as prod release

smartos: update ${PLATFORM}/rel
make -C rel/bootstrap bootstrap

smartos/rel: apps/fifo_zlogin/priv/runpty version_header compile
-rm -r ./rel/fifo_zlogin/share
$(REBAR) as prod release


clean:
$(REBAR) clean
make -C rel/bootstrap clean
make -C rel/pkgng clean
2 changes: 1 addition & 1 deletion apps/fifo_zlogin/src/fifo_zlogin.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, 'fifo_zlogin',
[{description, "FiFo zlogin server"},
{vsn, "0.9.2"},
{vsn, "0.9.3"},
{registered, []},
{mod, {'fifo_zlogin_app', []}},
{applications,
Expand Down
3 changes: 3 additions & 0 deletions config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VERSION=0.9.3
COMPONENT_INTERNAL=fifo_zlogin
COMPONENT=fifo_zlogin
104 changes: 99 additions & 5 deletions fifo.mk
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
REBAR = $(shell pwd)/rebar3
REBAR_VSN = $(shell erl -noshell -eval '{ok, F} = file:consult("rebar.config"), [{release, {_, Vsn}, _}] = [O || {relx, [O | _]} <- F], io:format("~s", [Vsn]), init:stop().')
VARS_VSN = $(shell grep 'bugsnag_app_version' rel/vars.config | sed -e 's/.*,//' -e 's/[^0-9.p]//g' -e 's/[.]$$//')
APP_VSN = $(shell grep vsn apps/$(APP)/src/$(APP).app.src | sed 's/[^0-9.p]//g')

include config.mk

compile: $(REBAR) .git/hooks/pre-commit
$(REBAR) compile

.git/hooks/pre-commit: hooks/pre-commit
cp hooks/pre-commit .git/hooks
[ -f .git/hooks ] && cp hooks/pre-commit .git/hooks || true

pre-commit: lint xref dialyzer test
pre-commit: test-scripts test-vsn lint xref dialyzer test

dialyzer: $(REBAR)
$(REBAR) dialyzer

xref: $(REBAR)
$(REBAR) xref

test-scripts:
for i in rel/files/*; do (head -1 $$i | grep -v sh > /dev/null) || bash -n $$i || exit 1; done;

test: $(REBAR)
$(REBAR) eunit

Expand All @@ -24,21 +32,107 @@ $(REBAR):
cp `which rebar3` $(REBAR)

upgrade: $(REBAR)
$(REBAR) upgrade
make tree
$(REBAR) upgrade
$(MAKE) tree

update: $(REBAR)
$(REBAR) update

tree: $(REBAR)
rebar.lock: rebar.config $(REBAR)
$(REBAR) compile

tree: $(REBAR) rebar.lock
$(REBAR) tree | grep -v '=' | sed 's/ (.*//' > tree

tree-diff: tree
git diff test -- tree

update-fifo.mk:
cp _build/default/lib/fifo_utils/priv/fifo.mk .

###
### Packaging
###

uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_V6 := $(shell sh -c 'uname -v 2>/dev/null | cut -c-6 || echo not')

ifeq ($(uname_S),Darwin)
PLATFORM = darwin
REBARPROFILE = darwin
export REBARPROFILE
endif
ifeq ($(uname_S),FreeBSD)
PLATFORM = freebsd
REBARPROFILE = freebsd
export REBARPROFILE
endif
ifeq ($(uname_V6),joyent)
PLATFORM = smartos
REBARPROFILE = smartos
export REBARPROFILE
endif

dist: ${PLATFORM} ;

generic/rel: version_header
$(REBAR) as ${REBARPROFILE} compile
$(REBAR) as ${REBARPROFILE} release

freebsd: ${PLATFORM}/rel
$(MAKE) -C rel/pkgng package

smartos: ${PLATFORM}/rel
$(MAKE) -C rel/pkg package

darwin: ${PLATFORM}/rel

freebsd/rel: generic/rel

smartos/rel: generic/rel

darwin/rel: generic/rel

dist-help:
@echo "FiFo dist tool"
@echo "You are running this on: ${PLATFORM}"
@echo
@echo "Currently supported platforms are: FreeBSD, SmartOS, Darwin/OSX"
@echo
@echo "SmartOS:"
@echo " rebar profile: smartos $(shell if grep profiles -A12 rebar.config | grep smartos > /dev/null; then echo OK; else echo MISSING; fi)"
@echo " packaging makefile: rel/pkg/Makefile $(shell if [ -f rel/pkg/Makefile ]; then echo OK; else echo MISSING; fi)"
@echo "FreeBSD:"
@echo " rebar profile: freebsd $(shell if grep profiles -A12 rebar.config | grep freebsd > /dev/null; then echo OK; else echo MISSING; fi)"
@echo " packaging makefile: rel/pkgng/Makefile $(shell if [ -f rel/pkgng/Makefile ]; then echo OK; else echo MISSING; fi)"
@echo "Darwin:"
@echo " rebar profile: darwin $(shell if grep profiles -A12 rebar.config | grep darwin > /dev/null; then echo OK; else echo MISSING; fi)"
@echo " packaging makefile: - no packaing -"

###
### Docs
###
docs:
$(REBAR) edoc

###
### Version
###

build-vsn:
@echo "$(REBAR_VSN)"
vsn:
@echo "## Config:"
@echo "$(VERSION)"
@echo "## apps/$(APP)/src/$(APP).app.src"
@echo "$(APP_VSN)"
@echo "## rebar.config"
@echo "$(REBAR_VSN)"
@echo "## rel/vars.config"
@echo "$(VARS_VSN)"

test-vsn:
@echo "Testing against package version: $(VERSION)"
@[ "$(VERSION)" = "$(APP_VSN)" ] && echo " - App version ok: $(APP_VSN)" || (echo "App version out of date" && false)
@[ "$(VERSION)" = "$(REBAR_VSN)" ] && echo " - Rebar version ok: $(PKG_VSN)" || (echo "Package version out of date" && false)
@[ "$(VERSION)" = "$(VARS_VSN)" ] && echo " - Vars version ok: $(VARS_VSN)" || (echo "Vars version out of date" && false)
10 changes: 7 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
]}.

{relx,
[{release, {fifo_zlogin, "0.9.2"},
[{release, {fifo_zlogin, "0.9.3"},
['fifo_zlogin',
sasl]},

Expand All @@ -19,8 +19,12 @@
]}.

{profiles,
[{prod, [{relx, [{dev_mode, false},
[{darwin, [{relx, [{dev_mode, false},
{include_erts, true}]}]},
{lint, [{plugins, [{rebar3_lint, {git, "https://github.com/project-fifo/rebar3_lint.git", {tag, "0.1.4"}}}]}]}
{smartos, [{relx, [{dev_mode, false},
{include_erts, true}]}]},
{freebsd, [{relx, [{dev_mode, false},
{include_erts, true}]}]},
{lint, [{plugins, [rebar3_lint]}]}
]
}.
28 changes: 14 additions & 14 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{"1.1.0",
[{<<"fifo_utils">>,{pkg,<<"fifo_utils">>,<<"0.1.29">>},0},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.8">>},2},
{<<"jsone">>,{pkg,<<"jsone">>,<<"1.4.0">>},1},
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.8.1">>},0},
{<<"lager">>,{pkg,<<"lager">>,<<"3.2.1">>},1},
{<<"quickrand">>,{pkg,<<"quickrand">>,<<"1.5.4">>},2},
{<<"uuid">>,{pkg,<<"uuid_erl">>,<<"1.5.4">>},1}]}.
[{<<"fifo_utils">>,{pkg,<<"fifo_utils">>,<<"0.1.48">>},0},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},2},
{<<"jsone">>,{pkg,<<"jsone">>,<<"1.4.5">>},1},
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.8.2">>},0},
{<<"lager">>,{pkg,<<"lager">>,<<"3.5.1">>},1},
{<<"quickrand">>,{pkg,<<"quickrand">>,<<"1.7.1">>},1},
{<<"uuid">>,{pkg,<<"uuid_erl">>,<<"1.7.1">>},1}]}.
[
{pkg_hash,[
{<<"fifo_utils">>, <<"9BDFFB8CEA376755FEB91D6A4D7A8DC7CC3C8B180CDD28624F8A6334059D26E3">>},
{<<"goldrush">>, <<"2024BA375CEEA47E27EA70E14D2C483B2D8610101B4E852EF7F89163CDB6E649">>},
{<<"jsone">>, <<"6ECFD2C91E16F48E1535743B57D01A42C65D7DD51A8B43E5723B1F79927169A8">>},
{<<"jsx">>, <<"1453B4EB3615ACB3E2CD0A105D27E6761E2ED2E501AC0B390F5BBEC497669846">>},
{<<"lager">>, <<"EEF4E18B39E4195D37606D9088EA05BF1B745986CF8EC84F01D332456FE88D17">>},
{<<"quickrand">>, <<"47ADD4755CC5F209CBEFFD6F47C84061196CD7FAD99FD8FD12418EB0D06B939D">>},
{<<"uuid">>, <<"06240EFF3EAF013CC22274689B0C1FF6345645EE5D47A9E4ED7545EEB7698B23">>}]}
{<<"fifo_utils">>, <<"140BC3EE5D8687DF8CD5C1C16F1CB739EE34826F546B874CF874BF671F498A00">>},
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"jsone">>, <<"547AEFEC1C67FE3283F77BAC4DAF85F3F593002764F768FAAA423875A51A2320">>},
{<<"jsx">>, <<"7ACC7D785B5ABE8A6E9ADBDE926A24E481F29956DD8B4DF49E3E4E7BCC92A018">>},
{<<"lager">>, <<"63897A61AF646C59BB928FEE9756CE8BDD02D5A1A2F3551D4A5E38386C2CC071">>},
{<<"quickrand">>, <<"B0C2A41D08C955F055C44BED357660DE443CD9068A33ABA530076910B7333659">>},
{<<"uuid">>, <<"252D12D1154BC75C40BC03E2E67714BD843DDFAD40FD3BC1541F65F622C9E7FC">>}]}
].
8 changes: 4 additions & 4 deletions rel/bootstrap/Makefile → rel/pkg/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
VERSION=0.9.2
COMPONENT=fifo_zlogin
include ../../config.mk

SUFFIX:=$(shell echo $(SUFFIX))
BASENAME:=$(COMPONENT)-$(VERSION)$(SUFFIX)
.PHONY: bootstrap clean
.PHONY: package clean

clean:
-rm *.gz

bootstrap:
package:
cp install.sh $(BASENAME)
cp -r ../../_build/prod/rel/$(COMPONENT) $(COMPONENT)
-mkdir -p $(COMPONENT)/share/lib
Expand Down
File renamed without changes.
21 changes: 4 additions & 17 deletions rel/pkgng/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
VERSION=0.9.2
COMPONENT_INTERNAL=fifo_zlogin
INSTALL_DIR=usr
DEPS="coreutils" "sudo"
REBARPROFILE ?= default

include pkgng.mk
include ../../config.mk
include ../../_build/${REBARPROFILE}/lib/fifo_utils/priv/pkgng.mk

.PHONY: package prepare clean
.PHONY: prepare

prepare:
-rm -r $(STAGE_DIR)
Expand All @@ -14,16 +14,3 @@ prepare:
rm -rf $(STAGE_DIR)/$(INSTALL_DIR)/lib/*/c_src
mkdir -p $(STAGE_DIR)/etc/rc.d
cp ../freebsd/zlogin $(STAGE_DIR)/etc/rc.d/

package: prepare dep_list package_list
cat +MANIFEST deplist > $(STAGE_DIR)/+MANIFEST
cp plist $(STAGE_DIR)/
cp +POST_INSTALL $(STAGE_DIR)/
pkg create -m $(STAGE_DIR)/ -r $(STAGE_DIR) -o .
#-p $(STAGE_DIR)/plist

clean: clean-pkg
-rm -rf deploy
-rm *.tgz
-rm plist
-rm deplist
1 change: 1 addition & 0 deletions rel/vars.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{bugsnag_app_version, "0.9.3"}.
16 changes: 8 additions & 8 deletions tree
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
├─ fifo_utils─0.1.29
│ ├─ jsone─1.4.0
│ ├─ lager─3.2.1
│ │ └─ goldrush─0.1.8
└─ uuid─1.5.4
└─ quickrand─1.5.4
├─ fifo_zlogin─0.1.1
└─ jsx─2.8.1
├─ fifo_utils─0.1.48
│ ├─ jsone─1.4.5
│ ├─ lager─3.5.1
│ │ └─ goldrush─0.1.9
├─ quickrand─1.7.1
│ └─ uuid─1.7.1
├─ fifo_zlogin─0.9.2
└─ jsx─2.8.2

0 comments on commit 8ce19b5

Please sign in to comment.