Bump to new repo-commit and add directory support to series2patch

This commit is contained in:
Mario Fetka 2012-11-19 18:16:45 +01:00
parent f167579796
commit c54c2d9b1f
7 changed files with 139 additions and 82 deletions

View File

@ -1,7 +1,7 @@
EXTRA_DIST = README LICENSES AUTHORS
bin_SCRIPTS = go-commit go-series2epatch go-patch go-checkPatch go-distclean go-redigest go-oneelf go-checkdeps
pkglib_SCRIPTS= go-pkgutil.rb
pkgdata_SCRIPTS= go-pkgutil.rb
man1_MANS = go-commit.1

View File

@ -1,5 +1,5 @@
AC_PREREQ([2.59])
AC_INIT([go-utils], [0.3.1])
AC_INIT([go-utils], [0.4])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.6 foreign dist-bzip2 no-dependencies])

View File

@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2009-04-28.21; # UTC
scriptversion=2011-01-19.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@ -156,6 +156,10 @@ while test $# -ne 0; do
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
@ -200,7 +208,11 @@ if test $# -eq 0; then
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
@ -228,9 +240,9 @@ fi
for src
do
# Protect names starting with `-'.
# Protect names problematic for `test' and other utilities.
case $src in
-*) src=./$src;;
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
@ -252,12 +264,7 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
@ -385,7 +392,7 @@ do
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
@ -403,7 +410,7 @@ do
for d
do
test -z "$d" && continue
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then

53
missing
View File

@ -1,10 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2009-04-28.21; # UTC
scriptversion=2012-01-06.13; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@ -84,7 +84,6 @@ Supported PROGRAM values:
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
@ -122,15 +121,6 @@ case $1 in
# Not GNU programs, they don't have --version.
;;
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
@ -226,7 +216,7 @@ WARNING: \`$1' $msg. You should only need it if
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
eval LASTARG=\${$#}
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@ -256,7 +246,7 @@ WARNING: \`$1' is $msg. You should only need it if
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
eval LASTARG=\${$#}
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@ -318,41 +308,6 @@ WARNING: \`$1' is $msg. You should only need it if
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.

View File

@ -1,4 +1,4 @@
.TH SUNRISE-COMMIT 1 "13 Jul 2010" "@PACKAGE_STRING@" "User Commands"
.TH REPO-COMMIT 1 "13 Jul 2010" "@PACKAGE_STRING@" "User Commands"
.SH NAME
@ -58,6 +58,10 @@ Do not update and rebase the repository before proceeding with the
commit. This option only applies to Subversion and CVS repositories.
It makes no sense to automatically pull from remote DVCS repositories.
.IP "\fB--diff\fP"
Display a complete diff against the previous revision before committing.
.IP "\fB-f\fP, \fB--force\fP"
Force proceeding with the commit even if QA violations occur. With
@ -78,6 +82,10 @@ Do not prepend the commit message with package names.
Ignored (provided for backwards compatibility).
.IP "\fB-S\fP, \fB--no-spelling\fP"
Disable attempt to check the commit message's spelling.
.IP "\fB-t\fP, \fB--trivial\fP"
Assume the changes are trivial and thus do not require a ChangeLog
@ -88,6 +96,12 @@ minor correction of previous ChangeLog entries.
Enable verbose output. Useful mostly for debugging.
.IP "\fB-y\fP, \fB--noask\fP"
Do not ask for the user to confirm the commit. Assume that the user
would type `\fIyes\fP' to any question. This allows the commit to be
performed non-interactively.
.IP "\fB-?\fP, \fB-h\fP, \fB--help\fP"
Print a short help message and exit.

View File

