| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- ##
- ## postgraphql.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2016 OpenPKG Foundation e.V. <http://openpkg.net/>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # package version
- %define V_postgraphql 1.8.1
- %define V_postgraphql_dist 1.8.1
- %define V_postgraphql_snap 20160731
- # package information
- Name: postgraphql
- Summary: GraphSQL Frontend Service to PostgreSQL RDBMS
- URL: https://github.com/calebmer/postgraphql
- Vendor: Sebastian McKenzie
- Packager: OpenPKG Foundation e.V.
- Distribution: OpenPKG Community
- Class: EVAL
- Group: Language
- License: MIT
- Version: %{V_postgraphql}
- Release: 20160731
- # list of sources
- Source0: http://download.openpkg.org/components/versioned/postgraphql/postgraphql-%{V_postgraphql_dist}-%{V_postgraphql_snap}.tar.xz
- Source1: rc.postgraphql
- # build information
- BuildPreReq: OpenPKG, openpkg >= 20160101
- PreReq: OpenPKG, openpkg >= 20160101, node
- %description
- PostGraphQL is a frontend service to the PostgreSQL RDBMS. It
- provides a GraphQL schema created by reflection over a PostgreSQL
- schema.
- %track
- prog postgraphql:dist = {
- version = %{V_postgraphql_dist}
- url = https://github.com/calebmer/postgraphql/releases
- regex = v(\d+\.\d+\.\d+)\.tar\.gz
- }
- prog postgraphql:snap = {
- version = %{V_postgraphql_snap}
- url = http://download.openpkg.org/components/versioned/postgraphql/
- regex = postgraphql-\d+\.\d+\.\d+-(\d+)\.tar\.xz
- }
- %prep
- %setup -q -c
- %build
- # prune files
- find . -name example -type d -print | xargs rm -rf
- find . -name test -type d -print | xargs rm -rf
- find . -name .npmignore -type f -print | xargs rm -f
- find . -name LICENCE -type f -print | xargs rm -f
- find . -name LICENSE -type f -print | xargs rm -f
- find . -name LICENSE.txt -type f -print | xargs rm -f
- find . -name LICENSE.md -type f -print | xargs rm -f
- find . -name license.md -type f -print | xargs rm -f
- find . -name license -type f -print | xargs rm -f
- find . -name CHANGELOG.md -type f -print | xargs rm -f
- find . -name README -type f -print | xargs rm -f
- find . -name README.md -type f -print | xargs rm -f
- find . -name readme.md -type f -print | xargs rm -f
- find . -name .travis.yml -type f -print | xargs rm -f
- find . -name .jshintrc -type f -print | xargs rm -f
- %install
- # create installation hierarchy
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/bin \
- $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
- $RPM_BUILD_ROOT%{l_prefix}/lib/postgraphql \
- $RPM_BUILD_ROOT%{l_prefix}/var/postgraphql/run \
- $RPM_BUILD_ROOT%{l_prefix}/var/postgraphql/log
- # install program
- cp -rp \
- node_modules/* \
- $RPM_BUILD_ROOT%{l_prefix}/lib/postgraphql/
- # create executable wrapper
- ( echo "#!/bin/sh"
- echo "NODE_PATH=%{l_prefix}/lib/postgraphql; export NODE_PATH"
- echo "exec %{l_prefix}/bin/node %{l_prefix}/lib/postgraphql/postgraphql/dist/main.js \${1+\"\$@\"}"
- ) >postgraphql
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
- postgraphql $RPM_BUILD_ROOT%{l_prefix}/bin/postgraphql
- # install run-command script
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
- %{SOURCE rc.postgraphql} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # determine installation files
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
- %{l_files_std} \
- '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/postgraphql/*'
- %files -f files
- %clean
- %post
- # after upgrade, restart service
- [ $1 -eq 2 ] || exit 0
- eval `%{l_rc} postgraphql status 2>/dev/null`
- [ ".$postgraphql_active" = .yes ] && %{l_rc} postgraphql restart
- exit 0
- %preun
- # before erase, stop service and remove log files
- [ $1 -eq 0 ] || exit 0
- %{l_rc} postgraphql stop 2>/dev/null
- rm -f $RPM_INSTALL_PREFIX/var/postgraphql/log/* >/dev/null 2>&1 || true
- rm -f $RPM_INSTALL_PREFIX/var/postgraphql/run/* >/dev/null 2>&1 || true
- exit 0
|