SPECS/edgex/edgex.spec
ceaef34a
 %global security_hardening nopie
 %define debug_package %{nil}
 %define __os_install_post %{nil}
 Summary:        EdgeX Foundry Go Services
 Name:           edgex
 Version:        0.6.0
a1224fe9
 Release:        2%{?dist}
ceaef34a
 License:        Apache-2.0
 URL:            https://github.com/edgexfoundry/edgex-go
 Group:          Applications/System
 Vendor:         VMware, Inc.
 Distribution:   Photon
 # Wait for official release. For now use git archive to createa tarball:
 # git config tar.tar.xz.command "xz -c"
 # git archive -o edgex-0.6.0-1261522.tar.xz HEAD
 Source0:	edgex-0.6.0-1261522.tar.xz
 %define sha1 edgex=b91017f85e263af8a7b2e49282c3dbb0048f5b67
 # glide installed dependencies all in one tarball generated by:
 # tar -cJf glide-tarball-for-edgex-0.6.0-1261522.tar.xz vendor/ glide.lock
 Source1:	glide-tarball-for-edgex-0.6.0-1261522.tar.xz
 %define sha1 glide-tarball-for-edgex=0f4926ccd32f9db6a69d51db77dc84cad65f5b35
 Source2:	core-config-seed-go-0.6.0-a45a3a8.tar.xz
 %define sha1 core=0fa76e0fbc2ae12649f3fbdf2f26e83aa261bb64
 Source3:	glide-tarball-for-core-config-seed-go-0.6.0-a45a3a8.tar.xz
 %define sha1 glide-tarball-for-core=c04b619026be35221ee0500ea0fc30bf18ba3fea
 Source4:	edgex-template.service
 Source5:	edgex-core-config-seed.service
 # Origin https://github.com/edgexfoundry/developer-scripts
 Source6:	init_mongo.js
 
 BuildRequires:  go >= 1.9
 BuildRequires:  make
 BuildRequires:  systemd-devel
 BuildRequires:  zeromq-devel
 Requires:       systemd
 Requires:       consul
 
 %description
 EdgeX Foundry Go Services
 
 %prep
 %setup -c -T -a 0 -n src/github.com/edgexfoundry/edgex-go
 %setup -D -c -T -a 1 -n src/github.com/edgexfoundry/edgex-go
 %setup -D -c -T -a 2 -n src/github.com/edgexfoundry/core-config-seed-go
 %setup -D -c -T -a 3 -n src/github.com/edgexfoundry/core-config-seed-go
 
 %build
 cd %{_builddir}/src/github.com/edgexfoundry/edgex-go
 GOPATH=%{_builddir} make build %{?_smp_mflags}
 
 cd %{_builddir}/src/github.com/edgexfoundry/core-config-seed-go
 GOPATH=%{_builddir} make build %{?_smp_mflags}
 
 %install
 # edgex-go
 cd %{_builddir}/src/github.com/edgexfoundry/edgex-go
 
 install -d -m755 %{buildroot}%{_bindir}
 install -d -m755 %{buildroot}%{_datadir}/%{name}
 install -d -m755 %{buildroot}%{_libdir}/systemd/system
 
 # install binary
 for srv in core-command core-data core-metadata export-client export-distro support-logging ; do
 install -p -m755 cmd/${srv}/${srv} %{buildroot}%{_bindir}/edgex-${srv}
 install -d -m755 %{buildroot}%{_datadir}/%{name}/${srv}/res
 install -p -m644 cmd/${srv}/res/configuration.toml %{buildroot}%{_datadir}/%{name}/${srv}/res/configuration.toml
 # workdir for the service
 install -d -m755 %{buildroot}%{_var}/log/%{name}/${srv}
 ln -s %{_datadir}/%{name}/${srv}/res %{buildroot}%{_var}/log/%{name}/${srv}/res
 
 sed "s/SERVICE_NAME/${srv}/" %{SOURCE4} > %{buildroot}%{_libdir}/systemd/system/edgex-${srv}.service
 done
 
 # core-config-seed-go
 cd %{_builddir}/src/github.com/edgexfoundry/core-config-seed-go
 install -p -m755 core-config-seed-go %{buildroot}%{_bindir}/edgex-core-config-seed
 install -d -m755 %{buildroot}%{_datadir}/%{name}/core-config-seed/res
 install -p -m644 res/configuration.toml %{buildroot}%{_datadir}/%{name}/core-config-seed/res/configuration.toml
 install -p -m644 res/banner.txt %{buildroot}%{_datadir}/%{name}/core-config-seed/res/banner.txt
 cp -a config %{buildroot}%{_datadir}/%{name}/core-config-seed/
 install -p -m644 %{SOURCE5} %{buildroot}%{_libdir}/systemd/system/`basename %{SOURCE5}`
 
 # init mongo script
 install -d -m755 %{buildroot}%{_datadir}/%{name}/scripts/
 install -p -m644 %{SOURCE6} %{buildroot}%{_datadir}/%{name}/scripts/`basename %{SOURCE6}`
 
 %files
 %defattr(-,root,root)
 %{_bindir}/*
 %{_datadir}/*
 %{_libdir}/*
 %{_var}/log/*
 
 %changelog
a1224fe9
 *   Wed Dec 05 2018 Alexey Makhalov <amakhalov@vmware.com> 0.6.0-2
 -   Remove 'Requires: mongodb'. But edgex still depends on mongo.
ceaef34a
 *   Fri Jul 06 2018 Alexey Makhalov <amakhalov@vmware.com> 0.6.0-1
 -   Initial version