This commit is contained in:
Mario Fetka 2011-11-02 13:32:30 +01:00
parent 8c3de565a3
commit f167579796
4 changed files with 84 additions and 56 deletions

View File

@ -6,10 +6,10 @@ man1_MANS = go-commit.1
go-commit:
$(CP) sunrise-commit go-commit
$(CP) repo-commit go-commit
go-commit.1:
$(CP) sunrise-commit.1 go-commit.1
$(CP) repo-commit.1 go-commit.1
go-series2epatch:
$(CP) series2epatch go-series2epatch

View File

@ -1,5 +1,5 @@
AC_PREREQ([2.59])
AC_INIT([go-utils], [0.3])
AC_INIT([go-utils], [0.3.1])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.6 foreign dist-bzip2 no-dependencies])
@ -27,6 +27,6 @@ AC_CONFIG_FILES([distclean-0.3.py], [chmod +x distclean-0.3.py])
AC_CONFIG_FILES([lfspatch], [chmod +x lfspatch])
AC_CONFIG_FILES([redigest], [chmod +x redigest])
AC_CONFIG_FILES([series2epatch], [chmod +x series2epatch])
AC_CONFIG_FILES([sunrise-commit.1], [chmod +x sunrise-commit.1])
AC_CONFIG_FILES([sunrise-commit], [chmod +x sunrise-commit])
AC_CONFIG_FILES([repo-commit.1], [chmod +x repo-commit.1])
AC_CONFIG_FILES([repo-commit], [chmod +x repo-commit])
AC_OUTPUT

View File

@ -1,19 +1,19 @@
.TH GO-COMMIT 1 "13 Jul 2010" "@PACKAGE_STRING@" "User Commands"
.TH SUNRISE-COMMIT 1 "13 Jul 2010" "@PACKAGE_STRING@" "User Commands"
.SH NAME
go-commit \- a Gentoo repository commit helper.
repo-commit \- a Gentoo repository commit helper.
.SH SYNOPSIS
.B go-commit
.B repo-commit
[options]
[--]
.I <commit-message>
.SH DESCRIPTION
.B go-commit
.B repo-commit
is a helper script for Gentoo repository commiters. Apart from
performing the actual commit, it performs the following tasks:
@ -64,6 +64,12 @@ Force proceeding with the commit even if QA violations occur. With
this option, errors from `\fIrepoman full\fP' will be ignored and
\fB--force\fP is passed to `\fIrepoman commit\fP'.
.IP "\fB-H\fP, \fB--nochangelog\fP"
Disable appending ChangeLog entries and reverting them. In other words,
this option makes sure \fBrepo-commit\fP won't touch the ChangeLog at
all.
.IP "\fB-m\fP, \fB--noformat\fP"
Do not prepend the commit message with package names.
@ -94,8 +100,8 @@ Print the version string and exit.
.IP ECHANGELOG_USER
the committer name and e-mail as it would appear in ChangeLog.
The go-suggested format is:
The committer name and e-mail as it would appear in ChangeLog.
The sunrise-suggested format is:
.IR "Real Name" " (" nickname ") <" e-mail >
@ -105,7 +111,7 @@ The go-suggested format is:
.IP "Adding and Updating Packages"
The primary use of \fBgo-commit\fP is to add packages to a Gentoo
The primary use of \fBrepo-commit\fP is to add packages to a Gentoo
repository or update existing packages. In order to use it this way,
you are expected to run it from within the package's directory,
providing an appropriate changelog message. (The package's directory
@ -113,9 +119,9 @@ is the directory holding its ebuilds).
If your package requires an additional file to be committed outside
the package directory (e.g. an eclass, a license), then you need to
commit that file manually \fBbefore\fP using \fBgo-commit\fP.
commit that file manually \fBbefore\fP using \fBrepo-commit\fP.
\fBgo-commit\fP will update the ChangeLog entry and call
\fBrepo-commit\fP will update the ChangeLog entry and call
.BR repoman (1)
to do the actual commit for you. If the package's ChangeLog should
\fBnot\fP be updated for a particular commit, use \fB--trivial\fP.
@ -124,17 +130,17 @@ If you are adding a new package and using subversion or a similar VCS,
you may get a warning that your VCS's update command failed. For
example, subversion's update command fails when run from a newly added,
but not yet committed, directory. To avoid this warning, you may use
\fB--noupdate\fP. This option prevents \fBgo-commit\fP from calling the
\fB--noupdate\fP. This option prevents \fBrepo-commit\fP from calling the
VCS's update command (which only happens if you are not using DVCS).
.IP "Removing Packages"
\fBgo-commit\fP can be used to remove a set of packages too. In order to
\fBrepo-commit\fP can be used to remove a set of packages too. In order to
do so, first mark all the expected packages as removed using your VCS.
Next, perform the necessary \fBpackage.mask\fP changes and remove
licenses no longer in use.
Afterwards, call \fBgo-commit\fP from within your repository's root
Afterwards, call \fBrepo-commit\fP from within your repository's root
directory, passing the removal reason as an argument. The script will
prepend your commit message with the complete removed package list.
@ -144,7 +150,7 @@ atomic package removal commit, where \fBpackage.mask\fP entries and
files used only by the removed packages are removed. However, this can
cause trouble if the working copy is dirty.
\fBgo-commit\fP will check whether any removed package is still
\fBrepo-commit\fP will check whether any removed package is still
referenced by any of the other packages by default. If it finds an
internal package reference, it will give an error message. This is in
order to ensure that no package will be left with unsatisfied
@ -165,7 +171,7 @@ $ svn mkdir app-foo/bar
$ cd app-foo/bar
[...]
$ svn add bar-1.ebuild
$ go-commit 'New ebuild for bug #nnnnnn.'
$ repo-commit 'New ebuild for bug #nnnnnn.'
.fi
.I "2. Performing a version bump:"
@ -174,23 +180,23 @@ $ go-commit 'New ebuild for bug #nnnnnn.'
$ cd app-foo/bar
$ svn mv bar-1.ebuild bar-2.ebuild
[...]
$ go-commit 'Version bump.'
$ repo-commit 'Version bump.'
.fi
.I "3. Fixing a broken Manifest:"
.nf
$ cd app-foo/bar
$ go-commit -t 'Fixing a broken Manifest.'
$ repo-commit -t 'Fixing a broken Manifest.'
.fi
(\fBgo-commit\fP always updates the Manifest)
(\fBrepo-commit\fP always updates the Manifest)
.I "4. Removing a package which was added to gx86:"
.nf
$ svn rm app-foo/bar
$ go-commit -f 'in gx86.'
$ repo-commit -f 'in gx86.'
.fi
.SH "REPORTING BUGS"
@ -201,9 +207,9 @@ Please report bugs via Gentoo Bugzilla:
.SH AUTHORS
Michal Gorny <gentoo@mgorny.alt.pl>
Michal Gorny <mgorny@gentoo.org>
Nathan Phillip Brink <ohnobinki@ohnopublishing.net>
Nathan Phillip Brink <binki@gentoo.org>
.SH "SEE ALSO"

