From 43ffbea3695755a3fbfb4e07d0c608624612ba9c Mon Sep 17 00:00:00 2001 From: leycec Date: Mon, 8 Jun 2015 01:37:06 -0400 Subject: [PATCH 01/46] Makefile portability and safety improvements. Per GNU makefile conventions, directories hardcoded into the makefile have been replaced by conventional variables (e.g., $(BINDIR)). Zsh completions are now installed to a platform-agnostic rather than Debian-specific directory. Installation no longer requires unit tests (and hence Perl) or manpages (and hence ronn and ruby) and fails if the $(BINDIR) directory does not exist (rather than attempting to unsafely create that directory). Manpages are conditionally installed only if previously generated, which fails if the $(MANDIR) directory does not exist (again, rather than attempting to unsafely create that directory). Zsh completions are conditionally installed only if zsh is found. For both safety and efficiency, abstract targets are now listed as .PHONY. All targets and variables now have human-readable comments. --- BSDmakefile | 17 +++++++++++++ GNUmakefile | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 69 +++++++++++++++++++++++++++++++++++---------------- 3 files changed, 136 insertions(+), 21 deletions(-) create mode 100644 BSDmakefile create mode 100644 GNUmakefile diff --git a/BSDmakefile b/BSDmakefile new file mode 100644 index 00000000..9be15637 --- /dev/null +++ b/BSDmakefile @@ -0,0 +1,17 @@ +# BSD make-specific makefile, read only by BSD make and hence containing +# BSD make-specific extensions (e.g., "ifeq (...)", "$(shell ...)"). + +#FIXME: Conditionalize according to the "GNUmakefile" approach. + +# Default target, running all preparatory installation targets without actually +# installing. This *MUST* be the first non-"."-prefixed target in this makefile. +all: manpages test + +# Install vcsh and supplementary artifacts. +install: all install-common +# Install man pages and zsh completions. + install -m 0644 $(manpages) $(DESTDIR)$(MANDIR)/man1/ + install -m 0644 $(zshcompletions) $(DESTDIR)$(ZSH_COMPLETIONS_DIR)/ + +# Define all platform-agnostic variables and rules. +.include "Makefile" diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 00000000..8fc6e2db --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,71 @@ +# GNU make-specific makefile, read only by GNU make and hence containing +# GNU make-specific extensions (e.g., "ifeq (...)", "$(shell ...)"). + +# Define all platform-agnostic variables and rules. +include Makefile + +# Absolute path of zsh's completions directory. Since Debian-based Linux distros +# prefer a different directory to that of most platforms, test for the existence +# of such directory before falling back to a platform-agnostic directory. +ifneq ($(wildcard $(DESTDIR)$(ZSHDIR_PREFIX)/vendor-completions),) +ZSH_COMPLETIONS_DIR:=$(ZSHDIR_PREFIX)/vendor-completions +else ifneq ($(wildcard $(DESTDIR)$(ZSHDIR_PREFIX)/site-functions),) +ZSH_COMPLETIONS_DIR:=$(ZSHDIR_PREFIX)/site-functions +endif + +# List of targets to be run both when no target is specified and when the +# "install" rule is run. +all_targets:= + +# Non-empty only if the "manpages" target is listed in $(all). +is_manpaging= + +# Non-empty only if the "test" target is listed in $(all). +is_testing= + +# If Ronn is in the current $PATH, generate Ronn-based man pages by default. +ifneq ($(shell command -v "$(RONN)" 2>/dev/null),) +all_targets+= manpages +is_manpaging:=true +endif + +# If Git, Perl, and the Perl-based unit test runner "prove" are all in the +# current $PATH and the requisite Perl modules are in the @INC module path, run +# Perl-based unit tests by default. +ifneq ($(shell command -v git 2>/dev/null),) +ifneq ($(shell command -v perl 2>/dev/null),) +ifneq ($(shell command -v prove 2>/dev/null),) + ifeq ($(shell perl -e 'use Test::Most; use Shell::Command;' 2>&1),) +all_targets+= test +is_testing:=true +endif +endif +endif +endif + +# Default target, running all preparatory installation targets without actually +# installing. This *MUST* be the first non-"."-prefixed target in this makefile. +all: $(all_targets) +# Notify the user of skipped targets. +ifeq ($(is_manpaging),) + @echo 'Skipping man page generation: "$(RONN)" not found.' 1>&2 +endif +ifeq ($(is_testing),) + @echo 'Skipping unit tests: "git", "prove", and/or Perl modules "Test::Most" and "Shell::Command" not found.' 1>&2 +endif + +# Coerce the default target to be the prior target (rather than the first rule +# defined by the makefile included above). +.DEFAULT_GOAL:=all + +# Install vcsh and supplementary artifacts. +install: all install-common +# If the man page has been generated, install it during installation. +ifneq ($(wildcard $(manpages)),) + install -m 0644 $(manpages) $(DESTDIR)$(MANDIR)/man1/ +endif + +# If zsh's completions directory exists, install ours there during installation. +ifneq ($(ZSH_COMPLETIONS_DIR),) + install -m 0644 $(zshcompletions) $(DESTDIR)$(ZSH_COMPLETIONS_DIR)/ +endif diff --git a/Makefile b/Makefile index b9154e7f..75533d11 100644 --- a/Makefile +++ b/Makefile @@ -1,48 +1,75 @@ +# make-agnostic makefile, read by all make flavours including GNU make and hence +# consisting of only POSIX make-compliant syntax. +# +# This makefile defines all variables and rules except those required by and +# including the "all" and "install" rules, whose complexity necessitates +# conditional logic inexpressible in POSIX make-compliant syntax. + +self=vcsh + PREFIX?=/usr +BINDIR=$(PREFIX)/bin DOCDIR_PREFIX=$(PREFIX)/share/doc DOCDIR=$(DOCDIR_PREFIX)/$(self) -ZSHDIR=$(PREFIX)/share/zsh/vendor-completions +MANDIR=$(PREFIX)/share/man RONN ?= ronn -self=vcsh +# Basename of the man page to be generated. manpages=$(self).1 -all=test manpages -all: $(all) +# Basename of our zsh completions script. +zshcompletions=_$(self) + +# Absolute path of zsh's top-level data directory. +ZSHDIR_PREFIX=$(PREFIX)/share/zsh -install: all - install -d $(DESTDIR)$(PREFIX)/bin - install -m 0755 $(self) $(DESTDIR)$(PREFIX)/bin - install -d $(DESTDIR)$(PREFIX)/share/man/man1 - install -m 0644 $(manpages) $(DESTDIR)$(PREFIX)/share/man/man1 +# Absolute path of zsh's completions directory. +ZSH_COMPLETIONS_DIR=$(ZSHDIR_PREFIX)/site-functions + +# List of abstract target names not corresponding to actual paths, preventing +# conflicts with any such paths and improving efficiency in general. +.PHONY: all clean install install-common manpages moo purge test uninstall + +# Install all paths *NOT* requiring conditional and hence non-POSIX logic. +install-common: +# Install the "vcsh" command. + install -m 0755 $(self) $(DESTDIR)$(BINDIR)/ + +# Install documentation. install -d $(DESTDIR)$(DOCDIR) - install -m 0644 README.md $(DESTDIR)$(DOCDIR) - install -m 0644 doc/hooks $(DESTDIR)$(DOCDIR) - install -d $(DESTDIR)$(ZSHDIR) - install -m 0644 _$(self) $(DESTDIR)$(ZSHDIR) + install -m 0644 README.md $(DESTDIR)$(DOCDIR)/ + install -m 0644 doc/hooks $(DESTDIR)$(DOCDIR)/ +# Generate the manpage. manpages: $(manpages) $(self).1: doc/$(self).1.ronn $(RONN) < doc/$(self).1.ronn > $(self).1 || rm $(self).1 +# Remove the generated manpage. clean: rm -rf $(self).1 +# Remove all previously installed paths. uninstall: - rm -rf $(DESTDIR)$(PREFIX)/bin/$(self) - rm -rf $(DESTDIR)$(PREFIX)/share/man/man1/$(self).1 + rm -rf $(DESTDIR)$(BINDIR)/$(self) + rm -rf $(DESTDIR)$(MANDIR)/man1/$(self).1 rm -rf $(DESTDIR)$(DOCDIR) - rm -rf $(DESTDIR)$(ZSHDIR)/_$(self) + rm -rf $(DESTDIR)$(ZSH_COMPLETIONS_DIR)/$(zshcompletions) + +# FIXME: The "--ignore-fail-on-non-empty" option is GNU-specific. -# Potentially harmful, used a non-standard option on purpose. -# If PREFIX=/usr/local and that's empty... +# Remove all previously installed paths and all empty parent directories of +# these paths. Since this is potentially harmful, this target has intentionally +# been given a non-standard name. For example, if $(PREFIX) is "/usr/local" and +# now empty due to uninstalling vcsh, this target would remove "/usr/local"! purge: uninstall - rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/bin/ - rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/man/man1/ + rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(BINDIR) + rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(MANDIR)/man1 rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(DOCDIR) - rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(ZSHDIR) + rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(ZSH_COMPLETIONS_DIR) +# Run all unit tests if both git and Perl's prove are found. test: @if which git > /dev/null; then : ; else echo "'git' not found, exiting..." ; exit 1; fi @if which prove > /dev/null; then prove; else echo "'prove' not found; not running tests"; fi From 66944d009b8df64e0b2ddae757a83899ff8684b7 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 31 Mar 2021 22:44:36 +0300 Subject: [PATCH 02/46] Clear out makefile namespace for autotools --- BSDmakefile | 17 ------------ GNUmakefile | 51 ------------------------------------ Makefile | 75 ----------------------------------------------------- 3 files changed, 143 deletions(-) delete mode 100644 BSDmakefile delete mode 100644 GNUmakefile delete mode 100644 Makefile diff --git a/BSDmakefile b/BSDmakefile deleted file mode 100644 index 0d438a91..00000000 --- a/BSDmakefile +++ /dev/null @@ -1,17 +0,0 @@ -# BSD make-specific makefile, read only by BSD make and hence containing -# BSD make-specific extensions (e.g., "ifeq (...)", "$(shell ...)"). - -#FIXME: Conditionalize according to the "GNUmakefile" approach. - -# Default target, running all preparatory installation targets without actually -# installing. This *MUST* be the first non-"."-prefixed target in this makefile. -all: manpages - -# Install vcsh and supplementary artifacts. -install: all install-common -# Install man pages and zsh completions. - install -m 0644 $(manpages) $(DESTDIR)$(MANDIR)/man1/ - install -m 0644 $(zshcompletions) $(DESTDIR)$(ZSH_COMPLETIONS_DIR)/ - -# Define all platform-agnostic variables and rules. -.include "Makefile" diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100644 index b7cbe77a..00000000 --- a/GNUmakefile +++ /dev/null @@ -1,51 +0,0 @@ -# GNU make-specific makefile, read only by GNU make and hence containing -# GNU make-specific extensions (e.g., "ifeq (...)", "$(shell ...)"). - -# Define all platform-agnostic variables and rules. -include Makefile - -# Absolute path of zsh's completions directory. Since Debian-based Linux distros -# prefer a different directory to that of most platforms, test for the existence -# of such directory before falling back to a platform-agnostic directory. -ifneq ($(wildcard $(DESTDIR)$(ZSHDIR_PREFIX)/vendor-completions),) -ZSH_COMPLETIONS_DIR:=$(ZSHDIR_PREFIX)/vendor-completions -else ifneq ($(wildcard $(DESTDIR)$(ZSHDIR_PREFIX)/site-functions),) -ZSH_COMPLETIONS_DIR:=$(ZSHDIR_PREFIX)/site-functions -endif - -# List of targets to be run both when no target is specified and when the -# "install" rule is run. -all_targets:= - -# Non-empty only if the "manpages" target is listed in $(all). -is_manpaging= - -# If Ronn is in the current $PATH, generate Ronn-based man pages by default. -ifneq ($(shell command -v "$(RONN)" 2>/dev/null),) -all_targets+= manpages -is_manpaging:=true -endif - -# Default target, running all preparatory installation targets without actually -# installing. This *MUST* be the first non-"."-prefixed target in this makefile. -all: $(all_targets) -# Notify the user of skipped targets. -ifeq ($(is_manpaging),) - @echo 'Skipping man page generation: "$(RONN)" not found.' 1>&2 -endif - -# Coerce the default target to be the prior target (rather than the first rule -# defined by the makefile included above). -.DEFAULT_GOAL:=all - -# Install vcsh and supplementary artifacts. -install: all install-common -# If the man page has been generated, install it during installation. -ifneq ($(wildcard $(manpages)),) - install -m 0644 $(manpages) $(DESTDIR)$(MANDIR)/man1/ -endif - -# If zsh's completions directory exists, install ours there during installation. -ifneq ($(ZSH_COMPLETIONS_DIR),) - install -m 0644 $(zshcompletions) $(DESTDIR)$(ZSH_COMPLETIONS_DIR)/ -endif diff --git a/Makefile b/Makefile deleted file mode 100644 index 3e487755..00000000 --- a/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# make-agnostic makefile, read by all make flavours including GNU make and hence -# consisting of only POSIX make-compliant syntax. -# -# This makefile defines all variables and rules except those required by and -# including the "all" and "install" rules, whose complexity necessitates -# conditional logic inexpressible in POSIX make-compliant syntax. - -self=vcsh - -PREFIX?=/usr -BINDIR=$(PREFIX)/bin -DOCDIR_PREFIX=$(PREFIX)/share/doc -DOCDIR=$(DOCDIR_PREFIX)/$(self) -MANDIR=$(PREFIX)/share/man -RONN ?= ronn - -# Basename of the man page to be generated. -manpages=$(self).1 - -# Basename of our zsh completions script. -zshcompletions=_$(self) - -# Absolute path of zsh's top-level data directory. -ZSHDIR_PREFIX=$(PREFIX)/share/zsh - -# Absolute path of zsh's completions directory. -ZSH_COMPLETIONS_DIR=$(ZSHDIR_PREFIX)/site-functions - -# List of abstract target names not corresponding to actual paths, preventing -# conflicts with any such paths and improving efficiency in general. -.PHONY: all clean install install-common manpages moo purge test uninstall - -# Install all paths *NOT* requiring conditional and hence non-POSIX logic. -install-common: -# Install the "vcsh" command. - install -m 0755 $(self) $(DESTDIR)$(BINDIR)/ - -# Install documentation. - install -d $(DESTDIR)$(DOCDIR) - install -m 0644 README.md $(DESTDIR)$(DOCDIR)/ - install -m 0644 doc/hooks $(DESTDIR)$(DOCDIR)/ - -# Generate the manpage. -manpages: $(manpages) - -$(self).1: doc/$(self).1.ronn - $(RONN) < doc/$(self).1.ronn > $(self).1 || rm $(self).1 - -# Remove the generated manpage. -clean: - rm -rf $(self).1 - -# Remove all previously installed paths. -uninstall: - rm -rf $(DESTDIR)$(BINDIR)/$(self) - rm -rf $(DESTDIR)$(MANDIR)/man1/$(self).1 - rm -rf $(DESTDIR)$(DOCDIR) - rm -rf $(DESTDIR)$(ZSH_COMPLETIONS_DIR)/$(zshcompletions) - -# FIXME: The "--ignore-fail-on-non-empty" option is GNU-specific. - -# Remove all previously installed paths and all empty parent directories of -# these paths. Since this is potentially harmful, this target has intentionally -# been given a non-standard name. For example, if $(PREFIX) is "/usr/local" and -# now empty due to uninstalling vcsh, this target would remove "/usr/local"! -purge: uninstall - rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(BINDIR) - rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(MANDIR)/man1 - rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(DOCDIR) - rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(ZSH_COMPLETIONS_DIR) - -# Run all unit tests if both git and Perl's prove are found. -test: - @if which git > /dev/null; then : ; else echo "'git' not found, exiting..." ; exit 1; fi - @if which prove > /dev/null; then prove; else echo "'prove' not found; not running tests"; fi From c28ba7082335cb76c0fb717ce7114586ce9297a6 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 3 Apr 2021 22:09:15 +0300 Subject: [PATCH 03/46] Setup basic autotools based tooling --- Makefile.am | 10 ++++++++++ configure.ac | 8 ++++++++ vcsh => vcsh.in | 0 3 files changed, 18 insertions(+) create mode 100644 Makefile.am create mode 100644 configure.ac rename vcsh => vcsh.in (100%) diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..9c2c5f0a --- /dev/null +++ b/Makefile.am @@ -0,0 +1,10 @@ +.ONESHELL: +.SECONDARY: +.SECONDEXPANSION: +.DELETE_ON_ERROR: + +licensedir = $(datarootdir)/licenses/vcsh + +dist_doc_DATA = README.md changelog doc/INSTALL.md doc/PACKAGING.md doc/README.md doc/error_codes.md doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber +dist_license_DATA = LICENSE CONTRIBUTORS +bin_SCRIPTS = vcsh diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..5d11ea3c --- /dev/null +++ b/configure.ac @@ -0,0 +1,8 @@ +AC_PREREQ([2.69]) +AC_INIT([vcsh], [1.20190619]) +AM_INIT_AUTOMAKE + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([vcsh], [chmod +x vcsh]) + +AC_OUTPUT diff --git a/vcsh b/vcsh.in similarity index 100% rename from vcsh rename to vcsh.in From 58471e2c0a5eb284e7e3728312f8268b303fcc4b Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 3 Apr 2021 22:23:57 +0300 Subject: [PATCH 04/46] Add machinery to automatically manage VERSION --- Makefile.am | 13 +++ build-aux/git-version-gen | 220 ++++++++++++++++++++++++++++++++++++++ configure.ac | 9 +- 3 files changed, 241 insertions(+), 1 deletion(-) create mode 100755 build-aux/git-version-gen diff --git a/Makefile.am b/Makefile.am index 9c2c5f0a..1cc017ec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,3 +8,16 @@ licensedir = $(datarootdir)/licenses/vcsh dist_doc_DATA = README.md changelog doc/INSTALL.md doc/PACKAGING.md doc/README.md doc/error_codes.md doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber dist_license_DATA = LICENSE CONTRIBUTORS bin_SCRIPTS = vcsh + +EXTRA_DIST = .version + +BUILT_SOURCES = .version + +.version: $(shell $(AWK) '{print ".git/" $$2}' .git/HEAD 2>/dev/null ||:) + [ -e "$@" ] && mv "$@" "$@-prev" || touch "$@-prev" + $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" + $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force + +dist-hook: + cd $(distdir) + echo $(VERSION) > .tarball-version diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen new file mode 100755 index 00000000..e80e810e --- /dev/null +++ b/build-aux/git-version-gen @@ -0,0 +1,220 @@ +#!/usr/bin/env sh + +# Print a version string. +scriptversion=2012-03-18.17; # UTC + +# Copyright (C) 2007-2012 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 of the License, 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 . + +# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/. +# It may be run two ways: +# - from a git repository in which the "git describe" command below +# produces useful output (thus requiring at least one signed tag) +# - from a non-git-repo directory containing a .tarball-version file, which +# presumes this script is invoked like "./git-version-gen .tarball-version". + +# In order to use intra-version strings in your project, you will need two +# separate generated version string files: +# +# .tarball-version - present only in a distribution tarball, and not in +# a checked-out repository. Created with contents that were learned at +# the last time autoconf was run, and used by git-version-gen. Must not +# be present in either $(srcdir) or $(builddir) for git-version-gen to +# give accurate answers during normal development with a checked out tree, +# but must be present in a tarball when there is no version control system. +# Therefore, it cannot be used in any dependencies. GNUmakefile has +# hooks to force a reconfigure at distribution time to get the value +# correct, without penalizing normal development with extra reconfigures. +# +# .version - present in a checked-out repository and in a distribution +# tarball. Usable in dependencies, particularly for files that don't +# want to depend on config.h but do want to track version changes. +# Delete this file prior to any autoconf run where you want to rebuild +# files to pick up a version string change; and leave it stale to +# minimize rebuild time after unrelated changes to configure sources. +# +# As with any generated file in a VC'd directory, you should add +# /.version to .gitignore, so that you don't accidentally commit it. +# .tarball-version is never generated in a VC'd directory, so needn't +# be listed there. +# +# Use the following line in your configure.ac, so that $(VERSION) will +# automatically be up-to-date each time configure is run (and note that +# since configure.ac no longer includes a version string, Makefile rules +# should not depend on configure.ac for version updates). +# +# AC_INIT([GNU project], +# m4_esyscmd([build-aux/git-version-gen .tarball-version]), +# [bug-project@example]) +# +# Then use the following lines in your Makefile.am, so that .version +# will be present for dependencies, and so that .version and +# .tarball-version will exist in distribution tarballs. +# +# EXTRA_DIST = $(top_srcdir)/.version +# BUILT_SOURCES = $(top_srcdir)/.version +# $(top_srcdir)/.version: +# echo $(VERSION) > $@-t && mv $@-t $@ +# dist-hook: +# echo $(VERSION) > $(distdir)/.tarball-version + + +me=$0 + +version="git-version-gen $scriptversion + +Copyright 2011 Free Software Foundation, Inc. +There is NO warranty. You may redistribute this software +under the terms of the GNU General Public License. +For more information about these matters, see the files named COPYING." + +usage="\ +Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT] +Print a version string. + +Options: + + --prefix prefix of git tags (default 'v') + + --help display this help and exit + --version output version information and exit + +Running without arguments will suffice in most cases." + +prefix=v + +while test $# -gt 0; do + case $1 in + --help) echo "$usage"; exit 0;; + --version) echo "$version"; exit 0;; + --prefix) shift; prefix="$1";; + -*) + echo "$0: Unknown option '$1'." >&2 + echo "$0: Try '--help' for more information." >&2 + exit 1;; + *) + if test -z "$tarball_version_file"; then + tarball_version_file="$1" + elif test -z "$tag_sed_script"; then + tag_sed_script="$1" + else + echo "$0: extra non-option argument '$1'." >&2 + exit 1 + fi;; + esac + shift +done + +if test -z "$tarball_version_file"; then + echo "$usage" + exit 1 +fi + +tag_sed_script="${tag_sed_script:-s/x/x/}" + +nl=' +' + +# Avoid meddling by environment variable of the same name. +v= +v_from_git= + +# First see if there is a tarball-only version file. +# then try "git describe", then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || v= + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test -z "$v" \ + && echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2 +fi + +if test -n "$v" +then + : # use $v +# Otherwise, if there is at least one git commit involving the working +# directory, and "git describe" output looks sensible, use that to +# derive a version string. +elif test "`git log -1 --pretty=format:x . 2>/dev/null`" = x \ + && v=`git describe --tags --abbrev=7 --match="$prefix*" HEAD 2>/dev/null \ + || git describe --tags --abbrev=7 HEAD 2>/dev/null \ + || git log -1 --pretty=format:'v0-HEAD-%h' 2>/dev/null` \ + && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ + && case $v in + $prefix[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Is this a new git that lists number of commits since the last + # tag or the previous older version that did not? + # Newer: v6.10-77-g0f8faeb + # Older: v6.10-g0f8faeb + case $v in + *-*-*) : git describe is okay three part flavor ;; + *-*) + : git describe is older two part flavor + # Recreate the number of commits and rewrite such that the + # result is the same as if we were using the newer version + # of git describe. + vtag=`echo "$v" | sed 's/-.*//'` + commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \ + || { commit_list=failed; + echo "$0: WARNING: git rev-list failed" 1>&2; } + numcommits=`echo "$commit_list" | wc -l` + v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; + test "$commit_list" = failed && v=UNKNOWN + ;; + esac + + v=`echo "$v" | sed 's/-/.r/'`; + v_from_git=1 +else + v=UNKNOWN +fi + +v=`echo "$v" |sed "s/^$prefix//"` + +# Test whether to append the "-dirty" suffix only if the version +# string we're using came from git. I.e., skip the test if it's "UNKNOWN" +# or if it came from .tarball-version. +if test -n "$v_from_git"; then + # Don't declare a version "dirty" merely because a time stamp has changed. + git update-index --refresh > /dev/null 2>&1 + + dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty= + case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; + esac +fi + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +echo "$v" | tr -d "$nl" + +# 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/configure.ac b/configure.ac index 5d11ea3c..c8736185 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,14 @@ AC_PREREQ([2.69]) -AC_INIT([vcsh], [1.20190619]) +AC_INIT([vcsh], [m4_esyscmd(build-aux/git-version-gen .tarball-version)]) +AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE +AC_PROG_AWK + +AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required])]) + +AX_PROGVAR([cmp]) + AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([vcsh], [chmod +x vcsh]) From 7e72b0bbd851df3cdccd879bb1a5eec1bb327085 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 3 Apr 2021 22:24:46 +0300 Subject: [PATCH 05/46] Add bootstrap script to ease builds from Git clones --- bootstrap.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 00000000..0d8d2841 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh +set -e + +incomplete_source () { + printf '%s\n' \ + "$1. Please either:" \ + "* $2," \ + "* or use the source packages instead of a repo archive" \ + "* or use a full Git clone." >&2 + exit 1 +} + +# This enables easy building from Github's snapshot archives +if [ ! -e ".git" ]; then + if [ ! -f ".tarball-version" ]; then + incomplete_source "No version information found" \ + "identify the correct version with \`echo \$version > .tarball-version\`" + fi +else + # Just a head start to save a ./configure cycle + ./build-aux/git-version-gen .tarball-version > .version +fi + +autoreconf --install From 04d82be71a25b4906bae2de4fe85ded549d1f61e Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 3 Apr 2021 22:31:32 +0300 Subject: [PATCH 06/46] Setup autoconf with project preferences --- Makefile.am | 2 ++ configure.ac | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 1cc017ec..a01ab2f6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +ACLOCAL_AMFLAGS = -I build-aux + .ONESHELL: .SECONDARY: .SECONDEXPANSION: diff --git a/configure.ac b/configure.ac index c8736185..7c7c1c90 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,9 @@ AC_PREREQ([2.69]) AC_INIT([vcsh], [m4_esyscmd(build-aux/git-version-gen .tarball-version)]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([foreign tar-pax dist-xz dist-zip no-dist-gzip color-tests]) +AM_SILENT_RULES([yes]) +AC_CONFIG_MACRO_DIR([build-aux]) AC_PROG_AWK From ee2a9aaa2963096bcc9d5745c676181a1dc2003d Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 3 Apr 2021 22:50:32 +0300 Subject: [PATCH 07/46] Update EditorConfig and modelines --- .editorconfig | 2 +- _vcsh | 6 ++++++ _vcsh_bash | 6 +++++- vcsh.in | 6 ++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 32d78adb..03803dee 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,6 +4,6 @@ root = true end_of_line = lf insert_final_newline = true -[vcsh] +[{vcsh.in,_vcsh,_vsh_bash}] indent_style = tab trim_trailing_whitespace = true diff --git a/_vcsh b/_vcsh index 72924ce2..f90fdebf 100644 --- a/_vcsh +++ b/_vcsh @@ -153,3 +153,9 @@ function _vcsh () { } _vcsh "$@" + +# Local Variables: +# mode:shell-script +# sh-shell:zsh +# End: +# vim: ft=zsh: diff --git a/_vcsh_bash b/_vcsh_bash index 3cfe88a6..973ae6db 100644 --- a/_vcsh_bash +++ b/_vcsh_bash @@ -135,4 +135,8 @@ _vcsh () { complete -F _vcsh vcsh -# vim: ft=sh: +# Local Variables: +# mode:shell-script +# sh-shell:bash +# End: +# vim: ft=bash: diff --git a/vcsh.in b/vcsh.in index ba289e24..11e7f131 100755 --- a/vcsh.in +++ b/vcsh.in @@ -674,3 +674,9 @@ $VCSH_COMMAND "$@" hook post-command verbose "$VCSH_COMMAND end, exiting" exit $VCSH_COMMAND_RETURN_CODE + +# Local Variables: +# mode:shell-script +# sh-shell:sh +# End: +# vim: ft=sh: From 7f1ccc6632b54196a563cbd2959784e9b0f4a037 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 3 Apr 2021 22:32:24 +0300 Subject: [PATCH 08/46] Use autoconf to check dependencies and set paths to utils --- configure.ac | 7 ++++ vcsh.in | 92 +++++++++++++++++++++++++--------------------------- 2 files changed, 52 insertions(+), 47 deletions(-) diff --git a/configure.ac b/configure.ac index 7c7c1c90..0e4676fb 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,13 @@ AM_SILENT_RULES([yes]) AC_CONFIG_MACRO_DIR([build-aux]) AC_PROG_AWK +AC_PROG_GREP +AC_PROG_SED + +AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required])]) + +AX_PROGVAR([comm]) +AX_PROGVAR([git]) AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required])]) diff --git a/vcsh.in b/vcsh.in index 11e7f131..bdab3ffa 100755 --- a/vcsh.in +++ b/vcsh.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!@SHELL@ # This program is licensed under the GNU GPL version 2 or later. # (c) Richard "RichiH" Hartmann , 2011-2015 @@ -159,26 +159,26 @@ info() { clone() { hook pre-clone init - git remote add origin "$GIT_REMOTE" - git checkout -b "$VCSH_BRANCH" || return $? - git config branch."$VCSH_BRANCH".remote origin - git config branch."$VCSH_BRANCH".merge refs/heads/"$VCSH_BRANCH" - if [ $(git ls-remote origin "$VCSH_BRANCH" 2> /dev/null | wc -l ) -lt 1 ]; then + @GIT@ remote add origin "$GIT_REMOTE" + @GIT@ checkout -b "$VCSH_BRANCH" || return $? + @GIT@ config branch."$VCSH_BRANCH".remote origin + @GIT@ config branch."$VCSH_BRANCH".merge refs/heads/"$VCSH_BRANCH" + if [ $(@GIT@ ls-remote origin "$VCSH_BRANCH" 2> /dev/null | wc -l ) -lt 1 ]; then info "remote is empty, not merging anything. You should add files to your new repository." # editorconfig-checker-disable-line exit fi - GIT_VERSION_MAJOR=$(git --version | sed -E -n 's/.* ([0-9]+)\..*/\1/p' ) + GIT_VERSION_MAJOR=$(@GIT@ --version | @SED@ -E -n 's/.* ([0-9]+)\..*/\1/p' ) if [ 1 -lt "$GIT_VERSION_MAJOR" ];then - git fetch origin "$VCSH_BRANCH" + @GIT@ fetch origin "$VCSH_BRANCH" else - git fetch origin + @GIT@ fetch origin fi hook pre-merge - git read-tree -n -mu origin/"$VCSH_BRANCH" \ + @GIT@ read-tree -n -mu origin/"$VCSH_BRANCH" \ || fatal "will stop after fetching and not try to merge! Once this situation has been resolved, run 'vcsh $VCSH_REPO_NAME pull' to finish cloning." 17 # editorconfig-checker-disable-line - git -c merge.ff=true merge origin/"$VCSH_BRANCH" + @GIT@ -c merge.ff=true merge origin/"$VCSH_BRANCH" hook post-merge hook post-clone retire @@ -192,7 +192,7 @@ commit() { echo "$VCSH_REPO_NAME: " GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR use - git commit --untracked-files=no --quiet "$@" + @GIT@ commit --untracked-files=no --quiet "$@" VCSH_COMMAND_RETURN_CODE=$? echo done @@ -203,7 +203,7 @@ delete() { cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11 use info "This operation WILL DESTROY DATA!" - files=$(git ls-files) + files=$(@GIT@ ls-files) echo "These files will be deleted: $files @@ -230,7 +230,7 @@ foreach() { # We default to prefixing `git` to all commands passed to foreach, but # allow running in general context with -g - command_prefix=git + command_prefix=@GIT@ while getopts "g" flag; do if [ x"$1" = x'-g' ]; then unset command_prefix @@ -263,7 +263,7 @@ init() { [ ! -e "$GIT_DIR" ] || fatal "'$GIT_DIR' exists" 10 mkdir -p "$VCSH_BASE" || fatal "could not create '$VCSH_BASE'" 50 cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11 - git init --shared=false + @GIT@ init --shared=false upgrade hook post-init } @@ -276,7 +276,7 @@ list() { get_files() { GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR - git ls-files --full-name + @GIT@ ls-files --full-name } list_tracked() { @@ -291,7 +291,7 @@ list_tracked() { } list_tracked_helper() { - sed "s,^,$(printf '%s\n' "$VCSH_BASE/" | sed 's/[,\&]/\\&/g')," | sort -u + @SED@ "s,^,$(printf '%s\n' "$VCSH_BASE/" | @SED@ 's/[,\&]/\\&/g')," | sort -u } list_tracked_by() { @@ -299,8 +299,6 @@ list_tracked_by() { } list_untracked() { - command -v 'comm' >/dev/null 2>&1 || fatal "Could not find 'comm'" - temp_file_others=$(mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX") || fatal 'Could not create temp file' temp_file_untracked=$(mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX") || fatal 'Could not create temp file' temp_file_untracked_copy=$(mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX") || fatal 'Could not create temp file' @@ -335,7 +333,7 @@ list_untracked() { list_untracked_helper() { export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" - git ls-files --others $exclude_standard_opt "$directory_opt" | ( + @GIT@ ls-files --others $exclude_standard_opt "$directory_opt" | ( while read line; do echo "$line" directory_component=${line%%/*} @@ -347,7 +345,7 @@ list_untracked_helper() { cp $temp_file_others $temp_file_untracked || fatal 'Could not copy temp file' fi cp $temp_file_untracked $temp_file_untracked_copy || fatal 'Could not copy temp file' - comm -12 $temp_file_others $temp_file_untracked_copy > $temp_file_untracked + @COMM@ -12 $temp_file_others $temp_file_untracked_copy > $temp_file_untracked } pull() { @@ -356,7 +354,7 @@ pull() { printf '%s: ' "$VCSH_REPO_NAME" GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR use - git pull + @GIT@ pull VCSH_COMMAND_RETURN_CODE=$? echo done @@ -369,7 +367,7 @@ push() { printf '%s: ' "$VCSH_REPO_NAME" GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR use - git push + @GIT@ push VCSH_COMMAND_RETURN_CODE=$? echo done @@ -421,13 +419,13 @@ status_helper() { GIT_DIR=$VCSH_REPO_D/$1.git; export GIT_DIR VCSH_GIT_OPTIONS=$2 use - remote_tracking_branch=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2> /dev/null) && { - commits_behind=$(git log ..${remote_tracking_branch} --oneline | wc -l) - commits_ahead=$(git log ${remote_tracking_branch}.. --oneline | wc -l) + remote_tracking_branch=$(@GIT@ rev-parse --abbrev-ref --symbolic-full-name @{u} 2> /dev/null) && { + commits_behind=$(@GIT@ log ..${remote_tracking_branch} --oneline | wc -l) + commits_ahead=$(@GIT@ log ${remote_tracking_branch}.. --oneline | wc -l) [ ${commits_behind} -ne 0 ] && echo "Behind $remote_tracking_branch by $commits_behind commits" [ ${commits_ahead} -ne 0 ] && echo "Ahead of $remote_tracking_branch by $commits_ahead commits" } - git ${VCSH_GIT_OPTIONS} status --short --untracked-files='no' + @GIT@ ${VCSH_GIT_OPTIONS} status --short --untracked-files='no' VCSH_COMMAND_RETURN_CODE=$? } @@ -436,20 +434,20 @@ upgrade() { # fake-bare repositories are not bare, actually. Set this to false # because otherwise Git complains "fatal: core.bare and core.worktree # do not make sense" - git config core.bare false + @GIT@ config core.bare false # core.worktree may be absolute or relative to $GIT_DIR, depending on # user preference if [ ! "x$VCSH_WORKTREE" = 'xabsolute' ]; then - git config core.worktree "$(cd "$GIT_DIR" && GIT_WORK_TREE=$VCSH_BASE git rev-parse --show-cdup)" + @GIT@ config core.worktree "$(cd "$GIT_DIR" && GIT_WORK_TREE=$VCSH_BASE @GIT@ rev-parse --show-cdup)" elif [ ! "x$VCSH_WORKTREE" = 'xrelative' ]; then - git config core.worktree "$VCSH_BASE" + @GIT@ config core.worktree "$VCSH_BASE" fi - [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && git config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME" - [ ! "x$VCSH_GITATTRIBUTES" = 'xnone' ] && git config core.attributesfile ".gitattributes.d/$VCSH_REPO_NAME" - git config vcsh.vcsh 'true' + [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && @GIT@ config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME" + [ ! "x$VCSH_GITATTRIBUTES" = 'xnone' ] && @GIT@ config core.attributesfile ".gitattributes.d/$VCSH_REPO_NAME" + @GIT@ config vcsh.vcsh 'true' use - [ -e "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" ] && git add -f "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" - [ -e "$VCSH_BASE/.gitattributes.d/$VCSH_REPO_NAME" ] && git add -f "$VCSH_BASE/.gitattributes.d/$VCSH_REPO_NAME" + [ -e "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" ] && @GIT@ add -f "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" + [ -e "$VCSH_BASE/.gitattributes.d/$VCSH_REPO_NAME" ] && @GIT@ add -f "$VCSH_BASE/.gitattributes.d/$VCSH_REPO_NAME" hook post-upgrade } @@ -460,7 +458,7 @@ use() { which() { output=$(for VCSH_REPO_NAME in $(list); do - get_files | grep -- "$VCSH_COMMAND_PARAMETER" | sed "s/^/$VCSH_REPO_NAME: /" + get_files | @GREP@ -- "$VCSH_COMMAND_PARAMETER" | @SED@ "s/^/$VCSH_REPO_NAME: /" done | sort -u) if [ -z "$output" ]; then fatal "'$VCSH_COMMAND_PARAMETER' does not exist" 1 @@ -478,12 +476,12 @@ write_gitignore() { use cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11 - local GIT_VERSION="$(git --version)" - local GIT_VERSION_MAJOR=$(echo $GIT_VERSION | sed -E -n 's/.* ([0-9]+)\..*/\1/p') - local GIT_VERSION_MINOR=$(echo $GIT_VERSION | sed -E -n 's/.* ([0-9]+)\.([0-9]+)\..*/\2/p') + local GIT_VERSION="$(@GIT@ --version)" + local GIT_VERSION_MAJOR=$(echo $GIT_VERSION | @SED@ -E -n 's/.* ([0-9]+)\..*/\1/p') + local GIT_VERSION_MINOR=$(echo $GIT_VERSION | @SED@ -E -n 's/.* ([0-9]+)\.([0-9]+)\..*/\2/p') OLDIFS=$IFS IFS=$(printf '\n\t') - gitignores=$(for file in $(git ls-files); do + gitignores=$(for file in $(@GIT@ ls-files); do if [ $GIT_VERSION_MAJOR -ge 2 -a $GIT_VERSION_MINOR -ge 7 ]; then echo "$file"; else @@ -502,9 +500,9 @@ write_gitignore() { echo '*' > "$tempfile" || fatal "could not write to '$tempfile'" 57 for gitignore in $gitignores; do - echo "$gitignore" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57 + echo "$gitignore" | @SED@ 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57 if [ "x$VCSH_GITIGNORE" = 'xrecursive' ] && [ -d "$gitignore" ]; then - { echo "$gitignore/*" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57; } + { echo "$gitignore/*" | @SED@ 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57; } fi done IFS=$OLDIFS @@ -521,7 +519,7 @@ write_gitignore() { fatal "could not move '$tempfile' to '$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME'" 53 } -debug $(git version) +debug $(@GIT@ version) if [ ! "x$VCSH_GITIGNORE" = 'xexact' ] && [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && [ ! "x$VCSH_GITIGNORE" = 'xrecursive' ]; then fatal "'\$VCSH_GITIGNORE' must equal 'exact', 'none', or 'recursive'" 1 @@ -575,7 +573,7 @@ elif [ "$VCSH_COMMAND" = 'help' ]; then help && exit elif [ "$VCSH_COMMAND" = 'version' ]; then echo "$SELF $VERSION" - git version + @GIT@ version exit elif [ x"$VCSH_COMMAND" = x'which' ]; then [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a filename" 1 @@ -622,7 +620,7 @@ elif [ -n "$2" ]; then GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR [ -d "$GIT_DIR" ] || { help; exit 1; } shift 1 - set -- "git" "$@" + set -- "@GIT@" "$@" elif [ -n "$VCSH_COMMAND" ]; then VCSH_COMMAND='enter'; export VCSH_COMMAND VCSH_REPO_NAME=$1; export VCSH_REPO_NAME @@ -635,7 +633,7 @@ fi # Did we receive a directory instead of a name? # Mangle the input to fit normal operation. -if echo "$VCSH_REPO_NAME" | grep -q '/'; then +if echo "$VCSH_REPO_NAME" | @GREP@ -q '/'; then GIT_DIR=$VCSH_REPO_NAME; export GIT_DIR VCSH_REPO_NAME=$(basename "$VCSH_REPO_NAME" .git); export VCSH_REPO_NAME fi @@ -657,7 +655,7 @@ check_dir "$VCSH_REPO_D" [ ! "x$VCSH_GITATTRIBUTES" = 'xnone' ] && check_dir "$VCSH_BASE/.gitattributes.d" verbose "$VCSH_COMMAND begin" -VCSH_COMMAND=$(echo "$VCSH_COMMAND" | sed 's/-/_/g'); export VCSH_COMMAND +VCSH_COMMAND=$(echo "$VCSH_COMMAND" | @SED@ 's/-/_/g'); export VCSH_COMMAND # Source repo-specific configuration file [ -r "$XDG_CONFIG_HOME/vcsh/config.d/$VCSH_REPO_NAME" ] && . "$XDG_CONFIG_HOME/vcsh/config.d/$VCSH_REPO_NAME" From 4fe270ed3365b11b85f34583b43b2ac46fb6cab5 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 3 Apr 2021 23:43:12 +0300 Subject: [PATCH 09/46] Use autoconf to set VERSION in script --- vcsh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vcsh.in b/vcsh.in index bdab3ffa..11e9f4ed 100755 --- a/vcsh.in +++ b/vcsh.in @@ -16,10 +16,10 @@ [ -n "$VCSH_DEBUG" ] && set -vx -# If '.git-HEAD' is appended to the version, you are seeing an unreleased -# version of vcsh; the master branch is supposed to be clean at all times +# If '.r-g' is appended to the version, you are seeing an unreleased +# version of vcsh; the main branch is supposed to be clean at all times # so you can most likely just use it nonetheless -VERSION='1.20141026' +VERSION='@VERSION@' SELF=$(basename $0) # Ensure all files created are accessible only to the current user. From 044525acf93bb3f0188be207cdd9693305f341b0 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 00:42:39 +0300 Subject: [PATCH 10/46] Add renamable output support, script can be named anything --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 0e4676fb..3ac89b68 100644 --- a/configure.ac +++ b/configure.ac @@ -21,4 +21,6 @@ AX_PROGVAR([cmp]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([vcsh], [chmod +x vcsh]) +AC_ARG_PROGRAM + AC_OUTPUT From a5737c0b411e658490bfaf561795ec2c092dfc61 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 00:04:26 +0300 Subject: [PATCH 11/46] Port manual make rules for man pages to autotools --- Makefile.am | 4 ++++ configure.ac | 1 + 2 files changed, 5 insertions(+) diff --git a/Makefile.am b/Makefile.am index a01ab2f6..2d5dce9c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,12 +9,16 @@ licensedir = $(datarootdir)/licenses/vcsh dist_doc_DATA = README.md changelog doc/INSTALL.md doc/PACKAGING.md doc/README.md doc/error_codes.md doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber dist_license_DATA = LICENSE CONTRIBUTORS +dist_man_MANS = vcsh.1 bin_SCRIPTS = vcsh EXTRA_DIST = .version BUILT_SOURCES = .version +vcsh.1: doc/vcsh.1.ronn + $(RONN) < $< > $@ + .version: $(shell $(AWK) '{print ".git/" $$2}' .git/HEAD 2>/dev/null ||:) [ -e "$@" ] && mv "$@" "$@-prev" || touch "$@-prev" $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" diff --git a/configure.ac b/configure.ac index 3ac89b68..ac5a608b 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,7 @@ AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n " AX_PROGVAR([comm]) AX_PROGVAR([git]) +AX_PROGVAR([ronn]) AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required])]) From f17cb519dc1457f75cc783f322ae62723ce1eca0 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 00:13:05 +0300 Subject: [PATCH 12/46] Port manual make rules for completions to autotools --- .editorconfig | 2 +- Makefile.am | 20 ++++++++++++++++++- _vcsh_bash => completions/vcsh.bash | 6 ------ _vcsh => completions/vcsh.zsh | 6 ------ configure.ac | 31 ++++++++++++++++++++++++++--- 5 files changed, 48 insertions(+), 17 deletions(-) rename _vcsh_bash => completions/vcsh.bash (97%) rename _vcsh => completions/vcsh.zsh (97%) diff --git a/.editorconfig b/.editorconfig index 03803dee..abd7452a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,6 +4,6 @@ root = true end_of_line = lf insert_final_newline = true -[{vcsh.in,_vcsh,_vsh_bash}] +[{vcsh.in,completions/vcsh.*}] indent_style = tab trim_trailing_whitespace = true diff --git a/Makefile.am b/Makefile.am index 2d5dce9c..2a265b66 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,6 +5,8 @@ ACLOCAL_AMFLAGS = -I build-aux .SECONDEXPANSION: .DELETE_ON_ERROR: +_vcsh = $(program_prefix)$(shell sed -e "$(program_transform_name)" <<< vcsh)$(program_suffix) + licensedir = $(datarootdir)/licenses/vcsh dist_doc_DATA = README.md changelog doc/INSTALL.md doc/PACKAGING.md doc/README.md doc/error_codes.md doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber @@ -12,13 +14,29 @@ dist_license_DATA = LICENSE CONTRIBUTORS dist_man_MANS = vcsh.1 bin_SCRIPTS = vcsh -EXTRA_DIST = .version +EXTRA_DIST = .version completions/vcsh.bash completions/vcsh.zsh BUILT_SOURCES = .version +if ENABLE_BASH_COMPLETION +bashcompletiondir = $(BASH_COMPLETION_DIR) +nodist_bashcompletion_DATA = completions/$(_vcsh) +endif + +if ENABLE_ZSH_COMPLETION +zshcompletiondir = $(ZSH_COMPLETION_DIR) +nodist_zshcompletion_DATA = completions/_$(_vcsh) +endif + vcsh.1: doc/vcsh.1.ronn $(RONN) < $< > $@ +completions/$(_vcsh): completions/vcsh.bash + cp -bf $< $@ + +completions/_$(_vcsh): completions/vcsh.zsh + cp -bf $< $@ + .version: $(shell $(AWK) '{print ".git/" $$2}' .git/HEAD 2>/dev/null ||:) [ -e "$@" ] && mv "$@" "$@-prev" || touch "$@-prev" $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" diff --git a/_vcsh_bash b/completions/vcsh.bash similarity index 97% rename from _vcsh_bash rename to completions/vcsh.bash index 973ae6db..b60d9cb7 100644 --- a/_vcsh_bash +++ b/completions/vcsh.bash @@ -134,9 +134,3 @@ _vcsh () { } complete -F _vcsh vcsh - -# Local Variables: -# mode:shell-script -# sh-shell:bash -# End: -# vim: ft=bash: diff --git a/_vcsh b/completions/vcsh.zsh similarity index 97% rename from _vcsh rename to completions/vcsh.zsh index f90fdebf..72924ce2 100644 --- a/_vcsh +++ b/completions/vcsh.zsh @@ -153,9 +153,3 @@ function _vcsh () { } _vcsh "$@" - -# Local Variables: -# mode:shell-script -# sh-shell:zsh -# End: -# vim: ft=zsh: diff --git a/configure.ac b/configure.ac index ac5a608b..511c649f 100644 --- a/configure.ac +++ b/configure.ac @@ -12,12 +12,37 @@ AC_PROG_SED AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required])]) AX_PROGVAR([comm]) +AX_PROGVAR([cmp]) AX_PROGVAR([git]) AX_PROGVAR([ronn]) -AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required])]) - -AX_PROGVAR([cmp]) +AC_ARG_WITH([bash-completion-dir], + AS_HELP_STRING([--with-bash-completion-dir[=PATH]], + [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]), + [], + [with_bash_completion_dir=yes]) +if test "x$with_bash_completion_dir" = "xyes"; then + PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], + [BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"], + [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]) +else + BASH_COMPLETION_DIR="$with_bash_completion_dir" +fi +AC_SUBST([BASH_COMPLETION_DIR]) +AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"]) + +AC_ARG_WITH([zsh-completion-dir], + AS_HELP_STRING([--with-zsh-completion-dir[=PATH]], + [Install the zsh auto-completion script in this directory. @<:@default=yes@:>@]), + [], + [with_zsh_completion_dir=yes]) +if test "x$with_zsh_completion_dir" = "xyes"; then + ZSH_COMPLETION_DIR="$datadir/zsh/site-functions" +else + ZSH_COMPLETION_DIR="$with_zsh_completion_dir" +fi +AC_SUBST([ZSH_COMPLETION_DIR]) +AM_CONDITIONAL([ENABLE_ZSH_COMPLETION],[test "x$with_zsh_completion_dir" != "xno"]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([vcsh], [chmod +x vcsh]) From 34fb3031afc81fdb9ac023236d64e1c38e206222 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 00:59:28 +0300 Subject: [PATCH 13/46] Copy perl module dependency script from autoconf-archive --- build-aux/ax_prog_perl_modules.m4 | 77 +++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 build-aux/ax_prog_perl_modules.m4 diff --git a/build-aux/ax_prog_perl_modules.m4 b/build-aux/ax_prog_perl_modules.m4 new file mode 100644 index 00000000..70b3230e --- /dev/null +++ b/build-aux/ax_prog_perl_modules.m4 @@ -0,0 +1,77 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# Checks to see if the given perl modules are available. If true the shell +# commands in ACTION-IF-TRUE are executed. If not the shell commands in +# ACTION-IF-FALSE are run. Note if $PERL is not set (for example by +# calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl) +# will be run. +# +# MODULES is a space separated list of module names. To check for a +# minimum version of a module, append the version number to the module +# name, separated by an equals sign. +# +# Example: +# +# AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, , +# AC_MSG_WARN(Need some Perl modules) +# +# LICENSE +# +# Copyright (c) 2009 Dean Povey +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES]) +AC_DEFUN([AX_PROG_PERL_MODULES],[dnl + +m4_define([ax_perl_modules]) +m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])), + [ + m4_append([ax_perl_modules], + [']m4_bpatsubst(ax_perl_module,=,[ ])[' ]) + ]) + +# Make sure we have perl +if test -z "$PERL"; then +AC_CHECK_PROG(PERL,perl,perl) +fi + +if test "x$PERL" != x; then + ax_perl_modules_failed=0 + for ax_perl_module in ax_perl_modules; do + AC_MSG_CHECKING(for perl module $ax_perl_module) + + # Would be nice to log result here, but can't rely on autoconf internals + $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1 + if test $? -ne 0; then + AC_MSG_RESULT(no); + ax_perl_modules_failed=1 + else + AC_MSG_RESULT(ok); + fi + done + + # Run optional shell commands + if test "$ax_perl_modules_failed" = 0; then + : + $2 + else + : + $3 + fi +else + AC_MSG_WARN(could not find perl) +fi])dnl From 3253f4ff249ab9b1432519b5fd579a9a4d877c92 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 01:02:07 +0300 Subject: [PATCH 14/46] Port manual make rules for tests to autotools --- Makefile.am | 4 ++++ configure.ac | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Makefile.am b/Makefile.am index 2a265b66..03b4a81f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,6 +42,10 @@ completions/_$(_vcsh): completions/vcsh.zsh $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force +.PHONY: test +test: + prove + dist-hook: cd $(distdir) echo $(VERSION) > .tarball-version diff --git a/configure.ac b/configure.ac index 511c649f..91b7b38e 100644 --- a/configure.ac +++ b/configure.ac @@ -14,8 +14,12 @@ AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n " AX_PROGVAR([comm]) AX_PROGVAR([cmp]) AX_PROGVAR([git]) +AX_PROGVAR([prove]) AX_PROGVAR([ronn]) +AX_PROG_PERL_MODULES(Shell::Command, , AC_MSG_ERROR(Perl module required for testing not found)) +AX_PROG_PERL_MODULES(Test::Most, , AC_MSG_ERROR(Perl module required for testing not found)) + AC_ARG_WITH([bash-completion-dir], AS_HELP_STRING([--with-bash-completion-dir[=PATH]], [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]), From 2b375c102645d2146bea6c6271a95baf5edcf889 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 01:39:33 +0300 Subject: [PATCH 15/46] Move assorted developer tooling to makefile --- Makefile.am | 7 +++++++ tools/hooks/pre-commit | 7 ------- tools/list_CONTRIBUTORS | 12 ------------ 3 files changed, 7 insertions(+), 19 deletions(-) delete mode 100755 tools/hooks/pre-commit delete mode 100755 tools/list_CONTRIBUTORS diff --git a/Makefile.am b/Makefile.am index 03b4a81f..2f47e0bc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,13 @@ completions/_$(_vcsh): completions/vcsh.zsh test: prove +CONTRIBUTORS: + exec > $@ + echo 'Alphabetical list of surnames of everyone who ever committed to this repository.' + echo 'Auto-generated using `make -B CONTRIBUTORS`' + echo + $(GIT) shortlog -se --all | cut -f1 --complement | sort -u -k2 + dist-hook: cd $(distdir) echo $(VERSION) > .tarball-version diff --git a/tools/hooks/pre-commit b/tools/hooks/pre-commit deleted file mode 100755 index ddb0550d..00000000 --- a/tools/hooks/pre-commit +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Unfortunately, Git decided to set those two during pre-commit -unset GIT_DIR -unset GIT_INDEX_FILE - -prove diff --git a/tools/list_CONTRIBUTORS b/tools/list_CONTRIBUTORS deleted file mode 100755 index 1b88451d..00000000 --- a/tools/list_CONTRIBUTORS +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# This program is licensed under the GNU GPL version 2 or later. -# (c) Richard "RichiH" Hartmann , 2012-2014 -# For details, see LICENSE. To submit patches, you have to agree to -# license your code under the GNU GPL version 2 or later. - - -echo 'Alphabetical list of surnames of everyone who ever committed to this repository. -Auto-generated from tools/list_CONTRIBUTORS. -' -git shortlog -se --all | cut -f1 --complement | sort -u -k2 From c0b768a9bbba9f78b3f708e56e9bb22b8686b9e4 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 5 Apr 2021 07:38:18 +0300 Subject: [PATCH 16/46] Ditch surname sort, 50% unreliable anyway The surname sort was a nice idea, but in this case it works out very poorly for normalization purposes: * In many cases we only have one name, in which case it was sorting on email address. * In some cases people have 3 or more name fields, it which case it was sorting on their middle initial. * In some cases the entries are not even names (e.g. Fedora Release Engineering) * Some languages do not follow the "first last" convention and sorting them based on a fixed position is just not good social etiquette. I started trying to fix the technical problems by sorting on the *last* field instead of blindly on the second column, but even that left so many anomalies it was hard to find names I knew were there. I think just a plain name sort is better in this context. --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2f47e0bc..29ca3b17 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,10 +48,10 @@ test: CONTRIBUTORS: exec > $@ - echo 'Alphabetical list of surnames of everyone who ever committed to this repository.' + echo 'Alphabetical list of names of everyone who ever committed to this repository.' echo 'Auto-generated using `make -B CONTRIBUTORS`' echo - $(GIT) shortlog -se --all | cut -f1 --complement | sort -u -k2 + $(GIT) shortlog -se --all | cut -f1 --complement | sort -u dist-hook: cd $(distdir) From a76357051b8c3a25dd0195256421d7878c21a26d Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 01:43:14 +0300 Subject: [PATCH 17/46] Regenerate contributors file --- CONTRIBUTORS | 87 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index cf286198..8cd4d5f3 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,41 +1,66 @@ -Alphabetical list of surnames of everyone who ever committed to this repository. -Auto-generated from tools/list_CONTRIBUTORS. +Alphabetical list of names of everyone who ever committed to this repository. +Auto-generated using `make -B CONTRIBUTORS` -Skurikhin Alexander -Eric Bouchut -Dridi Boukelmoune -Rob Cornish -Vincent Demeester -Mert Dirik -Jeff Fein-Worton -Thomas Ferris Nicolaisen -martin f. krafft +Aaron Schumacher +Aaron VonderHaar Alessandro Ghedini -Dennis Gilmore -Thorsten Glaser -G.raud -Mikhail Gusarov -Valentin Haenel -Richard Hartmann -Gregor Jasny -Errietta Kostala -Yuval Langer +Alexander Skurikhin +Andrew Schwartzmeyer +arndtc +Aryel Mota Góis Caleb Maclennan -Markus Martin -mek-apelsin -Evan Pitstick -Dieter Plaetinck Corey Quinn -Pavlos Ratis +Daniel Shahaf +Dato Simó +Debian Janitor +Dennis Gilmore +Devin J. Pohly Dewey Sasser +Dieter Plaetinck +Don +Don March +Dridi Boukelmoune +Edward Betts +Eli Young +Eric Bouchut +Errietta Kostala +Evan Pitstick +Fedora Release Engineering +Felix Eckhofer +Florian Engel +Frank Terbeck Gernot Schulz -Aaron Schumacher -Andrew Schwartzmeyer -Dato Simó -Alexander Skurikhin +G.raud +Gregor Jasny +guy hughes +Harendra Kumar +James Davidson +Jeff Fein-Worton +Jochen Keil Jonathan Sternberg +Julien Lecomte +Kevin Lyda +leycec +Markus Martin +martin f. krafft Mathias Svensson -Frank Terbeck +mek-apelsin +Mert Dirik +Mikhail Gusarov mirabilos -Aaron VonderHaar +miramir +Noah Birnel +Pavlos Ratis +Richard Hartmann +Rob Cornish +Roland Hopferwieser +Skurikhin Alexander +soulofmischief <30357883+soulofmischief@users.noreply.github.com> +Thomas Ferris Nicolaisen +Thomas Tuegel +Thorsten Glaser +tikki Tony +Valentin Haenel +Vincent Demeester +Yuval Langer From bf85ba71ad11ccd6dea3536cd0d5f8e87c6e6551 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 01:58:36 +0300 Subject: [PATCH 18/46] Update CI workflow to configure before testing --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3a674d1..d8276628 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,13 +8,17 @@ jobs: uses: actions/checkout@v2 - name: Install build dependencies run: | - sudo apt-get install ruby-ronn + sudo apt-get install ronn - name: Install perl test dependencies uses: perl-actions/install-with-cpanm@v1.1 with: install: | Shell::Command Test::Most + - name: Configure + run: | + ./bootstrap.sh + ./configure - name: Run tests run: | make test From 5147fddc360961b98d01b81e56b8777731a4ccae Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 02:22:48 +0300 Subject: [PATCH 19/46] Add make target for developer local linting --- Makefile.am | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.am b/Makefile.am index 29ca3b17..de507b23 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,10 @@ completions/_$(_vcsh): completions/vcsh.zsh test: prove +.PHONY: lint +lint: + ec + CONTRIBUTORS: exec > $@ echo 'Alphabetical list of names of everyone who ever committed to this repository.' From 893695384ae687c64790dfa85eb6e86b8caa4f65 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 4 Apr 2021 02:25:53 +0300 Subject: [PATCH 20/46] Update gitignore with autotools and build artifacts --- .gitignore | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitignore b/.gitignore index 4dec9bf3..2562f6ab 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,18 @@ vcsh.1 *.swp .swp *.bak +.version +.version-prev +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +build-aux/install-sh +build-aux/missing +completions/_vcsh +completions/vcsh +config.log +config.status +configure +/vcsh +vcsh-* From a6322afce17f2fe56734cc834bfdbbd11a9069fd Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 5 Apr 2021 08:52:03 +0300 Subject: [PATCH 21/46] Add limited self check to make sure versioning is working --- .github/workflows/test.yml | 1 + Makefile.am | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8276628..f0f075b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,7 @@ jobs: run: | ./bootstrap.sh ./configure + make check - name: Run tests run: | make test diff --git a/Makefile.am b/Makefile.am index de507b23..e0ff9bc4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,6 +42,14 @@ completions/_$(_vcsh): completions/vcsh.zsh $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force +check: check-version + +.PHONY: check-version +check-version: vcsh | .version + grep -Fx '$(VERSION)' $| + ./$< version | $(GREP) -Ff $| + ./$< version | $(GREP) -Ff <($(GIT) version) + .PHONY: test test: prove From 7017fa2999afa676efb80a508d4fa0620018468f Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Mon, 5 Apr 2021 08:34:03 +0200 Subject: [PATCH 22/46] Fix missing autotools replacements Signed-off-by: Richard Hartmann --- vcsh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vcsh.in b/vcsh.in index 86ee2f48..dc22eeda 100755 --- a/vcsh.in +++ b/vcsh.in @@ -164,7 +164,7 @@ info() { clone() { hook pre-clone # Check if remote is reachable. Abort early if there's a typo, TLS certificate problem, etc - git ls-remote "$GIT_REMOTE" 2> /dev/null || fatal "Can not reach '$GIT_REMOTE'" + @GIT@ ls-remote "$GIT_REMOTE" 2> /dev/null || fatal "Can not reach '$GIT_REMOTE'" init @GIT@ remote add origin "$GIT_REMOTE" @GIT@ checkout -b "$VCSH_BRANCH" || return $? @@ -252,7 +252,7 @@ foreach() { use hook_repo pre-foreach if [ -n "${VCSH_PRINT_REPO_PREFIX+x}" ]; then - $command_prefix "$@" | sed "s/^/$VCSH_REPO_NAME: /" + $command_prefix "$@" | @SED@ "s/^/$VCSH_REPO_NAME: /" else echo "$VCSH_REPO_NAME:" $command_prefix "$@" @@ -306,7 +306,7 @@ list() { list_has_remote() { for VCSH_REPO_NAME in $(list); do GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR - git config branch.$VCSH_BRANCH.remote > /dev/null && echo "$VCSH_REPO_NAME" + @GIT@ config branch.$VCSH_BRANCH.remote > /dev/null && echo "$VCSH_REPO_NAME" done } From 42d83d689901124ba30f63517a2e4a8292a0d934 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 5 Apr 2021 08:52:03 +0300 Subject: [PATCH 23/46] =?UTF-8?q?Use=20GNU=20standard=20=E2=80=98make=20ch?= =?UTF-8?q?eck=E2=80=99=20instead=20of=20=E2=80=98make=20test=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 3 +-- Makefile.am | 12 +++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f0f075b5..e37f7d43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,6 @@ jobs: run: | ./bootstrap.sh ./configure - make check - name: Run tests run: | - make test + make check diff --git a/Makefile.am b/Makefile.am index e0ff9bc4..5dff1342 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,7 +42,10 @@ completions/_$(_vcsh): completions/vcsh.zsh $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force -check: check-version +check: check-version prove + +installcheck-local: + ./$(_vcsh) version .PHONY: check-version check-version: vcsh | .version @@ -50,10 +53,13 @@ check-version: vcsh | .version ./$< version | $(GREP) -Ff $| ./$< version | $(GREP) -Ff <($(GIT) version) -.PHONY: test -test: +.PHONY: prove +prove: prove +.PHONY: test +test: prove + .PHONY: lint lint: ec From 8cd10fbf9825c32c6db1a3d41decdffe13744943 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 7 Apr 2021 12:45:18 +0300 Subject: [PATCH 24/46] Add make rule to run shellcheck --- Makefile.am | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 5dff1342..a129cd46 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,9 +61,16 @@ prove: test: prove .PHONY: lint -lint: +lint: lint-editor-config lint-shellcheck + +.PHONY: lint-editor-config +lint-editor-config: ec +.PHONY: lint-shellheck +lint-shellcheck: vcsh + shellcheck $< + CONTRIBUTORS: exec > $@ echo 'Alphabetical list of names of everyone who ever committed to this repository.' From 60ba9e38d09c2a973047517682856646a3484033 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 7 Apr 2021 13:06:37 +0300 Subject: [PATCH 25/46] Add option for ./configure --without-man-page --- Makefile.am | 2 ++ configure.ac | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index a129cd46..f2567fa9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,9 @@ licensedir = $(datarootdir)/licenses/vcsh dist_doc_DATA = README.md changelog doc/INSTALL.md doc/PACKAGING.md doc/README.md doc/error_codes.md doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber dist_license_DATA = LICENSE CONTRIBUTORS +if ENABLE_MAN_PAGE dist_man_MANS = vcsh.1 +endif bin_SCRIPTS = vcsh EXTRA_DIST = .version completions/vcsh.bash completions/vcsh.zsh diff --git a/configure.ac b/configure.ac index 91b7b38e..55d97270 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,17 @@ AX_PROGVAR([comm]) AX_PROGVAR([cmp]) AX_PROGVAR([git]) AX_PROGVAR([prove]) -AX_PROGVAR([ronn]) + + +AC_ARG_WITH([man-page], + AS_HELP_STRING([--with-man-page], + [Generate man page @<:@default=yes@:>@]), + [], + [with_man_page=yes]) +if test "x$with_man_page" = "xyes"; then + AX_PROGVAR([ronn]) +fi +AM_CONDITIONAL([ENABLE_MAN_PAGE],[test "x$with_man_page" != "xno"]) AX_PROG_PERL_MODULES(Shell::Command, , AC_MSG_ERROR(Perl module required for testing not found)) AX_PROG_PERL_MODULES(Test::Most, , AC_MSG_ERROR(Perl module required for testing not found)) From 83e116f3093e94f71500c69abe0f6bf155c7f4f1 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 7 Apr 2021 13:15:09 +0300 Subject: [PATCH 26/46] Add option for ./configure --disable-tests --- Makefile.am | 6 +++++- configure.ac | 13 +++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index f2567fa9..a5a03e3f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,7 +44,11 @@ completions/_$(_vcsh): completions/vcsh.zsh $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force -check: check-version prove +check: check-version + +if ENABLE_TESTS +check: prove +endif installcheck-local: ./$(_vcsh) version diff --git a/configure.ac b/configure.ac index 55d97270..26b973e9 100644 --- a/configure.ac +++ b/configure.ac @@ -14,8 +14,6 @@ AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n " AX_PROGVAR([comm]) AX_PROGVAR([cmp]) AX_PROGVAR([git]) -AX_PROGVAR([prove]) - AC_ARG_WITH([man-page], AS_HELP_STRING([--with-man-page], @@ -27,8 +25,15 @@ if test "x$with_man_page" = "xyes"; then fi AM_CONDITIONAL([ENABLE_MAN_PAGE],[test "x$with_man_page" != "xno"]) -AX_PROG_PERL_MODULES(Shell::Command, , AC_MSG_ERROR(Perl module required for testing not found)) -AX_PROG_PERL_MODULES(Test::Most, , AC_MSG_ERROR(Perl module required for testing not found)) +AC_ARG_ENABLE([tests], + AS_HELP_STRING([--disable-tests], [Don't require test tooling to build])) +AM_CONDITIONAL([ENABLE_TESTS],[test "x$enable_tests" != "xno"]) + +AS_IF([test "x$enable_tests" != "xno"], [ + AX_PROGVAR([prove]) + AX_PROG_PERL_MODULES(Shell::Command, , AC_MSG_ERROR(Perl module required for testing not found)) + AX_PROG_PERL_MODULES(Test::Most, , AC_MSG_ERROR(Perl module required for testing not found)) +]) AC_ARG_WITH([bash-completion-dir], AS_HELP_STRING([--with-bash-completion-dir[=PATH]], From 8b275ac914b3401ed0c1c9e010dd873b843defc6 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 7 Apr 2021 13:01:03 +0300 Subject: [PATCH 27/46] Lint generated sources not input --- .github/workflows/lint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 74546148..749157df 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,6 +13,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Configure + run: | + ./bootstrap.sh + ./configure --without-man-page --disable-tests - name: Run shellcheck uses: reviewdog/action-shellcheck@v1.0.0 with: From 1b4d57a2e7b50258ed992b31eb23d9e61fe0c7f8 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 7 Apr 2021 13:29:52 +0300 Subject: [PATCH 28/46] =?UTF-8?q?Drop=20obsolete=20=E2=80=98packaging=20br?= =?UTF-8?q?anch=E2=80=99=20documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile.am | 2 +- README.md | 7 +++---- doc/PACKAGING.md | 44 -------------------------------------------- 3 files changed, 4 insertions(+), 49 deletions(-) delete mode 100644 doc/PACKAGING.md diff --git a/Makefile.am b/Makefile.am index a5a03e3f..fc70c400 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,7 @@ _vcsh = $(program_prefix)$(shell sed -e "$(program_transform_name)" <<< vcsh)$(p licensedir = $(datarootdir)/licenses/vcsh -dist_doc_DATA = README.md changelog doc/INSTALL.md doc/PACKAGING.md doc/README.md doc/error_codes.md doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber +dist_doc_DATA = README.md changelog doc/INSTALL.md doc/README.md doc/error_codes.md doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber dist_license_DATA = LICENSE CONTRIBUTORS if ENABLE_MAN_PAGE dist_man_MANS = vcsh.1 diff --git a/README.md b/README.md index e1df357f..77ce7cd5 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,9 @@ All slides, videos, and further information can be found # Installation A lot of modern UNIX-based systems offer packages for `vcsh`. In case yours -does not, read [INSTALL.md](doc/INSTALL.md) for install instructions or -[PACKAGING.md](doc/PACKAGING.md) to create a package yourself. If you do end -up packaging `vcsh` please let us know so we can give you your own packaging -branch in the upstream repository. +does not, read [INSTALL.md](doc/INSTALL.md) for instructions on installing from +sources or even create a package for your system. If you do end up packaging +`vcsh` please let us know so we can document package availability. # Contact diff --git a/doc/PACKAGING.md b/doc/PACKAGING.md deleted file mode 100644 index ecbfa551..00000000 --- a/doc/PACKAGING.md +++ /dev/null @@ -1,44 +0,0 @@ -# Distributions with readily available packages - -## Archlinux - -AUR does not require any packaging information within this repository. - -## Debian - -Debian packages are provided by the author in separate branches, maintained in -the upstream repository - -### Ubuntu - -Ubuntu imports Debian's package automagically. - - -## Mac OS X / Homebrew - -Homebrew does not require any packaging information within this repository. -A separate branch with a statically compiled manpage and release tags is -provided to ease the work of Homebrew packagers: - -* The static manpage because Homebrew lacks ronn -* The tag so GitHub generates tarballs Homebrew can be pointed at - - -# Supporting new distributions - -## Your own work - -If you are maintaining a package for a different distribution, please get -in touch so your work can be included in a packaging branch in the upstream -repository. -This allows others to adapt your work for their own distributions or -packaging needs. - -## Static manpage - -The "debian-squeeze" branch carries a quilt patchset with a pre-compiled -manpage and the "homebrew" one carries a static manpage. - -In case you can not build the manpage because you are missing ronn or you -prefer a precompiled manpage for another reason, please contact us; we will -gladly provide up-to-date packages with every release. From 6660d9f84a9d8278821a8d4845ddeceba7eb3575 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Fri, 9 Apr 2021 10:23:32 +0300 Subject: [PATCH 29/46] =?UTF-8?q?Flesh=20out=20=E2=80=98make=20clean?= =?UTF-8?q?=E2=80=99=20to=20include=20all=20relevant=20generated=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index fc70c400..e5b17c82 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,9 +16,10 @@ dist_man_MANS = vcsh.1 endif bin_SCRIPTS = vcsh -EXTRA_DIST = .version completions/vcsh.bash completions/vcsh.zsh +EXTRA_DIST = completions/vcsh.bash completions/vcsh.zsh BUILT_SOURCES = .version +CLEANFILES = $(BUILT_SOURCES) $(dist_man_MANS) $(bin_SCRIPTS) if ENABLE_BASH_COMPLETION bashcompletiondir = $(BASH_COMPLETION_DIR) From 462123bd97be8524ec330d24c84d18d0c11f553f Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 7 Apr 2021 18:47:23 +0300 Subject: [PATCH 30/46] =?UTF-8?q?Play=20nice=20with=20automake=E2=80=99s?= =?UTF-8?q?=20idiosyncrasies,=20allow=20cleanly=20skip=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile.am | 6 ++++-- configure.ac | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index e5b17c82..fa2a9970 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,12 +45,14 @@ completions/_$(_vcsh): completions/vcsh.zsh $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force -check: check-version +_CHECKDEPS = check-version if ENABLE_TESTS -check: prove +_CHECKDEPS += prove endif +check-local: $(_CHECKDEPS) + installcheck-local: ./$(_vcsh) version diff --git a/configure.ac b/configure.ac index 26b973e9..4fbd0547 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,8 @@ fi AM_CONDITIONAL([ENABLE_MAN_PAGE],[test "x$with_man_page" != "xno"]) AC_ARG_ENABLE([tests], - AS_HELP_STRING([--disable-tests], [Don't require test tooling to build])) + AS_HELP_STRING([--disable-tests], [Skip tooling requirements for running tests]), + ,[enable_tests=yes]) AM_CONDITIONAL([ENABLE_TESTS],[test "x$enable_tests" != "xno"]) AS_IF([test "x$enable_tests" != "xno"], [ From b7728b7f724d2243e831b7e17886cc65b44636e7 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 12:33:08 +0300 Subject: [PATCH 31/46] Install sample hooks in properly nested doc dir --- Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index fa2a9970..7141f69e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,9 @@ _vcsh = $(program_prefix)$(shell sed -e "$(program_transform_name)" <<< vcsh)$(p licensedir = $(datarootdir)/licenses/vcsh -dist_doc_DATA = README.md changelog doc/INSTALL.md doc/README.md doc/error_codes.md doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber +dist_doc_DATA = changelog doc/INSTALL.md doc/README.md doc/error_codes.md +samplehooksdir = $(docdir)/sample_hooks +dist_samplehooks_DATA = doc/sample_hooks/post-init-add-origin doc/sample_hooks/post-init-setup-mr doc/sample_hooks/post-merge-unclobber doc/sample_hooks/pre-merge-unclobber dist_license_DATA = LICENSE CONTRIBUTORS if ENABLE_MAN_PAGE dist_man_MANS = vcsh.1 From ea63376d1f63b01947f14ea6ca0b76935ed05065 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 12:36:51 +0300 Subject: [PATCH 32/46] Distribute internal tooling needed to build from a source package --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 7141f69e..fdac6521 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,7 @@ dist_man_MANS = vcsh.1 endif bin_SCRIPTS = vcsh -EXTRA_DIST = completions/vcsh.bash completions/vcsh.zsh +EXTRA_DIST = completions/vcsh.bash completions/vcsh.zsh build-aux/git-version-gen build-aux/ax_prog_perl_modules.m4 BUILT_SOURCES = .version CLEANFILES = $(BUILT_SOURCES) $(dist_man_MANS) $(bin_SCRIPTS) From bc23caed5ac7ae2466e437c570d1477f60edb267 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 14:55:55 +0300 Subject: [PATCH 33/46] Setup tests to be on by default for developers, off for users --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 4fbd0547..9e322945 100644 --- a/configure.ac +++ b/configure.ac @@ -25,9 +25,10 @@ if test "x$with_man_page" = "xyes"; then fi AM_CONDITIONAL([ENABLE_MAN_PAGE],[test "x$with_man_page" != "xno"]) +AS_IF([test -e .tarball-version], m4_define([TESTDEF], [yes]), m4_define([TESTDEF], [no])) AC_ARG_ENABLE([tests], - AS_HELP_STRING([--disable-tests], [Skip tooling requirements for running tests]), - ,[enable_tests=yes]) + AS_HELP_STRING([--disable-tests], [Configure tooling to run tests @<:@default=TESTDEF@:>@]), + ,[enable_tests=TESTDEF]) AM_CONDITIONAL([ENABLE_TESTS],[test "x$enable_tests" != "xno"]) AS_IF([test "x$enable_tests" != "xno"], [ From 056d3a310c59a8e4144a527dd8ecea65e232b7f8 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 15:18:05 +0300 Subject: [PATCH 34/46] Allow all command path discoveries to be overridden --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9e322945..5dd7467f 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,11 @@ AC_PROG_AWK AC_PROG_GREP AC_PROG_SED -AC_DEFUN([AX_PROGVAR], [AC_PATH_PROG(m4_toupper($1), m4_default($2,$1))test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required])]) +AC_DEFUN([AX_PROGVAR], + [ + test -n "$m4_toupper($1)" || { AC_PATH_PROG(m4_toupper($1), m4_default($2,$1)) } + test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required]) + ]) AX_PROGVAR([comm]) AX_PROGVAR([cmp]) From 5037d9b5b1290cfd6b420b7ad3c05db32bbcec72 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 14:00:50 +0300 Subject: [PATCH 35/46] =?UTF-8?q?Fixup=20configure=20so=20that=20=E2=80=98?= =?UTF-8?q?make=20distcheck=E2=80=99=20works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile.am | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index fdac6521..c9937956 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,30 +21,34 @@ bin_SCRIPTS = vcsh EXTRA_DIST = completions/vcsh.bash completions/vcsh.zsh build-aux/git-version-gen build-aux/ax_prog_perl_modules.m4 BUILT_SOURCES = .version -CLEANFILES = $(BUILT_SOURCES) $(dist_man_MANS) $(bin_SCRIPTS) +CLEANFILES = $(BUILT_SOURCES) .version-prev $(dist_man_MANS) $(bin_SCRIPTS) if ENABLE_BASH_COMPLETION bashcompletiondir = $(BASH_COMPLETION_DIR) nodist_bashcompletion_DATA = completions/$(_vcsh) +CLEANFILES += $(nodist_bashcompletion_DATA) endif if ENABLE_ZSH_COMPLETION zshcompletiondir = $(ZSH_COMPLETION_DIR) nodist_zshcompletion_DATA = completions/_$(_vcsh) +CLEANFILES += $(nodist_zshcompletion_DATA) endif vcsh.1: doc/vcsh.1.ronn $(RONN) < $< > $@ completions/$(_vcsh): completions/vcsh.bash + mkdir -p $(dir $@) cp -bf $< $@ completions/_$(_vcsh): completions/vcsh.zsh + mkdir -p $(dir $@) cp -bf $< $@ .version: $(shell $(AWK) '{print ".git/" $$2}' .git/HEAD 2>/dev/null ||:) - [ -e "$@" ] && mv "$@" "$@-prev" || touch "$@-prev" - $(if $<,./build-aux/git-version-gen .tarball-version,printf "$(VERSION)") > "$@" + [ -e "$@" ] && mv "$@" "$@-prev" || $(if $<,touch,cp "$(srcdir)/.tarball-version") "$@-prev" + $(if $<,./build-aux/git-version-gen "$(srcdir)/.tarball-version",printf "$(VERSION)") > "$@" $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force _CHECKDEPS = check-version @@ -90,5 +94,4 @@ CONTRIBUTORS: $(GIT) shortlog -se --all | cut -f1 --complement | sort -u dist-hook: - cd $(distdir) - echo $(VERSION) > .tarball-version + printf "$(VERSION)" > "$(distdir)/.tarball-version" From 0c887be2d68f59fbe888ca5f719d1f5da01a8d59 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 16:19:00 +0300 Subject: [PATCH 36/46] Get program rename support working across all outputs --- Makefile.am | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index c9937956..d7716534 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,9 +5,10 @@ ACLOCAL_AMFLAGS = -I build-aux .SECONDEXPANSION: .DELETE_ON_ERROR: -_vcsh = $(program_prefix)$(shell sed -e "$(program_transform_name)" <<< vcsh)$(program_suffix) +_vcsh = $(program_prefix)$(shell $(SED) -e "$(program_transform_name)" <<< vcsh)$(program_suffix) -licensedir = $(datarootdir)/licenses/vcsh +docdir = $(datarootdir)/doc/$(_vcsh) +licensedir = $(datarootdir)/licenses/$(_vcsh) dist_doc_DATA = changelog doc/INSTALL.md doc/README.md doc/error_codes.md samplehooksdir = $(docdir)/sample_hooks @@ -95,3 +96,9 @@ CONTRIBUTORS: dist-hook: printf "$(VERSION)" > "$(distdir)/.tarball-version" + +install-exec-local: + $(SED) -i -E '/^VCSH_SELF/s#".*"#"$(_vcsh)"#g' "$(DESTDIR)$(bindir)/$(_vcsh)" + +install-data-hook: + $(SED) -i -E 's#(\\fB)vcsh\b#\1$(_vcsh)#g' "$(DESTDIR)$(man1dir)/$(_vcsh).1" From 5aa5029fec0d90594d0e9e3fdf08d0bfe9dc888f Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 23:32:01 +0300 Subject: [PATCH 37/46] Add makefile target to extract latest changlog segment --- Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index d7716534..11ce2ef1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,7 +65,7 @@ installcheck-local: .PHONY: check-version check-version: vcsh | .version - grep -Fx '$(VERSION)' $| + $(GREP) -Fx '$(VERSION)' $| ./$< version | $(GREP) -Ff $| ./$< version | $(GREP) -Ff <($(GIT) version) @@ -94,6 +94,9 @@ CONTRIBUTORS: echo $(GIT) shortlog -se --all | cut -f1 --complement | sort -u +changelog-HEAD: changelog + sed -nEe '2d;s/^\t//p;/^$$/q;' $< > $@ + dist-hook: printf "$(VERSION)" > "$(distdir)/.tarball-version" From bc3c1c645059b015918f196f8f3b0bd0fe43ffdb Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 23:15:29 +0300 Subject: [PATCH 38/46] Add CI workflow to test build and post source artifacts --- .github/workflows/build.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..f8b168a4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: Build + +on: [push, pull_request] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Fetch tags + run: | + git fetch --prune --tags ||: + - name: Configure + run: | + ./bootstrap.sh + ./configure --disable-dependency-checks + - name: Build source package + run: | + make dist + echo VERSION=$(cat .version) >> $GITHUB_ENV + - name: Post build artifacts + uses: actions/upload-artifact@v2 + with: + name: vcsh-${{ env.VERSION }} + path: vcsh-${{ env.VERSION }} From 0ffe3bdbff9a827e2555570fcbbd3bace66e2be1 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 10 Apr 2021 21:45:40 +0300 Subject: [PATCH 39/46] Add CI workflow to publish GH releases --- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..c3bdfa1b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + push: + tags: + - v*.*.* + +jobs: + + ghrelase: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Configure + run: | + echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV + echo "${GITHUB_REF#refs/*/v}" > .tarball-version + ./bootstrap.sh + ./configure --disable-dependency-checks + - name: Build source package + run: | + make dist + - name: Check source package behaviour + run: | + make distcheck + - name: Make sure changelog was updated + run: | + make changelog-HEAD + grep -F "* Release ${{ env.VERSION }}" changelog-HEAD + - name: Publish Release + uses: softprops/action-gh-release@v1 + with: + body_path: changelog-HEAD + files: | + vcsh-${{ env.VERSION }}.zip + vcsh-${{ env.VERSION }}.tar.xz + env: + GITHUB_TOKEN: ${{ github.token }} From 9aa21feca2dcd72c049a26b44037e6005f58d4d8 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 11 Apr 2021 00:59:34 +0300 Subject: [PATCH 40/46] Backfill changelog for unreleased changes to date --- changelog | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/changelog b/changelog index 9afbcd59..a63821b0 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,25 @@ +unreleased + + * Replace homegrown Makefile with Autotools for configure and build + * Post source builds as part of automated release process + * Switch to versioning scheme to semver + * Replace Travis test runner with GitHub Actions + * Make VCSH_* variables available to hooks + * More carefully handle shell quoting + * Improve handling of non-default remote names and branches + * Fix per-repo pre/post hook handling + * Output path relative to $HOME in ‘vcsh status’ + * Add flag to prefix output of ‘vcsh foreach -p’ with repo name + * Fix debugging on Windows 10 / Cygwin + * Improve option flag handling to allow multiple flags, squash bugs + * Don't require Ruby or Perl tooling to build and install + * Avoid false-positive conflicts on checkout + * Make arg optional for write-ignore subcommand + * Fix ZSH completions, improve Bash completions + * Allow use of specific path when running Git or any dependency + * Fail if hook scripts return failure codes + * Check GIT_REMOTE early on clone() + 2021-04-05 Richard Hartmann * Release 1.20190621 From f392c37a450f0d47fd81bd2ac3dcdc9f10372648 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 7 Apr 2021 13:58:07 +0300 Subject: [PATCH 41/46] Overhaul install docs --- doc/INSTALL.md | 126 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 97 insertions(+), 29 deletions(-) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 3fbf129f..c2965e63 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -1,59 +1,127 @@ -# Pre-requisites # +# Distro Packages -If you want to build the manpage, you will need [ronn] [1]. -Debian 7.0 and above come with a package, so do most Debian clones. +Many distributions have packages ready to go. +If yours doesn't, you can install [from source](#installing-from-source). +If you package VCSH for a distro please let us know. -To install ronn on your Debian-based system, simply run +## Arch Linux - apt-get install ruby-ronn +Use your favorite AUR helper to build and install the [vcsh](https://aur.archlinux.org/packages/vcsh) package: -There are no other dependencies other than `git`, `ronn` and a POSIX shell. +```console +$ paru -S aur +``` +## CentOS / Fedora / RedHat -# Installing # +```console +$ yum install vcsh +``` - sudo make install +## Debian / Deepin / Kali Linux / Parrot / PureOS / Raspbian / Trisquel / Ubuntu -## Installing without root privileges ## +```console +$ apt install vcsh +``` - make install DESTDIR=/home/myuser/local +## Gentoo / Funtoo / LiGurOS -or simply copy the shell script into any place you like, e.g. `~/bin` +```console +$ emerge --ask dev-vcs/vcsh +``` +## GNU Guix -# Uninstalling # +```console +$ guix install vcsh +``` - sudo make uninstall +## Homebrew (macOS) / Linuxbrew -There is another, more thorough, version. Just make sure you are not running -this when you have installed to an important directory which is empty, -otherwise. +```console +$ brew install vcsh +``` -**THIS WILL DELETE /usr/local IF YOU INSTALLED THERE AND IT BECOMES EMPTY** +## KISS Linux - sudo make purge +```console +$ kiss install vcsh +``` -**THIS WILL DELETE /usr/local IF YOU INSTALLED THERE AND IT BECOMES EMPTY** +## MacPorts (macOS) -This is not in the default behaviour of `make uninstall` for obvious reasons. +```console +$ port install vcsh +``` +## NIX -# Other stuff # +```console +$ nix-env -i vcsh +``` -To clean up the generated manpage, run +## openSUSE - make clean +```console +$ zypper install vcsh +``` -To run the test suite, run +## Pardus - make test +```console +$ pisi install vcsh +``` -To run the test suite, you will need `perl`, -and the modules `Test::Most` and `Shell::Command`. +## Termux -To install the perl modules, run +```console +$ pkg install vcsh +``` - cpan install 'Test::Most' 'Shell::Command'. +# Installing from Source +First you'll want a copy of the source code. +The easiest to use place to get this is the [latest release](https://github.com/RichiH/vcsh/releases/latest) posted on GitHub. +The souree distribution will have a name such as `vcsh-2.0.0.tar.xz`. +Note under each release GitHub also shows a "Source code" link that will download a snapshot of the repository; this is **not** the file you want (unless you want to jump through extra hoops). +The official source release packages are the ones you want. + +Alternatively you may `git clone` the source repository. +Note than some extra tooling will be required over using the regular source releases. +Building from a clone will require a system with GNU Autotools installed; something not needed if using a source package. +Also source releases have prebuilt man pages; to (optionally) build them from a Git clone you will need `ronn`. +Finally building from Git clones will check for extra dependencies needed for testing, although tests can be disabled. +If starting from a clone, run `./bootstrap.sh` once before doing anything below. + +Once you have the source, it's time to let it get aquainted with your system: + +```console +$ ./configure +``` + +This command has *lots* of possible options, but the defaults should suite most use cases. +See `./configure --help` for details if you have special needs. + +Once configured, you can build: + +```console +$ make +``` + +Lastly you'll want to install it somewhere. + +```console +$ make install +``` + +If you need elevated system permissions you may need to use `sudo make install` for this step. +If you don't have such permissions and wish to install to your home directory, something like this might work: + +```console +$ ./configure --prefix=/ +$ make DESTDIR="$HOME" install-exec +``` + +This will install to `~/bin/vcsh`; add `~/bin` to your path to use. [1]: http://rtomayko.github.io/ronn/ From 9fc1d65e6d7a7f32a059694231a7250745815af6 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 11 Apr 2021 01:39:40 +0300 Subject: [PATCH 42/46] Consolidate build CI workflow into test --- .github/workflows/build.yml | 29 ----------------------------- .github/workflows/test.yml | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index f8b168a4..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Build - -on: [push, pull_request] - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Fetch tags - run: | - git fetch --prune --tags ||: - - name: Configure - run: | - ./bootstrap.sh - ./configure --disable-dependency-checks - - name: Build source package - run: | - make dist - echo VERSION=$(cat .version) >> $GITHUB_ENV - - name: Post build artifacts - uses: actions/upload-artifact@v2 - with: - name: vcsh-${{ env.VERSION }} - path: vcsh-${{ env.VERSION }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e37f7d43..c1808e01 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,9 +6,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Install build dependencies + with: + fetch-depth: 0 + - name: Fetch tags + run: | + git fetch --prune --tags ||: + - name: Install dependencies run: | - sudo apt-get install ronn + sudo apt install ronn - name: Install perl test dependencies uses: perl-actions/install-with-cpanm@v1.1 with: @@ -22,3 +27,12 @@ jobs: - name: Run tests run: | make check + - name: Build source package + run: | + make dist + echo VERSION=$(cat .version) >> $GITHUB_ENV + - name: Post build artifacts + uses: actions/upload-artifact@v2 + with: + name: vcsh-${{ env.VERSION }} + path: vcsh-${{ env.VERSION }}.zip From f52f4873b36a9c548590fde1a820f0aeda89d84f Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 12 Apr 2021 14:53:17 +0300 Subject: [PATCH 43/46] Make program name transformation more portable --- Makefile.am | 20 +++++++++----------- configure.ac | 3 +++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index 11ce2ef1..581cd7a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,10 +5,8 @@ ACLOCAL_AMFLAGS = -I build-aux .SECONDEXPANSION: .DELETE_ON_ERROR: -_vcsh = $(program_prefix)$(shell $(SED) -e "$(program_transform_name)" <<< vcsh)$(program_suffix) - -docdir = $(datarootdir)/doc/$(_vcsh) -licensedir = $(datarootdir)/licenses/$(_vcsh) +docdir = $(datarootdir)/doc/$(TRANSFORMED_PACKAGE_NAME) +licensedir = $(datarootdir)/licenses/$(TRANSFORMED_PACKAGE_NAME) dist_doc_DATA = changelog doc/INSTALL.md doc/README.md doc/error_codes.md samplehooksdir = $(docdir)/sample_hooks @@ -26,24 +24,24 @@ CLEANFILES = $(BUILT_SOURCES) .version-prev $(dist_man_MANS) $(bin_SCRIPTS) if ENABLE_BASH_COMPLETION bashcompletiondir = $(BASH_COMPLETION_DIR) -nodist_bashcompletion_DATA = completions/$(_vcsh) +nodist_bashcompletion_DATA = completions/$(TRANSFORMED_PACKAGE_NAME) CLEANFILES += $(nodist_bashcompletion_DATA) endif if ENABLE_ZSH_COMPLETION zshcompletiondir = $(ZSH_COMPLETION_DIR) -nodist_zshcompletion_DATA = completions/_$(_vcsh) +nodist_zshcompletion_DATA = completions/_$(TRANSFORMED_PACKAGE_NAME) CLEANFILES += $(nodist_zshcompletion_DATA) endif vcsh.1: doc/vcsh.1.ronn $(RONN) < $< > $@ -completions/$(_vcsh): completions/vcsh.bash +completions/$(TRANSFORMED_PACKAGE_NAME): completions/vcsh.bash mkdir -p $(dir $@) cp -bf $< $@ -completions/_$(_vcsh): completions/vcsh.zsh +completions/_$(TRANSFORMED_PACKAGE_NAME): completions/vcsh.zsh mkdir -p $(dir $@) cp -bf $< $@ @@ -61,7 +59,7 @@ endif check-local: $(_CHECKDEPS) installcheck-local: - ./$(_vcsh) version + ./$(TRANSFORMED_PACKAGE_NAME) version .PHONY: check-version check-version: vcsh | .version @@ -101,7 +99,7 @@ dist-hook: printf "$(VERSION)" > "$(distdir)/.tarball-version" install-exec-local: - $(SED) -i -E '/^VCSH_SELF/s#".*"#"$(_vcsh)"#g' "$(DESTDIR)$(bindir)/$(_vcsh)" + $(SED) -i -E '/^VCSH_SELF/s#".*"#"$(TRANSFORMED_PACKAGE_NAME)"#g' "$(DESTDIR)$(bindir)/$(TRANSFORMED_PACKAGE_NAME)" install-data-hook: - $(SED) -i -E 's#(\\fB)vcsh\b#\1$(_vcsh)#g' "$(DESTDIR)$(man1dir)/$(_vcsh).1" + $(SED) -i -E 's#(\\fB)vcsh\b#\1$(TRANSFORMED_PACKAGE_NAME)#g' "$(DESTDIR)$(man1dir)/$(TRANSFORMED_PACKAGE_NAME).1" diff --git a/configure.ac b/configure.ac index 5dd7467f..02a93b14 100644 --- a/configure.ac +++ b/configure.ac @@ -69,6 +69,9 @@ fi AC_SUBST([ZSH_COMPLETION_DIR]) AM_CONDITIONAL([ENABLE_ZSH_COMPLETION],[test "x$with_zsh_completion_dir" != "xno"]) +TRANSFORMED_PACKAGE_NAME="$(printf "$PACKAGE_NAME" | $SED -e "${program_transform_name//\$\$/\$}")" +AC_SUBST([TRANSFORMED_PACKAGE_NAME]) + AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([vcsh], [chmod +x vcsh]) From a7fcea3262b411474df4f8fe592ae836491eb74a Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 12 Apr 2021 15:01:50 +0300 Subject: [PATCH 44/46] Simplify post-install hooks using autoconf substitution --- Makefile.am | 6 --- configure.ac | 1 + doc/{vcsh.1.ronn => vcsh.1.ronn.in} | 78 ++++++++++++++--------------- vcsh.in | 2 +- 4 files changed, 41 insertions(+), 46 deletions(-) rename doc/{vcsh.1.ronn => vcsh.1.ronn.in} (76%) diff --git a/Makefile.am b/Makefile.am index 581cd7a4..ca452654 100644 --- a/Makefile.am +++ b/Makefile.am @@ -97,9 +97,3 @@ changelog-HEAD: changelog dist-hook: printf "$(VERSION)" > "$(distdir)/.tarball-version" - -install-exec-local: - $(SED) -i -E '/^VCSH_SELF/s#".*"#"$(TRANSFORMED_PACKAGE_NAME)"#g' "$(DESTDIR)$(bindir)/$(TRANSFORMED_PACKAGE_NAME)" - -install-data-hook: - $(SED) -i -E 's#(\\fB)vcsh\b#\1$(TRANSFORMED_PACKAGE_NAME)#g' "$(DESTDIR)$(man1dir)/$(TRANSFORMED_PACKAGE_NAME).1" diff --git a/configure.ac b/configure.ac index 02a93b14..a019cf3d 100644 --- a/configure.ac +++ b/configure.ac @@ -74,6 +74,7 @@ AC_SUBST([TRANSFORMED_PACKAGE_NAME]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([vcsh], [chmod +x vcsh]) +AC_CONFIG_FILES([doc/vcsh.1.ronn]) AC_ARG_PROGRAM diff --git a/doc/vcsh.1.ronn b/doc/vcsh.1.ronn.in similarity index 76% rename from doc/vcsh.1.ronn rename to doc/vcsh.1.ronn.in index c1021ae6..2300989e 100644 --- a/doc/vcsh.1.ronn +++ b/doc/vcsh.1.ronn.in @@ -3,66 +3,66 @@ vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME ## SYNOPSIS -`vcsh` [] +`@TRANSFORMED_PACKAGE_NAME@` [] -`vcsh` clone [-b ] [] +`@TRANSFORMED_PACKAGE_NAME@` clone [-b ] [] -`vcsh` delete +`@TRANSFORMED_PACKAGE_NAME@` delete -`vcsh` enter +`@TRANSFORMED_PACKAGE_NAME@` enter -`vcsh` foreach [-g] +`@TRANSFORMED_PACKAGE_NAME@` foreach [-g] -`vcsh` help +`@TRANSFORMED_PACKAGE_NAME@` help -`vcsh` init +`@TRANSFORMED_PACKAGE_NAME@` init -`vcsh` list +`@TRANSFORMED_PACKAGE_NAME@` list -`vcsh` list-tracked [] +`@TRANSFORMED_PACKAGE_NAME@` list-tracked [] -`vcsh` list-untracked [<-a>] [<-r>] [] +`@TRANSFORMED_PACKAGE_NAME@` list-untracked [<-a>] [<-r>] [] -`vcsh` pull +`@TRANSFORMED_PACKAGE_NAME@` pull -`vcsh` push +`@TRANSFORMED_PACKAGE_NAME@` push -`vcsh` rename +`@TRANSFORMED_PACKAGE_NAME@` rename -`vcsh` run +`@TRANSFORMED_PACKAGE_NAME@` run -`vcsh` status [] +`@TRANSFORMED_PACKAGE_NAME@` status [] -`vcsh` upgrade +`@TRANSFORMED_PACKAGE_NAME@` upgrade -`vcsh` version +`@TRANSFORMED_PACKAGE_NAME@` version -`vcsh` which +`@TRANSFORMED_PACKAGE_NAME@` which -`vcsh` write-gitignore [] +`@TRANSFORMED_PACKAGE_NAME@` write-gitignore [] -`vcsh` +`@TRANSFORMED_PACKAGE_NAME@` -`vcsh` +`@TRANSFORMED_PACKAGE_NAME@` ## DESCRIPTION -`vcsh` allows you to have several `git`(1) repositories, all maintaining their +`@TRANSFORMED_PACKAGE_NAME@` allows you to have several `git`(1) repositories, all maintaining their working trees in $HOME without clobbering each other. That, in turn, means you can have one repository per config set (zsh, vim, ssh, etc), picking and choosing which configs you want to use on which machine. -`vcsh` is using a technique called fake bare Git repositories, keeping <$GIT_DIR> +`@TRANSFORMED_PACKAGE_NAME@` is using a technique called fake bare Git repositories, keeping <$GIT_DIR> in a different directory from <$GIT_WORK_TREE> which is pointed to <$HOME>. The use of symlinks is not needed in this setup, making for a cleaner setup. -`vcsh` was designed with `mr`(1) in mind so you might want to install it alongside -vcsh. That being said, you can easily use `vcsh` without `mr` if you prefer. +`@TRANSFORMED_PACKAGE_NAME@` was designed with `mr`(1) in mind so you might want to install it alongside +vcsh. That being said, you can easily use `@TRANSFORMED_PACKAGE_NAME@` without `mr` if you prefer. -A sample configuration for `vcsh` and `mr` can be found at -*https://github.com/RichiH/vcsh_mr_template* and used with `vcsh clone +A sample configuration for `@TRANSFORMED_PACKAGE_NAME@` and `mr` can be found at +*https://github.com/RichiH/vcsh_mr_template* and used with `@TRANSFORMED_PACKAGE_NAME@ clone https://github.com/RichiH/vcsh_mr_template mr`. Please note that you can always use a path instead of a name for . @@ -152,7 +152,7 @@ an interactive user. Please note that there is a somewhat magic feature for run. Instead of it accepts , as well. Anything that has a slash in it will be assumed to - be a path. `vcsh run` will then operate on this directory instead of the one + be a path. `@TRANSFORMED_PACKAGE_NAME@ run` will then operate on this directory instead of the one normally generated from the repository's name. This is needed to support mr and other scripts properly and of no concern to an interactive user. @@ -177,22 +177,22 @@ an interactive user. Shortcut to run `git` commands on a repo. Will prepend `git` to . * : - Shortcut to run `vcsh enter `. + Shortcut to run `@TRANSFORMED_PACKAGE_NAME@ enter `. ## ENVIRONMENT -As noted earlier, `vcsh` will set <$GIT_DIR> and <$GIT_WORK_TREE> to the +As noted earlier, `@TRANSFORMED_PACKAGE_NAME@` will set <$GIT_DIR> and <$GIT_WORK_TREE> to the appropriate values for fake bare Git repositories. ## CONFIG -There are several ways to turn the various knobs on `vcsh`. In order of +There are several ways to turn the various knobs on `@TRANSFORMED_PACKAGE_NAME@`. In order of ascending precedence, they are: -* `VARIABLE=foo vcsh` +* `VARIABLE=foo @TRANSFORMED_PACKAGE_NAME@` * * <$XDG_CONFIG_HOME/vcsh/config> -* `vcsh -c ` +* `@TRANSFORMED_PACKAGE_NAME@ -c ` Please note that those files are sourced. Any and all commands will be executed in the context of your shell. @@ -259,9 +259,9 @@ Less interesting knobs you could turn: ## HOOK SYSTEM -`vcsh` provides a hook system. Hook scripts must be executable and should be +`@TRANSFORMED_PACKAGE_NAME@` provides a hook system. Hook scripts must be executable and should be placed in <$XDG_CONFIG_HOME/vcsh/hooks-available>. From there, they can be -soft-linked into <$XDG_CONFIG_HOME/vcsh/hooks-enabled>; `vcsh` will only +soft-linked into <$XDG_CONFIG_HOME/vcsh/hooks-enabled>; `@TRANSFORMED_PACKAGE_NAME@` will only execute hooks that are in this directory. Hooks follow a simple format. will be run before anything is run. @@ -284,7 +284,7 @@ we can ship them by default. ## OVERLAY SYSTEM -`vcsh` also provides an overlay system. Similar to hooks, the recommended +`@TRANSFORMED_PACKAGE_NAME@` also provides an overlay system. Similar to hooks, the recommended locations are <$XDG_CONFIG_HOME/vcsh/overlays-available> and <$XDG_CONFIG_HOME/vcsh/overlays-enabled>. @@ -314,8 +314,8 @@ On Debian-based systems, this file can be found in . ## SECURITY CONSIDERATIONS -`vcsh` allows you to execute arbitrary commands via `vcsh run`. For example, -adding a `sudo`(8) rule for `vcsh` would be pretty stupid. +`@TRANSFORMED_PACKAGE_NAME@` allows you to execute arbitrary commands via `@TRANSFORMED_PACKAGE_NAME@ run`. For example, +adding a `sudo`(8) rule for `@TRANSFORMED_PACKAGE_NAME@` would be pretty stupid. Additionally, vcsh will source, i.e. execute, all files listed in . You can put any and all commands into these config files and they will be @@ -345,7 +345,7 @@ take over the name. ## AUTHOR -This manpage and `vcsh` itself were written by Richard "RichiH" Hartmann. +This manpage and `@TRANSFORMED_PACKAGE_NAME@` itself were written by Richard "RichiH" Hartmann. ## COPYRIGHT diff --git a/vcsh.in b/vcsh.in index 682cc86c..4b2c70a2 100755 --- a/vcsh.in +++ b/vcsh.in @@ -20,7 +20,7 @@ # version of vcsh; the main branch is supposed to be clean at all times # so you can most likely just use it nonetheless VCSH_VERSION='@VERSION@'; export VCSH_VERSION -VCSH_SELF="$(basename "$0")"; export VCSH_SELF +VCSH_SELF="@TRANSFORMED_PACKAGE_NAME@"; export VCSH_SELF # Ensure all files created are accessible only to the current user. umask 0077 From db6408b6132bd6f119eb9034a23ec6c29faaa74e Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 22 Apr 2021 11:30:12 +0300 Subject: [PATCH 45/46] Propagate relative path given by pkg-config to bash completion dir --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index a019cf3d..2f0fe3a5 100644 --- a/configure.ac +++ b/configure.ac @@ -48,8 +48,8 @@ AC_ARG_WITH([bash-completion-dir], [with_bash_completion_dir=yes]) if test "x$with_bash_completion_dir" = "xyes"; then PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], - [BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"], - [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]) + [BASH_COMPLETION_DIR="`pkg-config --define-variable=datadir=$datadir --variable=completionsdir bash-completion`"], + [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]) else BASH_COMPLETION_DIR="$with_bash_completion_dir" fi From c1ae32d08361cec1185614ea82b1e708e68db5d0 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 22 Apr 2021 12:03:15 +0300 Subject: [PATCH 46/46] =?UTF-8?q?Style=20autoconf=20syntax=20more=C2=B9=20?= =?UTF-8?q?consistently?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¹ There are no good code styles for autoconf. The mix of M4 macros and POSIX shell stuff is just going to be a mess. My only claim is that this is more consistent than it was. --- configure.ac | 84 ++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/configure.ac b/configure.ac index 2f0fe3a5..19b0747d 100644 --- a/configure.ac +++ b/configure.ac @@ -5,69 +5,75 @@ AM_INIT_AUTOMAKE([foreign tar-pax dist-xz dist-zip no-dist-gzip color-tests]) AM_SILENT_RULES([yes]) AC_CONFIG_MACRO_DIR([build-aux]) +AC_DEFUN([AX_PROGVAR], [ + test -n "$m4_toupper($1)" || AC_PATH_PROG(m4_toupper($1), m4_default($2,$1)) + test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required]) + ]) + AC_PROG_AWK AC_PROG_GREP AC_PROG_SED -AC_DEFUN([AX_PROGVAR], - [ - test -n "$m4_toupper($1)" || { AC_PATH_PROG(m4_toupper($1), m4_default($2,$1)) } - test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required]) - ]) - AX_PROGVAR([comm]) AX_PROGVAR([cmp]) AX_PROGVAR([git]) AC_ARG_WITH([man-page], - AS_HELP_STRING([--with-man-page], - [Generate man page @<:@default=yes@:>@]), - [], - [with_man_page=yes]) -if test "x$with_man_page" = "xyes"; then - AX_PROGVAR([ronn]) + AS_HELP_STRING([--with-man-page], + [Generate man page @<:@default=yes@:>@]), + [], + [with_man_page=yes]) +if test x"$with_man_page" = x"yes"; then + AX_PROGVAR([ronn]) fi -AM_CONDITIONAL([ENABLE_MAN_PAGE],[test "x$with_man_page" != "xno"]) +AM_CONDITIONAL([ENABLE_MAN_PAGE], + [test x"$with_man_page" != x"no"]) -AS_IF([test -e .tarball-version], m4_define([TESTDEF], [yes]), m4_define([TESTDEF], [no])) +AS_IF([test -e .tarball-version], + m4_define([TESTDEF], [yes]), + m4_define([TESTDEF], [no])) AC_ARG_ENABLE([tests], - AS_HELP_STRING([--disable-tests], [Configure tooling to run tests @<:@default=TESTDEF@:>@]), - ,[enable_tests=TESTDEF]) -AM_CONDITIONAL([ENABLE_TESTS],[test "x$enable_tests" != "xno"]) + AS_HELP_STRING([--disable-tests], + [Configure tooling to run tests @<:@default=TESTDEF@:>@]), + [], + [enable_tests=TESTDEF]) +AM_CONDITIONAL([ENABLE_TESTS],[test x"$enable_tests" != x"no"]) -AS_IF([test "x$enable_tests" != "xno"], [ - AX_PROGVAR([prove]) - AX_PROG_PERL_MODULES(Shell::Command, , AC_MSG_ERROR(Perl module required for testing not found)) - AX_PROG_PERL_MODULES(Test::Most, , AC_MSG_ERROR(Perl module required for testing not found)) +AS_IF([test x"$enable_tests" != x"no"], [ + AX_PROGVAR([prove]) + AX_PROG_PERL_MODULES(Shell::Command, [], + AC_MSG_ERROR(Perl module required for testing not found)) + AX_PROG_PERL_MODULES(Test::Most, [], + AC_MSG_ERROR(Perl module required for testing not found)) ]) AC_ARG_WITH([bash-completion-dir], - AS_HELP_STRING([--with-bash-completion-dir[=PATH]], - [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]), - [], - [with_bash_completion_dir=yes]) -if test "x$with_bash_completion_dir" = "xyes"; then - PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], - [BASH_COMPLETION_DIR="`pkg-config --define-variable=datadir=$datadir --variable=completionsdir bash-completion`"], - [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]) -else - BASH_COMPLETION_DIR="$with_bash_completion_dir" -fi + AS_HELP_STRING([--with-bash-completion-dir[=PATH]], + [Install bash auto-completion definitions to a directory. @<:@default=yes@:>@]), + [], + [with_bash_completion_dir=yes]) +AS_IF([test x"$with_bash_completion_dir" = x"yes"], + [PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], + [BASH_COMPLETION_DIR="$(pkg-config --define-variable=datadir=$datadir --variable=completionsdir bash-completion)"], + [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"])], + [BASH_COMPLETION_DIR="$with_bash_completion_dir"]) AC_SUBST([BASH_COMPLETION_DIR]) -AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"]) +AM_CONDITIONAL([ENABLE_BASH_COMPLETION], + [test x"$with_bash_completion_dir" != x"no"]) AC_ARG_WITH([zsh-completion-dir], - AS_HELP_STRING([--with-zsh-completion-dir[=PATH]], - [Install the zsh auto-completion script in this directory. @<:@default=yes@:>@]), - [], - [with_zsh_completion_dir=yes]) -if test "x$with_zsh_completion_dir" = "xyes"; then + AS_HELP_STRING([--with-zsh-completion-dir[=PATH]], + [Install zsh auto-completion definitions to a directory. @<:@default=yes@:>@]), + [], + [with_zsh_completion_dir=yes]) +if test x"$with_zsh_completion_dir" = x"yes"; then ZSH_COMPLETION_DIR="$datadir/zsh/site-functions" else ZSH_COMPLETION_DIR="$with_zsh_completion_dir" fi AC_SUBST([ZSH_COMPLETION_DIR]) -AM_CONDITIONAL([ENABLE_ZSH_COMPLETION],[test "x$with_zsh_completion_dir" != "xno"]) +AM_CONDITIONAL([ENABLE_ZSH_COMPLETION], + [test x"$with_zsh_completion_dir" != x"no"]) TRANSFORMED_PACKAGE_NAME="$(printf "$PACKAGE_NAME" | $SED -e "${program_transform_name//\$\$/\$}")" AC_SUBST([TRANSFORMED_PACKAGE_NAME])