Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Add an RPM specfile #333

Merged
merged 8 commits into from
Jul 4, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions extras/rpms/glusterd.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
localstatedir = "/var/lib/glusterd2"
logdir = "/var/log/glusterd2"
logfile = "glusterd2.log"
peeraddress = ":24008"
clientaddress = ":24007"
81 changes: 81 additions & 0 deletions extras/rpms/glusterd2.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
%global _dwz_low_mem_die_limit 0

%global provider github
%global provider_tld com
%global project gluster
%global repo glusterd2
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}

Name: %{repo}
Version: 4.0dev
Release: 7
Summary: The GlusterFS management daemon (preview)
License: GPLv2 or LGPLv3+
URL: https://%{provider_prefix}
Source0: https://%{provider_prefix}/archive/%{version}-%{release}/%{name}-%{version}-%{release}.tar.gz
Source1: glusterd.toml

ExclusiveArch: x86_64

BuildRequires: golang >= 1.8.0
BuildRequires: glide >= 0.12.0
BuildRequires: git
BuildRequires: mercurial
BuildRequires: systemd

Requires: glusterfs-server >= 3.11.0
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

%description
Preview release of the next generation GlusterFS management framework and daemon, coming with GlusterFS-4.0

%prep
%setup -q -n %{name}-%{commit}

%build
mkdir -p src/%(dirname %{import_path})
ln -s ../../../ src/%{import_path}

pushd src/%{import_path}
# Install vendored packages
# TODO: See if we can build with unbundled packages
make vendor-install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be as part of make dist. Good if we can avoid network calls during RPM/packaging create.

This is fine for current release, we can take care of this issue later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea. I'll do this next time. Makes is easier to do a release.

# Build glusterd2
make glusterd2
popd

%install
#Install glusterd2 binary
install -D -p -m 0755 build/%{name} %{buildroot}%{_bindir}/%{name}
#Install systemd unit
install -D -p -m 0644 extras/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
#Install glusterd config into etc
install -d -m 0755 %{buildroot}%{_sysconfdir}/glusterd
install -m 0644 -t %{buildroot}%{_sysconfdir}/glusterd %{SOURCE1}
# Create /var/lib/glusterd2
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{name}
# logdir
install -d -m 0755 %{buildroot}%{_localstatedir}/log/%{name}

%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun %{name}.service

%files
%{_bindir}/%{name}
%config(noreplace) %{_sysconfdir}/glusterd
%{_unitdir}/%{name}.service
%dir %{_sharedstatedir}/%{name}
%dir %{_localstatedir}/log/%{name}

%changelog
* Mon Jul 03 2017 Kaushal M <[email protected]> - 4.0dev-7
- Initial spec
14 changes: 14 additions & 0 deletions extras/systemd/glusterd2.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=GlusterD2, the management service for GlusterFS (pre-release)
Requires=rpcbind.service
After=network.target rpcbind.service
Before=network-online.target
Conflicts=glusterd.service

[Service]
Type=forking
ExecStart=/usr/sbin/glusterd2
KillMode=process

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fi
GOBUILD_TAGS="novirt noaugeas "
VERSION=$($(dirname $0)/pkg-version --full)
LDFLAGS="-X github.com/gluster/glusterd2/gdctx.GlusterdVersion=$VERSION"
LDFLAGS+=" -B 0x$(head -c20 /dev/urandom | od -An -tx1 | tr -d ' \n')"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, this would make the builds un-reproducible. As a result, maybe best to avoid doing this. More info here: https://reproducible-builds.org/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fedora requires this though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@purpleidea I was also looking for this sometime back and Go doesn't officially support reproducible builds yet.

@kshlm We should base build id based on git sha-1 eventually. https://fedoraproject.org/wiki/PackagingDrafts/Go#Build_ID

BIN=$(basename $(go list -f '{{.ImportPath}}'))

if [ "$PLUGINS" == "yes" ]; then
Expand Down