From 9ba70aadcdf4e63b95292de7414d12c52428b588 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Sun, 20 Nov 2011 23:47:58 +0100 Subject: [PATCH] Improve release rules. --- .gitignore | 5 + build-aux/gnupload | 416 ++++++++++++++++++++++++++++++++++++++++++++++++++ cfg.mk | 117 ++++++++++---- gl/Makefile.am | 9 +- gl/m4/gnulib-cache.m4 | 3 +- gl/m4/gnulib-comp.m4 | 2 + 6 files changed, 522 insertions(+), 30 deletions(-) create mode 100755 build-aux/gnupload diff --git a/.gitignore b/.gitignore index 1265b6f..8957d56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +*.gcda +*.gcno +*.gcov INSTALL Makefile Makefile.in @@ -22,6 +25,7 @@ doc/Makefile.in doc/asn1Coding.1 doc/asn1Decoding.1 doc/asn1Parser.1 +doc/coverage/ doc/cyclo/Makefile doc/cyclo/Makefile.in doc/cyclo/cyclo-libtasn1.html @@ -157,6 +161,7 @@ m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 +scan.tmp src/.deps/ src/.libs/ src/Makefile diff --git a/build-aux/gnupload b/build-aux/gnupload new file mode 100755 index 0000000..68215ca --- /dev/null +++ b/build-aux/gnupload @@ -0,0 +1,416 @@ +#!/bin/sh +# Sign files and upload them. + +scriptversion=2010-05-23.15; # UTC + +# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Originally written by Alexandre Duret-Lutz . + +set -e + +GPG='gpg --batch --no-tty' +conffile=.gnuploadrc +to= +dry_run=false +symlink_files= +delete_files= +delete_symlinks= +collect_var= +dbg= +nl=' +' + +usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...] + +Sign all FILES, and process them at selected destinations according to CMD. + +explains further. + +Commands: + --delete delete FILES from destination + --symlink create symbolic links + --rmsymlink remove symbolic links + -- treat the remaining arguments as files to upload + +Options: + --help print this help text and exit + --to DEST specify one destination for FILES + (multiple --to options are allowed) + --user NAME sign with key NAME + --symlink-regex[=EXPR] use sed script EXPR to compute symbolic link names + --dry-run do nothing, show what would have been done + --version output version information and exit + +If --symlink-regex is given without EXPR, then the link target name +is created by replacing the version information with \`-latest', e.g.: + + foo-1.3.4.tar.gz -> foo-latest.tar.gz + +Recognized destinations are: + alpha.gnu.org:DIRECTORY + savannah.gnu.org:DIRECTORY + savannah.nongnu.org:DIRECTORY + ftp.gnu.org:DIRECTORY + build directive files and upload files by FTP + download.gnu.org.ua:{alpha|ftp}/DIRECTORY + build directive files and upload files by SFTP + [user@]host:DIRECTORY upload files with scp + +Options and commands are applied in order. If the file $conffile exists +in the current working directory, its contents are prepended to the +actual command line options. Use this to keep your defaults. Comments +(#) and empty lines in $conffile are allowed. + +Examples: +1. Upload foobar-1.0.tar.gz to ftp.gnu.org: + gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz + +2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org: + gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz + +3. Same as above, and also create symbolic links to foobar-latest.tar.*: + gnupload --to ftp.gnu.org:foobar \\ + --symlink-regex \\ + foobar-1.0.tar.gz foobar-1.0.tar.xz + +4. Upload foobar-0.9.90.tar.gz to two sites: + gnupload --to alpha.gnu.org:foobar \\ + --to sources.redhat.com:~ftp/pub/foobar \\ + foobar-0.9.90.tar.gz + +5. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz + (the -- terminates the list of files to delete): + gnupload --to alpha.gnu.org:foobar \\ + --to sources.redhat.com:~ftp/pub/foobar \\ + --delete oopsbar-0.9.91.tar.gz \\ + -- foobar-0.9.91.tar.gz + +gnupload uses the ncftpput program to do the transfers; if you don't +happen to have an ncftp package installed, the ncftpput-ftp script in +the build-aux/ directory of the gnulib package +(http://savannah.gnu.org/projects/gnulib) may serve as a replacement. + +Report bugs to . +Send patches to ." + +# Read local configuration file +if test -r "$conffile"; then + echo "$0: Reading configuration file $conffile" + conf=`sed 's/#.*$//;/^$/d' "$conffile" | tr "\015$nl" ' '` + eval set x "$conf \"\$@\"" + shift +fi + +while test -n "$1"; do + case $1 in + -*) + collect_var= + case $1 in + --help) + echo "$usage" + exit $? + ;; + --to) + if test -z "$2"; then + echo "$0: Missing argument for --to" 1>&2 + exit 1 + else + to="$to $2" + shift + fi + ;; + --user) + if test -z "$2"; then + echo "$0: Missing argument for --user" 1>&2 + exit 1 + else + GPG="$GPG --local-user $2" + shift + fi + ;; + --delete) + collect_var=delete_files + ;; + --rmsymlink) + collect_var=delete_symlinks + ;; + --symlink-regex=*) + symlink_expr=`expr "$1" : '[^=]*=\(.*\)'` + ;; + --symlink-regex) + symlink_expr='s|-[0-9][0-9\.]*\(-[0-9][0-9]*\)\{0,1\}\.|-latest.|' + ;; + --symlink) + collect_var=symlink_files + ;; + --dry-run|-n) + dry_run=: + ;; + --version) + echo "gnupload $scriptversion" + exit $? + ;; + --) + shift + break + ;; + -*) + echo "$0: Unknown option \`$1', try \`$0 --help'" 1>&2 + exit 1 + ;; + esac + ;; + *) + if test -z "$collect_var"; then + break + else + eval "$collect_var=\"\$$collect_var $1\"" + fi + ;; + esac + shift +done + +dprint() +{ + echo "Running $* ..." +} + +if $dry_run; then + dbg=dprint +fi + +if test -z "$to"; then + echo "$0: Missing destination sites" >&2 + exit 1 +fi + +if test -n "$symlink_files"; then + x=`echo "$symlink_files" | sed 's/[^ ]//g;s/ //g'` + if test -n "$x"; then + echo "$0: Odd number of symlink arguments" >&2 + exit 1 + fi +fi + +if test $# = 0; then + if test -z "${symlink_files}${delete_files}${delete_symlinks}"; then + echo "$0: No file to upload" 1>&2 + exit 1 + fi +else + # Make sure all files exist. We don't want to ask + # for the passphrase if the script will fail. + for file + do + if test ! -f $file; then + echo "$0: Cannot find \`$file'" 1>&2 + exit 1 + elif test -n "$symlink_expr"; then + linkname=`echo $file | sed "$symlink_expr"` + if test -z "$linkname"; then + echo "$0: symlink expression produces empty results" >&2 + exit 1 + elif test "$linkname" = $file; then + echo "$0: symlink expression does not alter file name" >&2 + exit 1 + fi + fi + done +fi + +# Make sure passphrase is not exported in the environment. +unset passphrase + +# Reset PATH to be sure that echo is a built-in. We will later use +# `echo $passphrase' to output the passphrase, so it is important that +# it is a built-in (third-party programs tend to appear in `ps' +# listings with their arguments...). +# Remember this script runs with `set -e', so if echo is not built-in +# it will exit now. +PATH=/empty echo -n "Enter GPG passphrase: " +stty -echo +read -r passphrase +stty echo +echo + +if test $# -ne 0; then + for file + do + echo "Signing $file ..." + rm -f $file.sig + echo "$passphrase" | $dbg $GPG --passphrase-fd 0 -ba -o $file.sig $file + done +fi + + +# mkdirective DESTDIR BASE FILE STMT +# Arguments: See upload, below +mkdirective () +{ + stmt="$4" + if test -n "$3"; then + stmt=" +filename: $3$stmt" + fi + + cat >${2}.directive<&2 + fi + $dbg ncftpput savannah.gnu.org /incoming/savannah/$destdir $files + ;; + savannah.nongnu.org:*) + if test -z "$files"; then + echo "$0: warning: standalone directives not applicable for $dest" >&2 + fi + $dbg ncftpput savannah.nongnu.org /incoming/savannah/$destdir $files + ;; + download.gnu.org.ua:alpha/*|download.gnu.org.ua:ftp/*) + destdir_p1=`echo "$destdir" | sed 's,^[^/]*/,,'` + destdir_topdir=`echo "$destdir" | sed 's,/.*,,'` + mkdirective "$destdir_p1" "$base" "$file" "$stmt" + echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive + for f in $files $base.directive.asc + do + echo put $f + done | $dbg sftp -b - puszcza.gnu.org.ua:/incoming/$destdir_topdir + ;; + /*) + dest_host=`echo "$dest" | sed 's,:.*,,'` + mkdirective "$destdir" "$base" "$file" "$stmt" + echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive + $dbg cp $files $base.directive.asc $dest_host + ;; + *) + if test -z "$files"; then + echo "$0: warning: standalone directives not applicable for $dest" >&2 + fi + $dbg scp $files $dest + ;; + esac + rm -f $base.directive $base.directive.asc +} + +##### +# Process any standalone directives +stmt= +if test -n "$symlink_files"; then + stmt="$stmt +`mksymlink $symlink_files`" +fi + +for file in $delete_files +do + stmt="$stmt +archive: $file" +done + +for file in $delete_symlinks +do + stmt="$stmt +rmsymlink: $file" +done + +if test -n "$stmt"; then + for dest in $to + do + destdir=`echo $dest | sed 's/[^:]*://'` + upload "$dest" "$destdir" "`hostname`-$$" "" "$stmt" + done +fi + +# Process actual uploads +for dest in $to +do + for file + do + echo "Uploading $file to $dest ..." + stmt= + files="$file $file.sig" + destdir=`echo $dest | sed 's/[^:]*://'` + if test -n "$symlink_expr"; then + linkname=`echo $file | sed "$symlink_expr"` + stmt="$stmt +symlink: $file $linkname +symlink: $file.sig $linkname.sig" + fi + upload "$dest" "$destdir" "$file" "$file" "$stmt" "$files" + done +done + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/cfg.mk b/cfg.mk index 852e67d..b6ab887 100644 --- a/cfg.mk +++ b/cfg.mk @@ -1,5 +1,4 @@ -# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 2006-2011 Free Software Foundation, Inc. # Author: Simon Josefsson # # This file is part of LIBTASN1. @@ -31,7 +30,7 @@ local-checks-to-skip = sc_prohibit_strcmp sc_prohibit_have_config_h \ sc_require_config_h sc_require_config_h_first \ sc_immutable_NEWS sc_prohibit_magic_number_exit \ sc_bindtextdomain -VC_LIST_ALWAYS_EXCLUDE_REGEX = ^(maint.mk|build-aux/|gl/.*|lib/gllib/.*|lib/glm4/.*|lib/ASN1\.c|m4/pkg.m4|doc/gdoc|windows/.*|doc/fdl-1.3.texi|build-aux/pmccabe2html|build-aux/pmccabe.css)$$ +VC_LIST_ALWAYS_EXCLUDE_REGEX = ^(maint.mk|gtk-doc.make|build-aux/|gl/.*|lib/gllib/.*|lib/glm4/.*|lib/ASN1\.c|m4/pkg.m4|doc/gdoc|windows/.*|doc/fdl-1.3.texi|build-aux/pmccabe2html|build-aux/pmccabe.css)$$ # Explicit syntax-check exceptions. exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/TestIndef.p12$$ @@ -39,7 +38,6 @@ exclude_file_name_regexp--sc_GPL_version = ^lib/libtasn1.h$$ exclude_file_name_regexp--sc_program_name = ^tests/|examples/ exclude_file_name_regexp--sc_prohibit_atoi_atof = ^src/asn1Coding.c|src/asn1Decoding.c$$ exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/crlf.cer|tests/TestIndef.p12$$ -exclude_file_name_regexp--sc_space_tab = ^gtk-doc.make$$ bootstrap-tools := autoconf,automake,libtool,bison gpg_key_ID = b565716f @@ -50,48 +48,111 @@ autoreconf: bootstrap: autoreconf ./configure $(CFGFLAGS) -coverage-web: +review-diff: + git diff `git describe --abbrev=0`.. \ + | grep -v -e ^index -e '^diff --git' \ + | filterdiff -p 1 -x 'gl/*' -x 'build-aux/*' -x 'lib/gl*' -x 'po/*' -x 'maint.mk' -x '.gitignore' -x '.x-sc*' -x ChangeLog -x GNUmakefile -x 'lib/ASN1.c' \ + | less + +# Release + +htmldir = ../www-$(PACKAGE) + +coverage-copy: rm -fv `find $(htmldir)/coverage -type f | grep -v CVS` + mkdir -p $(htmldir)/coverage/ cp -rv $(COVERAGE_OUT)/* $(htmldir)/coverage/ -coverage-web-upload: +coverage-upload: + cd $(htmldir) && \ + find coverage -type d -! -name CVS -! -name '.' \ + -exec cvs add {} \; && \ + find coverage -type d -! -name CVS -! -name '.' \ + -exec sh -c "cvs add -kb {}/*.png" \; && \ + find coverage -type d -! -name CVS -! -name '.' \ + -exec sh -c "cvs add {}/*.html" \; && \ + cvs add coverage/libtasn1.info coverage/gcov.css || true && \ + cvs commit -m "Update." coverage + +clang: + make clean + scan-build ./configure + rm -rf scan.tmp + scan-build -o scan.tmp make + +clang-copy: + rm -fv `find $(htmldir)/clang-analyzer -type f | grep -v CVS` + mkdir -p $(htmldir)/clang-analyzer/ + cp -rv scan.tmp/*/* $(htmldir)/clang-analyzer/ + +clang-upload: cd $(htmldir) && \ - cvs commit -m "Update." coverage + cvs add clang-analyzer || true && \ + cvs add clang-analyzer/*.css clang-analyzer/*.js \ + clang-analyzer/*.html || true && \ + cvs commit -m "Update." clang-analyzer + +cyclo-copy: + cp -v doc/cyclo/cyclo-$(PACKAGE).html $(htmldir)/cyclo/index.html + +cyclo-upload: + cd $(htmldir) && cvs commit -m "Update." cyclo/index.html + +gendoc-copy: + cd doc && $(SHELL) ../build-aux/gendocs.sh \ + --html "--css-include=texinfo.css" \ + -o ../$(htmldir)/manual/ $(PACKAGE) "$(PACKAGE_NAME)" + +gendoc-upload: + cd $(htmldir) && \ + cvs add manual || true && \ + cvs add manual/html_node || true && \ + cvs add -kb manual/*.gz manual/*.pdf || true && \ + cvs add manual/*.txt manual/*.html \ + manual/html_node/*.html || true && \ + cvs commit -m "Update." manual/ + +gtkdoc-copy: + mkdir -p $(htmldir)/reference/ + cp -v doc/reference/$(PACKAGE).pdf \ + doc/reference/html/*.html \ + doc/reference/html/*.png \ + doc/reference/html/*.devhelp \ + doc/reference/html/*.css \ + $(htmldir)/reference/ + +gtkdoc-upload: + cd $(htmldir) && \ + cvs add reference || true && \ + cvs add -kb reference/*.png reference/*.pdf || true && \ + cvs add reference/*.html reference/*.css \ + reference/*.devhelp || true && \ + cvs commit -m "Update." reference/ ChangeLog: git2cl > ChangeLog cat .clcopying >> ChangeLog -htmldir = ../www-$(PACKAGE) -tag = $(PACKAGE)_`echo $(VERSION) | sed 's/\./_/g'` -release: prepare upload web upload-web +tag = $(PACKAGE)_`echo $(VERSION) | sed 's/\./_/g'` -prepare: +tarball: ! git tag -l $(tag) | grep $(PACKAGE) > /dev/null rm -f ChangeLog $(MAKE) ChangeLog distcheck + +source: git commit -m Generated. ChangeLog git tag -u b565716f! -m $(VERSION) $(tag) -upload: +release-check: syntax-check tarball gendoc-copy gtkdoc-copy coverage coverage-copy clang clang-copy + +release-upload-www: gendoc-upload gtkdoc-upload coverage-upload clang-upload + +release-upload-ftp: git push git push --tags - gnupload --to ftp.gnu.org:libtasn1 $(distdir).tar.gz + build-aux/gnupload --to ftp.gnu.org:libtasn1 $(distdir).tar.gz cp $(distdir).tar.gz $(distdir).tar.gz.sig ../releases/$(PACKAGE)/ -web: - cd doc && $(SHELL) ../build-aux/gendocs.sh \ - --html "--css-include=texinfo.css" \ - -o ../$(htmldir)/manual/ $(PACKAGE) "$(PACKAGE_NAME)" - cp -v doc/reference/$(PACKAGE).pdf doc/reference/html/*.html doc/reference/html/*.png doc/reference/html/*.devhelp doc/reference/html/*.css $(htmldir)/reference/ - cp -v doc/cyclo/cyclo-$(PACKAGE).html $(htmldir)/cyclo/index.html - -upload-web: - cd $(htmldir) && cvs commit -m "Update." manual/ reference/ cyclo/ - -review-diff: - git diff `git describe --abbrev=0`.. \ - | grep -v -e ^index -e '^diff --git' \ - | filterdiff -p 1 -x 'gl/*' -x 'build-aux/*' -x 'lib/gl*' -x 'po/*' -x 'maint.mk' -x '.gitignore' -x '.x-sc*' -x ChangeLog -x GNUmakefile -x 'lib/ASN1.c' \ - | less +release: release-check release-upload-www source release-upload-ftp diff --git a/gl/Makefile.am b/gl/Makefile.am index ae6049b..af221ec 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files autobuild fdl-1.3 gendocs getopt-gnu maintainer-makefile manywarnings pmccabe2html progname read-file stdint update-copyright valgrind-tests version-etc-fsf warnings +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files autobuild fdl-1.3 gendocs getopt-gnu gnupload maintainer-makefile manywarnings pmccabe2html progname read-file stdint update-copyright valgrind-tests version-etc-fsf warnings AUTOMAKE_OPTIONS = 1.5 gnits @@ -163,6 +163,13 @@ EXTRA_DIST += $(top_srcdir)/GNUmakefile ## end gnulib module gnumakefile +## begin gnulib module gnupload + + +EXTRA_DIST += $(top_srcdir)/build-aux/gnupload + +## end gnulib module gnupload + ## begin gnulib module lseek diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 5c8b73e..cce17ff 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files autobuild fdl-1.3 gendocs getopt-gnu maintainer-makefile manywarnings pmccabe2html progname read-file stdint update-copyright valgrind-tests version-etc-fsf warnings +# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files autobuild fdl-1.3 gendocs getopt-gnu gnupload maintainer-makefile manywarnings pmccabe2html progname read-file stdint update-copyright valgrind-tests version-etc-fsf warnings # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([gl/override]) @@ -36,6 +36,7 @@ gl_MODULES([ fdl-1.3 gendocs getopt-gnu + gnupload maintainer-makefile manywarnings pmccabe2html diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 1c25aa4..cd8b659 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -53,6 +53,7 @@ AC_DEFUN([gl_EARLY], # Code from module getopt-posix: # Code from module gettext-h: # Code from module gnumakefile: + # Code from module gnupload: # Code from module include_next: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) @@ -332,6 +333,7 @@ AC_DEFUN([gltests_LIBSOURCES], [ # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ build-aux/gendocs.sh + build-aux/gnupload build-aux/pmccabe.css build-aux/pmccabe2html build-aux/snippet/_Noreturn.h -- 2.7.4