"Fossies" - the Fresh Open Source Software Archive

Member "conspy-1.16/Makefile.release" (19 Aug 2020, 9242 Bytes) of package /linux/privat/conspy-1.16.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Makefile.release": 1.14_vs_1.16.

    1 #
    2 # Do a release.
    3 #
    4 # This is file is identical for _all_ sourceforge projects I host.  It is
    5 # designed to one thing: automate my sourceforce work flow.  Be warned that
    6 # I will selfishly reject any patches that don't do that.
    7 #
    8 # It does the following:
    9 # 
   10 # 1.  Verifies the changelogs have been updated to a consistent version.
   11 #
   12 # 2.  Updates the verison numbers and copyright dates in all source files.
   13 #
   14 # 3.  Builds the source tarball.
   15 #
   16 # 4.  Builds the debian source and binary packages.
   17 #
   18 # 5.  If there is a .spec file, buids the rpm source and binary
   19 #     packages.
   20 #
   21 # 6.  Sends the released files (tarball, debian and rpm packages) to the
   22 #     release area.
   23 #
   24 # 7.  Sends the HTML file, and other files references by it, to the web
   25 #     site.
   26 #
   27 # Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020 Russell Stuart.
   28 # Licensed (at your choice) under GPLv2, or any later version,
   29 # or AGPL-3.0+, or any later version.
   30 #
   31 RELEASE_ME=$(shell sed -n '1s/ .*//p' ChangeLog.txt)
   32 RELEASE_PACKAGE_NAME=$(shell echo "$(RELEASE_ME)" | sed 's/-[^-]*$$//')
   33 RELEASE_VERSION=$(shell echo "$(RELEASE_ME)" | sed 's/.*-//')
   34 RELEASE_YEAR=$(shell date +%Y)
   35 RELEASE_MONTH=$(shell date +%b)
   36 RELEASE_DATE=$(shell date +%Y-%m-%d)
   37 RELEASE_DEBIAN_VERSION=$(shell sed -n 's/[^(]*(\([^)]*\)).*/\1/p;q' debian/changelog)
   38 
   39 RELEASE_DIR=release.tmp
   40 RELEASE_HTDOCS=$(RELEASE_DIR)/htdocs
   41 RELEASE_FILES=$(RELEASE_DIR)/$(RELEASE_PACKAGE_NAME)-$(RELEASE_DEBIAN_VERSION)
   42 
   43 .PHONY: release
   44 release:	$(RELEASE_DIR)/release.stamp
   45 $(RELEASE_DIR)/release.stamp: $(RELEASE_SOURCES)
   46 	@echo ME=$(RELEASE_ME) PACKAGE=$(RELEASE_PACKAGE_NAME) VERSION=$(RELEASE_VERSION) YEAR=$(RELEASE_YEAR) MONTH=$(RELEASE_MONTH) DATE=$(RELEASE_DATE) DEBIAN_VERSION=$(RELEASE_DEBIAN_VERSION)
   47 	#
   48 	# Ensure the Debian changelog matches this version.
   49 	#
   50 	debian_version="$(RELEASE_DEBIAN_VERSION)"; [ "$(RELEASE_PACKAGE_NAME)-$${debian_version%-*}" = "$(RELEASE_ME)" ] || \
   51 	  { echo 1>&2 "debian/changelog: changelog is out of date."; exit 1; }
   52 	$(MAKE) release-clean
   53 	#
   54 	# Check changes have reflected in mercurial.
   55 	#
   56 	! hg status | grep '^?' || { echo "hg add hasn't been done" 1>&2; exit 1; }
   57 	! hg status | grep '^!' || { echo "hg rm hasn't been done" 1>&2; exit 1; }
   58 	[ -z "$$(hg resolv --list | grep -v ^R)" ] || { echo "There are unresolved merge conflicts" 1>&2; exit 1; }
   59 
   60 	#
   61 	# Update all the version numbers and dates.
   62 	#
   63 	set -e; for f in $(wildcard *.1); do \
   64 	  sed -i "s/^\([.].\" Copyright (c) \)2[0-9]*/\1$(RELEASE_YEAR)/" "$${f}"; \
   65 	  sed -i "s/^\([.]TH [A-Z]* 1 \"\)[^\"]*\(\".*Version[ 	]\+\)[1-9][0-9]*[.][0-9]\+/\1$(RELEASE_MONTH) $(RELEASE_YEAR)\2$(RELEASE_VERSION)/" "$${f}"; \
   66 	done
   67 	set -e; for f in $$(find . -name "*.c" -o -name "*.h"); do \
   68 	  sed -i "/$(RELEASE_YEAR)/!s/\(Copyright (c) [-0-9, ]*2[0-9]*\)\(,\? *Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" "$${f}"; \
   69 	  sed -i "s/^\(static.*_version..[ 	]*=[ 	]*\"\)[^\"]*/\1$(RELEASE_VERSION)/" "$${f}"; \
   70 	  sed -i "s/^\(static.*_date..[ 	]*=[ 	]*\"\)[^\"]*/\1$(RELEASE_DATE)/" "$${f}"; \
   71 	done
   72 	set -e; for f in $$(find . -name "*.py"); do \
   73 	  sed -i 's/^\(VERSION[ 	]*=[ 	]*"\)[^ "]*/\1$(RELEASE_VERSION)/' $${f}; \
   74 	  sed -i 's/^\(VERSION[ 	]*=[ 	]*"[^ ]* \+\)[^"]*/\1$(RELEASE_DATE)/' $${f}; \
   75 	done
   76 	set -e; for f in $$(find . -name "*.rst" -o -name "*.py" -o -name "Makefile*") README.txt; do \
   77 	  sed -i "/$(RELEASE_YEAR)/!s/\(Copyright (c) [-0-9, ]*2[0-9]*\)\(,\? *Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" "$${f}"; \
   78 	done
   79 	set -e; for f in $$(find . -name "setup.py"); do \
   80 	  sed -i 's/^\([ 	]*version="\)[0-9]\+[.][0-9.]\+/\1$(RELEASE_VERSION)/' "$${f}"; \
   81 	done
   82 ifneq ($(wildcard $(RELEASE_PACKAGE_NAME).spec),)
   83 	sed -i "s/\(Version:[ 	]\+\)[0-9]\+[.][0-9.]\+/\1$(RELEASE_VERSION)/" "$(RELEASE_PACKAGE_NAME).spec"
   84 endif
   85 ifneq ($(wildcard configure.ac),)
   86 	sed -i "s/\(AC_INIT(\[\?$(RELEASE_PACKAGE_NAME)\]\?, *\[\?\)[0-9]\+[.][0-9.]\+/\1$(RELEASE_VERSION)/" configure.ac
   87 endif
   88 ifneq ($(wildcard doc/conf.py),)
   89 	sed -i "/$(RELEASE_YEAR)/!s/^\( *copyright *= *u'[-0-9, ]*2[0-9]*\)\(,\?[ ]*Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" doc/conf.py
   90 	sed -i "s/^\( *\(version\|release\) *= *u\?'\)[0-9]\+[.][0-9.]\+'/\1$(RELEASE_VERSION)'/" doc/conf.py
   91 endif
   92 	sed -i "/$(RELEASE_YEAR)/!s/\(.* is copyright © [-0-9, ]*2[0-9]*\)\(,\?[ ]*Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" "$(RELEASE_PACKAGE_NAME).html"
   93 	sed -i "s/$(RELEASE_PACKAGE_NAME)-[1-9][0-9]*[.][0-9]\+/$(RELEASE_ME)/g" "$(RELEASE_PACKAGE_NAME).html"
   94 	sed -i "/$(RELEASE_YEAR)/!s/\(Copyright (c) [-0-9, ]*2[0-9]*\)\(,\? *Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" README.txt
   95 	#
   96 	# Do any custom stuff.
   97 	#
   98 	$(MAKE) release-customise
   99 	#
  100 	# Build the release source tarball.
  101 	#
  102 	(set -exv; d="$${PWD##*/}" && sd=$$(echo "$$d" | sed 's/\./[.]/g') && cd .. &&  tar cfz "$(RELEASE_PACKAGE_NAME)_$(RELEASE_VERSION).orig.tar.gz" --exclude="$${d}/debian" --exclude="$${d}/.hg*" --exclude-vcs --transform "s;^$${sd}\(/\|\$$\);$(RELEASE_ME)\1;" "$${d}")
  103 	#
  104 	# Insert the debian packates into the release.
  105 	#
  106 	DEBIAN_KERNEL_USE_CCACHE="yes" debuild --preserve-env --preserve-envvar="PATH" -k0xF5231C62E7843A8C -sa --lintian-opts --info --display-info --display-experimental --suppress-tags debian-rules-contains-unnecessary-get-orig-source-target,no-dh-sequencer
  107 	mkdir -p "$(RELEASE_FILES)"
  108 	rm ../$(RELEASE_PACKAGE_NAME)_$(RELEASE_DEBIAN_VERSION)_*.build
  109 	set -xve; mv $$(sed -n '1,/^Files:/d;/^$$/q;s:.* :../:p' ../$(RELEASE_PACKAGE_NAME)_$(RELEASE_DEBIAN_VERSION)_*.changes) ../$(RELEASE_PACKAGE_NAME)_$(RELEASE_DEBIAN_VERSION)_*.changes $(RELEASE_FILES)
  110 	mv "$(RELEASE_FILES)/$(RELEASE_PACKAGE_NAME)_$(RELEASE_VERSION).orig.tar.gz" "$(RELEASE_FILES)/$(RELEASE_ME).tar.gz"
  111 ifneq ($(wildcard $(RELEASE_PACKAGE_NAME).spec),)
  112 	#
  113 	# Build the RPM package.
  114 	#
  115 	mkdir -p "$(RELEASE_DIR)/rpm/BUILD"
  116 	mkdir -p "$(RELEASE_DIR)/rpm/RPMS"
  117 	mkdir -p "$(RELEASE_DIR)/rpm/SOURCES"
  118 	mkdir -p "$(RELEASE_DIR)/rpm/SPECS"
  119 	mkdir -p "$(RELEASE_DIR)/rpm/SRPMS"
  120 	echo >"$(RELEASE_DIR)/rpm/rpmmacros" "%_topdir $(PWD)/$(RELEASE_DIR)/rpm"
  121 	TAR_OPTIONS=--wildcards rpmbuild -ta --macros "/usr/lib/rpm/macros:/usr/lib/rpm/platform/$(shell dpkg-architecture -qDEB_HOST_GNU_CPU)-$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)linux/macros:/usr/lib/rpm/platform/noarch-$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)/macros:$(RELEASE_DIR)/rpm/rpmmacros" "$(RELEASE_FILES)/$(RELEASE_ME).tar.gz"
  122 	mv "$(RELEASE_DIR)/rpm/SRPMS/$(RELEASE_ME)-1ras.src.rpm" "$(RELEASE_FILES)"
  123 	mv "$(RELEASE_DIR)/rpm/RPMS"/*/"$(RELEASE_ME)-1ras".*."rpm" "$(RELEASE_FILES)"
  124 	cp ChangeLog.txt "$(RELEASE_FILES)/README.txt"
  125 endif
  126 	#
  127 	# Build the htdocs directory as it will appear on the host.
  128 	#
  129 	mkdir -p "$(RELEASE_HTDOCS)"
  130 	cp -a $(RELEASE_PACKAGE_NAME).html $(RELEASE_HTDOCS)
  131 	set -e; for f in $$(sed -n 's,<\(a href\|img src\)="https\?://[^"]*"[^>]*>,,;ta;:a;s/.*<\(a href\|img src\)="\([^#/"][^#"]*\)"[^>]*>/\2@@@/g;T;s/@@@\([^@]\|@[^@]\|@@[^@]\)*$$//;s/@@@/ /g;p' "$(RELEASE_PACKAGE_NAME).html"); do \
  132 	  f="$${f%/}"; \
  133 	  [ ."$${f%%/*}" = ."$${f}" ] || mkdir -p "$(RELEASE_HTDOCS)/$${f%/*}"; \
  134 	  case "$${f}" in \
  135 	    *.[12345678].html) man2html <"$${f%.html}" | sed >"$(RELEASE_HTDOCS)/$${f}" '1,2d;7,8d;/^<HR>/,/^Time: /d';; \
  136 	    *) cp -a "$${f}" "$(RELEASE_HTDOCS)/$${f}";; \
  137 	  esac; \
  138 	done
  139 	ln -s "$(RELEASE_PACKAGE_NAME).html" "$(RELEASE_HTDOCS)/index.html"
  140 	echo "Options +Indexes" >"$(RELEASE_HTDOCS)/.htaccess"
  141 	#
  142 	# Verify there is no rubbish lying wround.
  143 	#
  144 	! hg status | grep '^?' || { echo '.hgignore: is missing some files' 1>&2; exit 1; }
  145 	touch $@
  146 
  147 .PHONY: release-customise
  148 release-customise::
  149 
  150 .PHONY: release-upload
  151 release-upload:	release-upload-htdocs release-upload-files
  152 
  153 .PHONY: release-upload-htdocs
  154 release-upload-htdocs: $(RELEASE_DIR)/release.stamp
  155 	#
  156 	# Send the files that a symlink'ed first, otherwise it fails on the
  157 	# 1st send.
  158 	#
  159 	cd $(RELEASE_DIR); rsync -avPR $$(for f in $$(find htdocs -name index.html -type l); do ff=$$(readlink "$${f}"); echo $${f%/*}/$${ff}; done) rstuart,$(RELEASE_PACKAGE_NAME)@web.sourceforge.net:.
  160 	rsync -avP --delete $(RELEASE_HTDOCS)/. rstuart,$(RELEASE_PACKAGE_NAME)@web.sourceforge.net:htdocs/.
  161 
  162 .PHONY: release-upload-files
  163 release-upload-files: $(RELEASE_DIR)/release.stamp
  164 	rsync -avP --delete $(RELEASE_FILES) rstuart,$(RELEASE_PACKAGE_NAME)@frs.sourceforge.net:/home/frs/project/$(RELEASE_PACKAGE_NAME)/.
  165 
  166 .PHONY: release-clean
  167 release-clean: release-project-clean
  168 	-[ "$(RELEASE_CLEAN_DONE)" = "yes" -o ! -d debian ] || RELEASE_CLEAN_DONE=yes debian/rules clean
  169 	[ ! -d .pc ] || { quilt pop -a; rm -r .pc; }
  170 	[ ! -f Makefile-automake ] || $(MAKE) maintainer-clean
  171 	rm -rf $(RELEASE_DIR) "$(RELEASE_PACKAGE_NAME).1.html"
  172 	rm -rf $$(find . -name "*.orig" -o -name ".*.sw?")
  173 
  174 .PHONY: release-tag
  175 release-tag:	$(RELEASE_DIR)/release.stamp
  176 	! hg status | grep '^?' || { echo "hg add hasn't been done" 1>&2; exit 1; }
  177 	! hg status | grep '^!' || { echo "hg rm hasn't been done" 1>&2; exit 1; }
  178 	[ -z "$$(hg resolv --list)" ] || { echo "There are unresolved merge conflicts" 1>&2; exit 1; }
  179 	[ -z "$$(hg status)" ] || \
  180 	  hg commit -m "Release $(RELEASE_PACKAGE_NAME)-$(RELEASE_DEBIAN_VERSION) - see ChangeLog.txt"
  181 	hg tag "$(RELEASE_PACKAGE_NAME)-$(RELEASE_DEBIAN_VERSION)"
  182 
  183 
  184 .PHONY: release-project-clean
  185 release-project-clean::