diff --git a/.gitignore b/.gitignore index f47f50e..156508e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /node_modules *~ npm-debug.log +rpmbuild diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..79ca512 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +clean: + rm -rf node_modules rpmbuild + +npm: + npm install + +rpm: npm + scripts/rpmbuild.sh + +test: npm + npm test + +jenkins_build: clean npm test rpm diff --git a/scripts/browserid-certifier.spec b/scripts/browserid-certifier.spec new file mode 100644 index 0000000..31be8ca --- /dev/null +++ b/scripts/browserid-certifier.spec @@ -0,0 +1,44 @@ +%define _rootdir /opt/certifier + +Name: browserid-certifier +Version: 0.2012.05.25 +Release: 1%{?dist} +Summary: BrowserID Certifier +Packager: Pete Fritchman +Group: Development/Libraries +License: MPL 2.0 +URL: https://github.com/mozilla/browserid-certifier +Source0: %{name}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +AutoReqProv: no +Requires: openssl nodejs +BuildRequires: gcc-c++ git jre make npm openssl-devel expat-devel + +%description +BrowserID Certifier: process to sign certificates. + +%prep +%setup -q -c -n browserid-certifier + +%build +npm install +export PATH=$PWD/node_modules/.bin:$PATH + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}%{_rootdir} +for f in bin lib *.json; do + cp -rp $f %{buildroot}%{_rootdir}/ +done +mkdir -p %{buildroot}%{_rootdir}/config + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{_rootdir} + +%changelog +* Fri Jun 8 2012 Pete Fritchman +- Initial version diff --git a/scripts/rpmbuild.sh b/scripts/rpmbuild.sh new file mode 100755 index 0000000..3a9e352 --- /dev/null +++ b/scripts/rpmbuild.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +set -e + +progname=$(basename $0) + +cd $(dirname $0)/.. # top level of the checkout + +mkdir -p rpmbuild/SOURCES rpmbuild/SPECS rpmbuild/SOURCES +rm -rf rpmbuild/RPMS rpmbuild/SOURCES/browserid + +tar --exclude rpmbuild --exclude .git \ + --exclude var -czf \ + $PWD/rpmbuild/SOURCES/browserid-certifier.tar.gz . + +set +e + +export GIT_REVISION=$(git log -1 --oneline) + +rpmbuild --define "_topdir $PWD/rpmbuild" \ + -ba scripts/browserid-certifier.spec +rc=$? +if [ $rc -eq 0 ]; then + ls -l $PWD/rpmbuild/RPMS/*/*.rpm +else + echo "$progname: failed to build certifier RPM (rpmbuild rc=$rc)" >&2 +fi + +exit $rc