diff --git a/.gitignore b/.gitignore index dee5c091..2792ec67 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Makefile b/Makefile index fd48bfc1..6406196e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,8 @@ # 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 @@ -15,37 +16,44 @@ 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 diff --git a/amazon-efs-utils.spec b/amazon-efs-utils.spec index 53152ebf..251c63f1 100644 --- a/amazon-efs-utils.spec +++ b/amazon-efs-utils.spec @@ -60,22 +60,22 @@ 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 @@ -83,11 +83,11 @@ 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,-)