Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build RPMs and tarballs based on VERSION in Makefile #96

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
18 changes: 10 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/amazon-efs-utils*
!amazon-efs-utils.spec

*.gz
*.orig
*.out
*.pyc
*.spec
*\#*
*~
.DS_Store
.cache/
.coverage
.pytest_cache

*.pyc

/*efs-utils*/
__pycache__/
build/

.DS_Store
46 changes: 27 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,53 @@
#

PACKAGE_NAME = amazon-efs-utils
SOURCE_TARBALL = $(PACKAGE_NAME).tar.gz
VERSION = 1.31.1
SOURCE_TARBALL = $(PACKAGE_NAME)-$(VERSION).tar.gz
SPECFILE = $(PACKAGE_NAME).spec
BUILD_DIR = build/rpmbuild
export PYTHONPATH := $(shell pwd)/src

.PHONY: clean
clean:
rm -rf $(BUILD_DIR)
rm -rf $(PACKAGE_NAME)
rm -f $(SOURCE_TARBALL)
rm -rf $(PACKAGE_NAME)*/
rm -f *.gz

.PHONY: tarball
tarball: clean
mkdir -p $(PACKAGE_NAME)
mkdir -p $(PACKAGE_NAME)-$(VERSION)

mkdir -p $(PACKAGE_NAME)/dist
cp -p dist/amazon-efs-mount-watchdog.conf $(PACKAGE_NAME)/dist
cp -p dist/amazon-efs-mount-watchdog.service $(PACKAGE_NAME)/dist
cp -p dist/efs-utils.conf $(PACKAGE_NAME)/dist
cp -p dist/efs-utils.crt $(PACKAGE_NAME)/dist
mkdir -p $(PACKAGE_NAME)-$(VERSION)/dist
cp -p dist/amazon-efs-mount-watchdog.conf $(PACKAGE_NAME)-$(VERSION)/dist
cp -p dist/amazon-efs-mount-watchdog.service $(PACKAGE_NAME)-$(VERSION)/dist
cp -p dist/efs-utils.conf $(PACKAGE_NAME)-$(VERSION)/dist
cp -p dist/efs-utils.crt $(PACKAGE_NAME)-$(VERSION)/dist

mkdir -p $(PACKAGE_NAME)/src
cp -rp src/mount_efs $(PACKAGE_NAME)/src
cp -rp src/watchdog $(PACKAGE_NAME)/src
mkdir -p $(PACKAGE_NAME)-$(VERSION)/src
cp -rp src/mount_efs $(PACKAGE_NAME)-$(VERSION)/src
cp -rp src/watchdog $(PACKAGE_NAME)-$(VERSION)/src

mkdir -p ${PACKAGE_NAME}/man
cp -rp man/mount.efs.8 ${PACKAGE_NAME}/man
mkdir -p ${PACKAGE_NAME}-$(VERSION)/man
cp -rp man/mount.efs.8 ${PACKAGE_NAME}-$(VERSION)/man

tar -czf $(SOURCE_TARBALL) $(PACKAGE_NAME)/*
tar -czf $(SOURCE_TARBALL) $(PACKAGE_NAME)-$(VERSION)/*

.PHONY: sources
sources: tarball

.PHONY: $(SPECFILE)
$(SPECFILE):
mkdir -p dist
sed 's/^Version:.*/Version: $(VERSION)/g' $(SPECFILE) > dist/$(SPECFILE)

.PHONY: rpm-only
rpm-only:
rpm-only:: $(TARBALL)
rpm-only:: $(SPECFILE)
mkdir -p $(BUILD_DIR)/{SPECS,COORD_SOURCES,DATA_SOURCES,BUILD,RPMS,SOURCES,SRPMS}
cp $(SPECFILE) $(BUILD_DIR)/SPECS
cp $(SOURCE_TARBALL) $(BUILD_DIR)/SOURCES
rpmbuild -ba --define "_topdir `pwd`/$(BUILD_DIR)" $(BUILD_DIR)/SPECS/$(SPECFILE)
rpmbuild -ba \
--define "_topdir `pwd`/$(BUILD_DIR)" \
--define '_sourcedir $(PWD)' \
dist/$(SPECFILE)
cp $(BUILD_DIR)/RPMS/*/*rpm build

.PHONY: rpm
Expand Down
18 changes: 9 additions & 9 deletions amazon-efs-utils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,34 @@ Requires(preun) : /sbin/service /sbin/chkconfig
Requires(postun) : /sbin/service
%endif

Source : %{name}.tar.gz
Source : %{name}-%{version}.tar.gz

%description
This package provides utilities for simplifying the use of EFS file systems

%prep
%setup -n %{name}
%setup -n %{name}-%{version}

%install
mkdir -p %{buildroot}%{_sysconfdir}/amazon/efs
%if %{with_systemd}
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 %{_builddir}/%{name}/dist/amazon-efs-mount-watchdog.service %{buildroot}%{_unitdir}
install -p -m 644 dist/amazon-efs-mount-watchdog.service %{buildroot}%{_unitdir}
%else
mkdir -p %{buildroot}%{_sysconfdir}/init
install -p -m 644 %{_builddir}/%{name}/dist/amazon-efs-mount-watchdog.conf %{buildroot}%{_sysconfdir}/init
install -p -m 644 dist/amazon-efs-mount-watchdog.conf %{buildroot}%{_sysconfdir}/init
%endif

mkdir -p %{buildroot}/sbin
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_localstatedir}/log/amazon/efs
mkdir -p %{buildroot}%{_mandir}/man8

install -p -m 644 %{_builddir}/%{name}/dist/efs-utils.conf %{buildroot}%{_sysconfdir}/amazon/efs
install -p -m 444 %{_builddir}/%{name}/dist/efs-utils.crt %{buildroot}%{_sysconfdir}/amazon/efs
install -p -m 755 %{_builddir}/%{name}/src/mount_efs/__init__.py %{buildroot}/sbin/mount.efs
install -p -m 755 %{_builddir}/%{name}/src/watchdog/__init__.py %{buildroot}%{_bindir}/amazon-efs-mount-watchdog
install -p -m 644 %{_builddir}/%{name}/man/mount.efs.8 %{buildroot}%{_mandir}/man8
install -p -m 644 dist/efs-utils.conf %{buildroot}%{_sysconfdir}/amazon/efs
install -p -m 444 dist/efs-utils.crt %{buildroot}%{_sysconfdir}/amazon/efs
install -p -m 755 src/mount_efs/__init__.py %{buildroot}/sbin/mount.efs
install -p -m 755 src/watchdog/__init__.py %{buildroot}%{_bindir}/amazon-efs-mount-watchdog
install -p -m 644 man/mount.efs.8 %{buildroot}%{_mandir}/man8

%files
%defattr(-,root,root,-)
Expand Down