View File

@ -1,7 +1,7 @@
#!/bin/sh
# go-commit -- a Gentoo repository commit helper
# (c) 2010 Michał Górny <gentoo@mgorny.alt.pl>
# Released under the terms of the 3-clause BSD license.
# sunrise-commit -- a Gentoo repository commit helper
# (c) 2011 Michał Górny & Nathan Phillip Brink
# Released under the terms of the 2-clause BSD license.
# -- output helpers --
@ -44,7 +44,7 @@ local_supported() {
}
# If it is not, declare dummy local() function unsetting the variables.
local_supported || eval 'local() {
( local_supported ) || eval 'local() {
unset "${@}"
}'
@ -52,14 +52,12 @@ local_supported || eval 'local() {
# See if we're in a repo, and what VCS are we using.
find_repo() {
: ${SC_WANT_CHANGELOG=}
if svn info >/dev/null 2>&1; then
SC_VCS=svn
SC_WANT_CHANGELOG=1
: ${SC_WANT_CHANGELOG=1}
elif cvs status -l >/dev/null 2>&1; then
SC_VCS=cvs
SC_WANT_CHANGELOG=1
: ${SC_WANT_CHANGELOG=1}
elif hg tip >/dev/null 2>&1; then
SC_VCS=hg
else
@ -69,7 +67,7 @@ find_repo() {
if [ ${ret} -ne 127 ] && [ ${ret} -ne 128 ]; then
if echo "${remotes}" | grep git-svn >/dev/null 2>&1; then
SC_WANT_CHANGELOG=1
: ${SC_WANT_CHANGELOG=1}
fi
SC_VCS=git
else
@ -279,16 +277,17 @@ vcs_update() {
print_help() {
cat <<_EOH_
Synopsis:
go-commit [options] [--] <commit message>
sunrise-commit [options] [--] <commit message>
Options:
-?, -h, --help print this message,
-V, --version print version string,
-c, --changelog backwards compat (ignored),
-c, --changelog force creating a ChangeLog entry,
-C, --nocolor disable colorful output,
-d, --noupdate disable updating the repository,
-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),
@ -320,7 +319,7 @@ confirm() {
# Guess what!
main() {
local commitmsg force monochrome noprepend noupdate trivial
unset SC_VERBOSE
unset SC_VERBOSE SC_WANT_CHANGELOG
# Command-line parsing.
while [ ${#} -gt 0 ]; do
@ -335,7 +334,7 @@ main() {
;;
-c|--changelog)
SC_WANT_CHANGELOG=1
SC_WANT_CHANGELOG=force
;;
-C|--nocolor)
monochrome=1
@ -346,6 +345,9 @@ main() {
-f|--force)
force=1
;;
-H|--nochangelog)
SC_WANT_CHANGELOG=
;;
-m|--noformat)
noprepend=
;;
@ -409,22 +411,40 @@ main() {
vcs_update
fi
local bns bn word bug_next
for word in ${commitmsg}; do
case ${word} in
[Bb][Uu][Gg])
bug_next=1
;;
\#*)
bn="${word}"
;;
*)
[ -z "${bug_next}" ] && continue
bn="${word}"
bug_next=
;;
esac
if [ -n "${bn}" ]; then
bns="${bns:+${bns} }$(expr "${bn}" : '[^[:digit:]]*\([[:digit:]]\{1,\}\)')"
bn=
fi
done
# With DVCS repos, we do not do ChangeLogs by default...
# ...at least unless they're already there.
if [ -n "${SC_WANT_CHANGELOG}" ] || [ -f ChangeLog ]; then
[ -f ChangeLog ] && : ${SC_WANT_CHANGELOG=1}
if [ -n "${SC_WANT_CHANGELOG}" ]; then
sayv 'Cleaning up the ChangeLog...'
vcs_reset ChangeLog
local bns
# Let's take a lucky guess bugnumbers consist of 4+ digits.
bns=$(echo "${commitmsg}" | grep -o -E '[0-9]{4,}')
# Creating a new ChangeLog? Let's take a look at the commit message.
if [ ! -f ChangeLog ]; then
[ -n "${trivial}" ] && die "Trivial change for an initial commit? You're joking, right?"
# Geos_One-specific checks.
if [ "$(cat ../../profiles/repo_name 2>/dev/null)" = "go" ]; then
# Sunrise-specific checks.
if [ "$(cat ../../profiles/repo_name 2>/dev/null)" = "sunrise" ]; then
[ -z "${bns}" ] && die 'Please supply the bug number in the initial commit message!'
if [ ! -f metadata.xml ]; then
req cp ../../skel.metadata.xml metadata.xml
@ -436,22 +456,24 @@ main() {
fi
if [ -z "${trivial}" ]; then
local ecopts
[ ${SC_WANT_CHANGELOG} = force ] && ecopts=--no-strict
sayv '...and appending to it.'
echangelog --vcs ${SC_VCS} "${commitmsg}" \
echangelog --vcs ${SC_VCS} ${ecopts} "${commitmsg}" \
|| die 'Please correct the problems shown by echangelog.'
echo
fi
fi
if [ -n "${bns}" ]; then
local bn cbn
for bn in ${bns}; do
cbn=#${WHITE}${bn}${NORMAL}
wget -q http://bugs.gentoo.org/show_bug.cgi?id=${bn} -O - | sed -n \
-e "s, *<title>Gentoo Bug \([0-9]*\) - \(.*\)</title>,Bug ${cbn}: ${BGREEN}\2${RESET},p" \
-e "s, *<title>Gentoo \(Invalid Bug ID\)</title>,Bug ${cbn}: ${YELLOW}!! \1${RESET},p"
done
echo
fi
if [ -n "${bns}" ]; then
local bn cbn
for bn in ${bns}; do
cbn=#${WHITE}${bn}${NORMAL}
wget -q http://bugs.gentoo.org/show_bug.cgi?id=${bn} -O - | sed -n \
-e "s, *<title>\(Gentoo \)\?Bug \([0-9]*\) \(-\|&ndash;\) \(.*\)</title>,Bug ${cbn}: ${BGREEN}\4${RESET},p" \
-e "s, *<title>\(Gentoo \)\?\(Invalid Bug ID\)</title>,Bug ${cbn}: ${YELLOW}!! \2${RESET},p"
done
echo
fi
if [ ${SC_VCS} != cvs ] || [ -n "${noupdate}" ]; then