Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. SHELL := /bin/bash
  2. VERSION := $(shell /usr/bin/env python2 -c 'from S3 import PkgInfo;print PkgInfo.version')
  3. SPEC := s3cmd.spec
  4. COMMIT := $(shell git rev-parse HEAD)
  5. SHORTCOMMIT := $(shell git rev-parse --short=8 HEAD)
  6. TARBALL = s3cmd-$(VERSION)-$(SHORTCOMMIT).tar.gz
  7. release:
  8. python2 setup.py register sdist upload --sign
  9. clean:
  10. -rm -rf s3cmd-*.tar.gz *.rpm *~ $(SPEC)
  11. -find . -name \*.pyc -exec rm \{\} \;
  12. -find . -name \*.pyo -exec rm \{\} \;
  13. $(SPEC): $(SPEC).in
  14. sed -e 's/##VERSION##/$(VERSION)/' \
  15. -e 's/##COMMIT##/$(COMMIT)/' \
  16. -e 's/##SHORTCOMMIT##/$(SHORTCOMMIT)/' \
  17. $(SPEC).in > $(SPEC)
  18. # fixme: python setup.py sdist also generates a PKG-INFO file which we don't have using straight git archive
  19. git-tarball:
  20. git archive --format tar --prefix s3cmd-$(COMMIT)/ HEAD S3/ s3cmd NEWS README.md LICENSE INSTALL.md setup.cfg s3cmd.1 setup.py| gzip -c > $(TARBALL)
  21. # Use older digest algorithms for local rpmbuilds, as EPEL5 and
  22. # earlier releases need this. When building using mock for a
  23. # particular target, it will use the proper (newer) digests if that
  24. # target supports it.
  25. git-rpm: clean git-tarball $(SPEC)
  26. tmp_dir=`mktemp -d` ; \
  27. mkdir -p $${tmp_dir}/{BUILD,RPMS,SRPMS,SPECS,SOURCES} ; \
  28. cp $(TARBALL) $${tmp_dir}/SOURCES ; \
  29. cp $(SPEC) $${tmp_dir}/SPECS ; \
  30. cd $${tmp_dir} > /dev/null 2>&1; \
  31. rpmbuild -ba --define "_topdir $${tmp_dir}" \
  32. --define "_source_filedigest_algorithm 0" \
  33. --define "_binary_filedigest_algorithm 0" \
  34. --define "dist %{nil}" \
  35. SPECS/$(SPEC) ; \
  36. cd - > /dev/null 2>&1; \
  37. cp $${tmp_dir}/RPMS/noarch/* $${tmp_dir}/SRPMS/* . ; \
  38. rm -rf $${tmp_dir} ; \
  39. rpmlint *.rpm *.spec