@ -1,5 +1,5 @@
#!/bin/sh
# sunrise-commit -- a Gentoo repository commit helper
# repo-commit -- a Gentoo repository commit helper
# (c) 2011 Michał Górny & Nathan Phillip Brink
# Released under the terms of the 2-clause BSD license.
@ -237,6 +237,19 @@ vcs_status() {
fi
}
# Request VCS to provide a verbose diff.
vcs_diff() {
if [ ${SC_VCS} = git ]; then
git --no-pager diff HEAD -- ${1-.}
elif [ ${SC_VCS} = hg ]; then
hg diff -- ${1-.}
elif [ ${SC_VCS} = svn ]; then
svn diff -- "${@}"
elif [ ${SC_VCS} = cvs ]; then
cvs -n -q diff -u -p -- "${@}"
fi
}
# Add particular files to the repository.
vcs_add() {
${SC_VCS} add -- "${@}"
@ -273,11 +286,51 @@ vcs_update() {
fi
}
# Check the spelling of the commit message if enabled
check_spelling() {
if [ -n "${no_check_spelling}" ]; then
echo "${@}"
return
fi
local speller misspelled_words
for speller in "enchant -l -d en | cat" \
"aspell -l en list | cat" \
"hunspell -l -d en_US | hunspell -l -d en_GB" \
"ispell -l -denglish | ispell -l -dbritish"; do
if echo | ${speller%|*} | ${speller#*|} 2>/dev/null; then
misspelled_words=$(echo "${@}" | ${speller%|*} | ${speller#*|})
break
fi
done
local word expressions
for word in ${misspelled_words}; do
case ${word} in
[Ee]build|[Gg]entoo|[Gg]entoo-x86|${SC_CP#*/}*|${SC_CP%/*})
continue
;;
[Rr]epoman|[Mm]etadata|[Xx][Mm][Ll])
continue
;;
esac
expressions="${expressions} -e s/\\(^\\|[^a-zA-Z]\\)\\(${word}\\)\\([^a-zA-Z]\\|\$\\)/\\1${RED}\\2${RESET}\\3/g"
done
# sed can't handle zero expressions.
if [ -z "${expressions}" ]; then
echo "${@}"
return
fi
echo "${@}" | sed ${expressions}
}
# Print the help message.
print_help() {
cat <<_EOH_
Synopsis:
sunrise-commit [options] [--] <commit message>
repo-commit [options] [--] <commit message>
Options:
-?, -h, --help print this message,
@ -286,17 +339,20 @@ Options:
-c, --changelog force creating a ChangeLog entry,
-C, --nocolor disable colorful output,
-d, --noupdate disable updating the repository,
--diff display diff of changes before committing,
-f, --force force repoman to proceed with the commit,
-H, --nochangelog do not append to ChangeLog nor revert it,
-m, --noformat do not prepend the commit message with package names,
-q, --quiet backwards compat (ignored),
-t, --trivial trivial changes (do not add a ChangeLog entry),
-v, --verbose enable verbose output.
-v, --verbose enable verbose output,
-y, --noask do not ask before committing (avoid interactivity).
_EOH_
}
# Request confirmation before committing. Abort if it is not granted.
confirm() {
${SC_NOASK+return}
while true; do
local answ
printf '\n%s' "${WHITE}Commit changes?${RESET} [${BGREEN}Yes${RESET}/${RED}No${RESET}] ${GREEN}" >&2
@ -318,8 +374,9 @@ confirm() {
# Guess what!
main() {
local commitmsg force monochrome noprepend noupdate trivial
unset SC_VERBOSE SC_WANT_CHANGELOG
local no_check_spelling commitmsg force monochrome noprepend noupdate \
trivial print_diff repoman_changelog
unset SC_NOASK SC_VERBOSE SC_WANT_CHANGELOG
# Command-line parsing.
while [ ${#} -gt 0 ]; do
@ -342,6 +399,9 @@ main() {
-d|--noupdate)
noupdate=1
;;
--diff)
print_diff=1
;;
-f|--force)
force=1
;;
@ -353,12 +413,18 @@ main() {
;;
-q|--quiet)
;;
-S|--no-spelling)
no_check_spelling=1
;;
-t|--trivial)
trivial=1
;;
-v|--verbose)
SC_VERBOSE=1
;;
-y|--noask)
SC_NOASK=
;;
--)
shift
@ -449,19 +515,29 @@ main() {
if [ ! -f metadata.xml ]; then
req cp ../../skel.metadata.xml metadata.xml
# Output similar to echangelog.
diff -dup /dev/null metadata.xml
[ -n "${print_diff}" ] || diff -dup /dev/null metadata.xml
req vcs_add metadata.xml
fi
fi
fi
if [ -z "${trivial}" ]; then
local ecopts
[ ${SC_WANT_CHANGELOG} = force ] && ecopts=--no-strict
sayv '...and appending to it.'
echangelog --vcs ${SC_VCS} ${ecopts} "${commitmsg}" \
|| die 'Please correct the problems shown by echangelog.'
echo
# create ChangeLog entries using repoman if possible
repoman --version --echangelog=y >/dev/null 2>&1
if [ ${?} -ne 2 ]; then
if [ -z "${trivial}" ]; then
repoman_changelog='--echangelog=y'
else
repoman_changelog='--echangelog=n'
fi
else
if [ -z "${trivial}" ]; then
local ecopts
[ ${SC_WANT_CHANGELOG} = force ] && ecopts=--no-strict
sayv '...and appending to it.'
echangelog --vcs ${SC_VCS} ${ecopts} -- "${commitmsg}" \
|| die 'Please correct the problems shown by echangelog.'
echo
fi
fi
fi
@ -476,7 +552,9 @@ main() {
echo
fi
if [ ${SC_VCS} != cvs ] || [ -n "${noupdate}" ]; then
if [ -n "${print_diff}" ]; then
vcs_diff
elif [ ${SC_VCS} != cvs ] || [ -n "${noupdate}" ]; then
vcs_status
fi
echo
@ -509,14 +587,17 @@ main() {
if ! repoman full; then
[ -n "${force}" ] || die 'Please correct the problems shown by repoman.'
fi
confirm
fi
# In CVS, we don't prepend the package name to the commit message.
[ ${SC_VCS} = cvs ] && noprepend=
say "${BGREEN}Ready to commit using the following commit message:${RESET}"
say "${noprepend-${SC_CP}: }$(check_spelling "${commitmsg}")"
${old_repoman+confirm}
sayv "Now, let's let repoman do its job..."
exec repoman commit ${old_repoman--a} ${force+-f} -m "${noprepend-${SC_CP}: }${commitmsg}"
exec repoman commit ${old_repoman-${SC_NOASK--a}} ${force+-f} ${repoman_changelog} -m "${noprepend-${SC_CP}: }${commitmsg}"
;;
# Clean removal of a package set.
@ -539,8 +620,8 @@ main() {
echo
fi
say "Ready to commit ${WHITE}$(echo ${SC_REMOVED_PACKAGE_LIST} | wc -w)${RESET} package removal(s), with commit message:"
say "${BGREEN}${SC_CP}: ${commitmsg}${RESET}"
say "${BGREEN}Ready to commit ${WHITE}$(echo ${SC_REMOVED_PACKAGE_LIST} | wc -w)${BGREEN} package removal(s), with commit message:${RESET}"
say "${SC_CP}: $(check_spelling "${commitmsg}")"
confirm
if [ -z "${noupdate}" ]; then

View File

@ -58,7 +58,7 @@ sed -e '/^#/d' -i $2/series
cnt=$1
for f in $(<$2/series) ; do
cp $2/${f} $3/${cnt}_${f}
cp $2/${f} $3/${cnt}_${f##*/}
((cnt++))
done