Changeset 3246


Ignore:
Timestamp:
May 28, 2014, 4:32:00 PM (7 years ago)
Author:
Peter
Message:

move some more targets from Makefile.am to macro YAT_SVN_RELEASE. Make rules more generic and configurable via macro interface.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.am

    r3219 r3246  
    9595
    9696maintainer-check-local:
    97   $(MAKE) $(AM_MAKEFLAGS) syntax-check
    9897  $(MAKE) $(AM_MAKEFLAGS) mc_installcheck
    9998  $(MAKE) $(AM_MAKEFLAGS) mc_without_samtools
     
    162161  && $(GREP) '^includedir=quz' build_support/yat.pc
    163162
    164 SVN = svn
    165 SVNCOPYRIGHT = svncopyright
    166 SVNDIGEST_COPY_CACHE = svndigest-copy-cache
    167 SCP = scp
    168 
    169 copyright:
    170   $(SVNCOPYRIGHT) -v -r $(srcdir)
    171 
    172 ## FIXME perhaps incorporate this target into release
    173 release-tag-upload:
    174   $(MAKE) $(AM_MAKEFLAGS) release
    175   $(MAKE) $(AM_MAKEFLAGS) svn-tag
    176   $(MAKE) $(AM_MAKEFLAGS) announce.txt
    177   $(MAKE) $(AM_MAKEFLAGS) upload
    178 
    179 announce.txt: build_support/gen_announce.sh $(distdir).tar.gz.MD5
    180   $(SHELL) build_support/gen_announce.sh > $@
    181 
    182 sf_user = peter31042
    183 
    184 upload: $(distdir).tar.gz $(distdir).tar.gz.MD5
    185   $(SCP) $(distdir).tar.gz $(distdir).tar.gz.MD5 \
    186   $(sf_user),libyat@frs.sourceforge.net:/home/frs/project/l/li/libyat/.
    187 
    188 STABLE_VERSION = $(YAT_MAJOR_VERSION).$(YAT_MINOR_VERSION)
    189 STABLE_BRANCH = ^/branches/$(STABLE_VERSION)-stable
    190 
    191 # create a tag from current stable branch; depends on check-version to
    192 # ensure that version is macro.minor.micro (no pre suffix), that wc is
    193 # pristine and updated.
    194 svn-tag: check-version check-svn-diff
    195   cd $(srcdir) && \
    196   $(SVN) copy $(STABLE_BRANCH) ^/tags/$(VERSION) \
    197   -m "tagging version $(VERSION)"
    198 
    199 # create a stable-branch from trunk
    200 svn-stable-branch: check-svn-diff all
    201   cd $(srcdir) && \
    202   svn copy ^/trunk $(STABLE_BRANCH) \
    203   -m "New stable branch $(STABLE_VERSION)" \
    204   && svn co $(STABLE_BRANCH) ../yat-$(STABLE_VERSION).x \
    205   && $(SVNDIGEST_COPY_CACHE) -v -r . -t ../yat-$(STABLE_VERSION).x
    206 
    207163include $(srcdir)/am/maintainer.am
    208164
     
    215171  && ../$(srcdir)/configure $(DISTCHECK_CONFIGURE_FLAGS) --without-samtools \
    216172  && $(MAKE) $(AM_MAKEFLAGS) && $(MAKE) check $(AM_MAKEFLAGS)
    217 
    218 test_sources = $(EXTRA_PROGRAMS:.test=.cc)
    219 
    220 syntax-check: sc_config_h
    221 
    222 sc_config_h:
    223   @for f in $(yat_libyat_la_SOURCES) $(test_sources); do \
    224     test -e $$f || f=$(srcdir)/$$f;\
    225     grep '^#include' $$f | head -n 1 | grep '<config.h>' > /dev/null || \
    226     { echo "missing '#include <config.h>' in $$f" >&2; exit 1; } \
    227   done
  • trunk/configure.ac

    r3231 r3246  
    557557AC_SUBST([lt_cv_objdir])
    558558
    559 YAT_SVN_RELEASE([am/maintainer.am])
     559YAT_SVN_RELEASE([am/maintainer.am],
     560  [$(YAT_MAJOR_VERSION).$(YAT_MINOR_VERSION)],
     561  [libyat@frs.sourceforge.net:/home/frs/project/l/li/libyat],
     562  [http://sourceforge.net/projects/libyat/files/$(distdir).tar.gz/files],
     563  [http://dev.thep.lu.se/yat/browser/tags/$(VERSION)/NEWS])
    560564
    561565# make shell tests work in VPATH builds
  • trunk/m4/yat_svn_release.m4

    r2787 r3246  
    11## $Id$
    22
    3 # serial 9 (yat 0.9)
     3# serial 10 (yat 0.13)
    44
    55# SYNOPSIS
     
    99# DESCRIPTION
    1010#
    11 #   Creates a few make rules useful for maintainer. You need to add
    12 #
    13 #     include $(srcdir)/maintainer.am
    14 #
    15 #   in your top Makefile.am. The main targets are `maintainer-check'
    16 #   and `release'. maintainer-check 'svn exports' from the local wc
    17 #   and try to build from this pristine directory via './boostrap;
    18 #   ./configure $(DISTCHECK_CONFIGURE_FLAGS); make'. You can add
    19 #   additional target that should be run within maintainer-check by
    20 #   defining variable `MAINTAINER_CHECK_LOCAL'. The target `release'
    21 #   runs `maintainer-check' in addition to some more sanity checks
    22 #   such as checking that wc is not modified compared with repository
    23 #   and finishes by running distcheck.
    2411#
    2512# COPYLEFT
    2613m4_define([yat_svn_release_copyright], [dnl
    2714#
    28 #   Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
     15#   Copyright (C) 2009, 2010, 2011, 2012, 2014 Peter Johansson
    2916#
    3017#   This file is part of the yat library, http://dev.thep.lu.se/yat
     
    4532])
    4633
     34
     35AC_DEFUN([YAT_AC_WRITE],
     36[
     37m4_esyscmd([cat > $1 << '__EOF'
     38$2
     39__EOF
     40])
     41])
     42
     43
     44AC_DEFUN([YAT_AC_WRITE_APPEND],
     45[
     46m4_esyscmd([cat >> $1 << '__EOF'
     47$2
     48__EOF
     49])
     50])
     51
     52
     53# YAT_SVN_RELEASE(am-file, stable-version, upload-url, download-url, news-url)
     54# ============================================================================
    4755AC_DEFUN([YAT_SVN_RELEASE],
    4856[
     57  m4_pushdef([YAT_OUTPUTFILE], [m4_default([$1], [maintainer.am])])
     58
    4959  AC_REQUIRE([AC_PROG_SED])
    5060  AC_REQUIRE([AC_PROG_EGREP])
    51   AC_CHECK_PROGS([MD5], [md5sum gmd5sum md5 md5deep], [no])
    52   m4_pushdef([YAT_OUTPUTFILE], [m4_default([$1], [maintainer.am])])
    53 
    54   AX_AC_PRINT_TO_FILE(YAT_OUTPUTFILE,
    55 [#  ]YAT_OUTPUTFILE[ generated by autoconf from $0
    56 ]yat_svn_release_copyright[
    57 .PHONY: check-svn-diff check-news check-news-date check-version \\
     61  AC_CHECK_PROGS([MD5], [md5sum gmd5sum md5 md5deep], [false])
     62  AC_CHECK_PROG([SVN], [svn], [svn], false)
     63  AC_CHECK_PROG([SVNCOPYRIGHT], [svncopyright], [svncopyright], [false])
     64  AC_CHECK_PROG([SVNDIGEST_COPY_CACHE], [svndigest-copy-cache],
     65                [svndigest-copy-cache], [false])
     66  AC_CHECK_PROG([SCP], [scp], [scp], [false])
     67
     68  YAT_AC_WRITE(YAT_OUTPUTFILE,
     69[# $1 generated by Autoconf ]AC_AUTOCONF_VERSION[ from macro $0
     70## include this file in Makefile.am
     71
     72STABLE_VERSION = $2
     73STABLE_BRANCH = ^/branches/$(STABLE_VERSION)-stable
     74UPLOAD_URL = $3
     75DOWNLOAD_URL = $4
     76NEWS_URL = $5
     77SVN_LIST_CC = `$(SVN) list -R $(srcdir) | $(EGREP) ".cc$$"`
     78
     79.PHONY: check-svn-diff check-news check-news-date check-version \
    5880        check-release-tools maintainer-check release
    5981
    60 # stub rule to work around bug in Automake 1.11
    61 \$(srcdir)/]YAT_OUTPUTFILE[:
    62 
     82# --------------------------------------------------------------------
     83# Tagging and uploading a release
     84#
     85# This is the main target used at release. It does several checks of
     86# the package, creates a tarball, an svn tag, and uploads the package
     87# to download page.
     88# --------------------------------------------------------------------
     89release-tag-upload:
     90  @test -z "$(RELEASE_LOCAL)" || $(MAKE) $(AM_MAKEFLAGS) $(RELEASE_LOCAL)
     91  $(MAKE) $(AM_MAKEFLAGS) check-release-tools
     92  $(MAKE) $(AM_MAKEFLAGS) release-check
     93  $(MAKE) $(AM_MAKEFLAGS) distcheck
     94  $(MAKE) $(AM_MAKEFLAGS) $(distdir).tar.gz.MD5
     95  $(MAKE) $(AM_MAKEFLAGS) maintainer-check
     96  $(MAKE) $(AM_MAKEFLAGS) svn-tag
     97  $(MAKE) $(AM_MAKEFLAGS) announce.txt
     98  $(MAKE) $(AM_MAKEFLAGS) upload
     99
     100$(distdir).tar.gz.md5: $(distdir).tar.gz
     101  $(MD5) $(distdir).tar.gz > $(distdir).tar.gz.md5
     102
     103# Check that we have all tools needed to do a release
     104check-release-tools:
     105  @test x"$(sf_user)" != x"" || \
     106  { echo "make variable 'sf_user' is empty" >&2; exit 1; }
     107  @test "x$(MD5)" != "xfalse" || \
     108  { echo "no tool to calculate MD5 checksum available" 1>&2 && exit 1; }
     109  @test "x$(SVN)" != "xfalse" || \
     110  { echo "no subversion client available" 1>&2 && exit 1; }
     111  @test "x$(SVNDIGEST_COPY_CACHE)" != "xfalse" || \
     112  { echo "svndigest-copy-cache not available" 1>&2 && exit 1; }
     113  @test "x$(SCP)" != "xfalse" || \
     114  { echo "scp not available" 1>&2 && exit 1; }
     115
     116# upload dist tarball to $(UPLOAD_URL)
     117upload: $(distdir).tar.gz $(distdir).tar.gz.MD5
     118  $(SCP) $(distdir).tar.gz $(distdir).tar.gz.MD5 \
     119  $(sf_user),$(UPLOAD_URL)
     120
     121
     122mc_exportdir = _exported
     123mc_builddir = _exported_build
     124
     125# ---------------------------------------------------------------------
     126# Similar to automake generated distcheck rule
     127#
     128# This rule 'svn export' the local WC and tries to bootstrap, a VPATH
     129# configuration, and check that everything is there to make dist. The
     130# rule is hookable; if variable MAINTAINER_CHECK_LOCAL is will be
     131# issued. A common declaration would be
     132# MAINTAINER_CHECK_LOCAL = check
     133# ---------------------------------------------------------------------
     134maintainer-check:
     135  $(MAKE) $(AM_MAKEFLAGS) syntax-check
     136  rm -rf $(mc_exportdir)
     137  rm -rf $(mc_builddir)
     138  $(SVN) export $(srcdir) $(mc_exportdir)
     139  mkdir $(mc_builddir)
     140  @cd $(mc_exportdir) \
     141  && echo "./bootstrap" \
     142  && ./bootstrap \
     143  && cd ../$(mc_builddir) \
     144  && ../$(mc_exportdir)/configure --srcdir=../$(mc_exportdir) \
     145     $(DISTCHECK_CONFIGURE_FLAGS) \
     146  && { test -z "$(MAINTAINER_CHECK_LOCAL)" || \
     147        $(MAKE) $(AM_MAKEFLAGS) $(MAINTAINER_CHECK_LOCAL); } \
     148  && $(MAKE) $(AM_MAKEFLAGS) dist || exit 1
     149  rm -rf $(mc_builddir) $(mc_exportdir)
     150
     151# -----------------------------------------
     152# Check that package is ready for release
     153# -----------------------------------------
     154release-check: check-news check-news-date check-svn-diff check-version
     155
     156# Check that NEWS mention VERSION early on
     157check-news:
     158  @case \`sed 15q $(srcdir)/NEWS\` in \
     159  *"$(VERSION)"*);; \
     160  *) \
     161    echo "NEWS not updated" 1>&2; \
     162    exit 1;; \
     163  esac
     164
     165# Check that NEWS mention today's date (in UTC)
     166check-news-date:
     167  @today=\`date -u "+%e %B %Y"\`; \
     168  case \`sed 15q $(srcdir)/NEWS\` in \
     169  *"$$today"*);; \
     170  *) \
     171    echo "NEWS: release date incorrect; expected '$$today'" 1>&2;\
     172    exit 1;; \
     173  esac
     174
     175# Check that VERSION is appropriate for release
     176check-version:
     177  @echo $(VERSION) | $(EGREP) '^[0-9]+(\.[0-9]+)+$$' > /dev/null || \
     178  { echo "invalid version string: $(VERSION)" 1>&2; exit 1; }
     179
     180
     181#------------------
     182# Subversion rules
     183#------------------
     184
     185# Check that WC is in sync with repository
    63186check-svn-diff:
    64   @str=\`svn diff -rHEAD \$(srcdir)\`; \\
    65   if test -n \"\$\$str\"; then \\
    66     echo \"\$\$str\" 1>&2;\\
    67     exit 1;\\
    68   fi
    69 
    70 check-news:
    71   @case \`sed 15q \$(srcdir)/NEWS\` in \\
    72   *\"\$(VERSION)\"*);; \\
    73   *) \\
    74     echo \"NEWS not updated\" 1>&2; \\
    75     exit 1;; \\
    76   esac
    77 
    78 check-news-date:
    79   @today=\`date -u \"+%%e %%B %%Y\"\`; \\
    80   case \`sed 15q \$(srcdir)/NEWS\` in \\
    81   *\"\$\$today\"*);; \\
    82   *) \\
    83     echo \"NEWS: release date incorrect; expected '\$\$today'\" 1>&2;\\
    84     exit 1;; \\
    85   esac
    86 
    87 check-version:
    88   @echo \$(VERSION) | \$(EGREP) '^[0-9]+(\\.[0-9]+)+\$\$' > /dev/null || \\
    89   { echo \"invalid version string: \$(VERSION)\" 1>&2; exit 1; }
    90 
    91 check-release-tools:
    92   @test \"x\$(MD5)\" != \"xno\" || \\
    93   (echo \"no tool to calculate MD5 checksum available\" 1>&2 && exit 1)
    94 
    95 mc_exportdir=_exported
    96 mc_builddir=_exported_build
    97 
    98 maintainer-check:
    99   rm -rf \$(mc_exportdir)
    100   rm -rf \$(mc_builddir)
    101   svn export \$(srcdir) \$(mc_exportdir)
    102   mkdir \$(mc_builddir)
    103   @cd \$(mc_exportdir) \\
    104   && echo \"./bootstrap\" \\
    105   && ./bootstrap \\
    106   && cd ../\$(mc_builddir) \\
    107   && ../\$(mc_exportdir)/configure --srcdir=../\$(mc_exportdir) \\
    108      \$(DISTCHECK_CONFIGURE_FLAGS) \\
    109   && { test -z \"\$(MAINTAINER_CHECK_LOCAL)\" || \\
    110         \$(MAKE) \$(AM_MAKEFLAGS) \$(MAINTAINER_CHECK_LOCAL); } \\
    111   && \$(MAKE) \$(AM_MAKEFLAGS) dist || exit 1
    112   rm -rf \$(mc_builddir) \$(mc_exportdir)
    113 
    114 release: all
    115   \$(MAKE) \$(AM_MAKEFLAGS) check-release-tools
    116   @test -z \"\$(RELEASE_LOCAL)\" || \$(MAKE) \$(AM_MAKEFLAGS) \$(RELEASE_LOCAL)
    117   \$(MAKE) \$(AM_MAKEFLAGS) check-version
    118   \$(MAKE) \$(AM_MAKEFLAGS) check-news
    119   \$(MAKE) \$(AM_MAKEFLAGS) check-news-date
    120   \$(MAKE) \$(AM_MAKEFLAGS) check-svn-diff
    121   \$(MAKE) \$(AM_MAKEFLAGS) maintainer-check
    122   \$(MAKE) \$(AM_MAKEFLAGS) distcheck
    123   @for a in \$(DIST_ARCHIVES); do \\
    124     \$(MD5) \$\$a > \$\$a.MD5; \\
    125   done;
    126   @test -z \"\$(RELEASE_HOOK)\" || \$(MAKE) \$(AM_MAKEFLAGS) \$(RELEASE_HOOK)
    127 ])
    128   m4_popdef([YAT_OUTPUTFILE])
    129 
     187  @str=`$(SVN) diff -rHEAD $(srcdir)`; \
     188  @test -n "$$str" && { echo "$$str" 1>&2; exit 1; }
     189
     190check-svn-wc-is-trunk:
     191  @$(SVN) info $(srcdir) | $(GREP) -q '/trunk'
     192
     193
     194# create a tag from current stable branch; depends on check-version to
     195# ensure that version is macro.minor.micro (no pre suffix), that wc is
     196# pristine and updated.
     197svn-tag: check-version check-svn-diff
     198  cd $(srcdir) && \
     199  $(SVN) copy $(STABLE_BRANCH) ^/tags/$(VERSION) \
     200  -m "tagging version $(VERSION)"
     201
     202# create a stable-branch from trunk
     203svn-stable-branch: check-svn-diff check-svn-wc-is-trunk
     204  cd $(srcdir) && \
     205  $(SVN) copy ^/trunk $(STABLE_BRANCH) \
     206  -m "New stable branch $(STABLE_VERSION)" \
     207  && svn co $(STABLE_BRANCH) ../$(PACKAGE)-$(STABLE_VERSION).x \
     208  && $(SVNDIGEST_COPY_CACHE) -v -r . -t ../$(PACKAGE)-$(STABLE_VERSION).x
     209
     210
     211# Update copyright statement
     212copyright:
     213  $(SVNCOPYRIGHT) -v -r $(srcdir)
     214
     215syntax-check: sc_config_h
     216
     217sc_config_h:
     218  $(AM_V_GEN)
     219  @for f in $(SVN_LIST_CC); do \
     220    $(GREP) '^#include' $$f | head -n 1 | $(GREP) -q '<config.h>' || \
     221    { echo "missing '#include <config.h>' in $$f" >&2; exit 1; } \
     222  done
     223
     224# Generate an announcement
     225announce.txt: Makefile $(distdir).tar.gz.MD5
     226  @echo "I'm happy to announce the release of $(PACKAGE_STRING)" >> $][@
     227  @echo >> $][@
     228  @echo "<INSERT TEXT HERE>" >> $][@
     229  @echo >> $][@
     230  @echo "You can find the new release here:" >> $][@
     231  @echo >> $][@
     232  @echo "$(DOWNLOAD_URL)" >> $][@
     233  @echo >> $][@
     234  @echo "Here is the checksum" >> $][@
     235  @echo >> $][@
     236  @printf "MD5:    " >> $][@
     237  @cat ${dist_archive}.MD5 | $(SED) 's/ .*//' >> $][@
     238  @echo >> $][@
     239  @echo "Please report bugs by email to $(PACKAGE_BUGREPORT)" >> $][@
     240  @echo >> $][@
     241  @echo "This release was bootstrapped with the following tools:" >> $][@
     242  @$(AUTOCONF) --version | head -n 1 | $(SED) -e 's/.*(//' -e 's/)//' >> $][@
     243  @$(AUTOMAKE) --version | head -n 1 | $(SED) -e 's/.*(//' -e 's/)//' >> $][@]dnl
     244)
     245
     246m4_ifdef([AM_PROG_LIBTOOL],
     247[YAT_AC_WRITE_APPEND(YAT_OUTPUTFILE,
     248[ @$(srcdir)/libtool --version | head -n 1 | $(SED) 's/.*(//' -e 's/)//' >> $][@])
     249])
     250
     251YAT_AC_WRITE_APPEND(YAT_OUTPUTFILE,
     252[ @echo >> $][@
     253  @echo You can find the list of significant changes between $(VERSION)>> $][@
     254  @echo and earlier versions at >> $][@
     255  @echo >> $][@
     256  @echo $(NEWS_URL) >> $][@
     257])
     258
     259m4_popdef([YAT_OUTPUTFILE])
    130260]) # YAT_SVN_RELEASE
Note: See TracChangeset for help on using the changeset viewer.