aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/echangelog/Makefile2
-rwxr-xr-xsrc/echangelog/test/test.sh86
3 files changed, 41 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 479e985..31dac8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-16: Christian Ruppert <idl0r@gentoo.org>
+ * echangelog: Make test case POSIX conform.
+ Update md5 sums.
+
2010-10-28: Tomáš Chvátal <scarabeus@gentoo.org>
* eshowkw: Deprecate eshowkw.
This package (more of its full rewrite) will be from now on at
diff --git a/src/echangelog/Makefile b/src/echangelog/Makefile
index 3d7e0cd..36134df 100644
--- a/src/echangelog/Makefile
+++ b/src/echangelog/Makefile
@@ -11,7 +11,7 @@ include ../../makedefs.mak
all:
test:
- cd test; bash test.sh
+ cd test; sh test.sh
dist:
mkdir -p ../../$(distdir)/src/echangelog/test/templates
diff --git a/src/echangelog/test/test.sh b/src/echangelog/test/test.sh
index 14703d4..890f7e8 100755
--- a/src/echangelog/test/test.sh
+++ b/src/echangelog/test/test.sh
@@ -1,33 +1,35 @@
-#!/bin/bash
+#!/bin/sh
-source /etc/init.d/functions.sh
+# Load functions.sh
+. "/etc/init.d/functions.sh"
-SUPPORTED_VCS=( "cvs" "svn" "git" )
+SUPPORTED_VCS="cvs svn git"
VCSTEST="echangelog-test/vcstest"
_ROOT=$(pwd)
export ECHANGELOG_USER="Just a test <echangelogtest@gentoo.org>"
-MD5_INIT="34d54bc2ab1a2154b0c7bd5cdd7f6119"
-MD5_PATCH="db1ab89bb7374824d0f198078f79a83f"
-MD5_REVBUMP="31ddfa60d2ae4dd1fccd7e3d2bd2c06c"
-MD5_COPYRIGHT="6f39fa409ea14bb6506347c53f6dee50"
-MD5_OBSOLETE="0aedadf159c6f3add97a3f79fb867221"
-MD5_FINAL="17eb0df69f501cc6fdaffebd118b7764"
+MD5_INIT="21ac109c53cf02378593a4f613b2bb55"
+MD5_PATCH="f3fa1cacae3bf51d6188278e6a5fd0c6"
+MD5_REVBUMP="e474aa136f06e2a001320240b2ae92bd"
+MD5_COPYRIGHT="9ce45576db5489c4f109ed9ef9ffe05e"
+MD5_OBSOLETE="f0079450e03e69741502776a6b8138dc"
+MD5_FINAL="a3954786368fd92d8466bc65cbf689fc"
-function md5() {
+md5() {
local fname=$1
echo $(md5sum ${fname} | awk '{ print $1 }')
}
-function ech() {
+ech() {
local bin=$1
- local msg=$2
+ shift
+ local msg="${*}"
perl -I$(dirname $(dirname ${bin})) ${bin} "${msg}"
}
-function make_test() {
+make_test() {
local root=$1
local vcs=$2
@@ -38,23 +40,20 @@ function make_test() {
cd $root
mkdir -p ${tmp}
cd ${tmp}
-
- [[ "${vcs}" == "cvs" ]] && mkdir -p ${tmp}/cvsroot
- [[ "${vcs}" == "svn" ]] && mkdir -p ${tmp}/svnroot
- if [[ "${vcs}" == "git" ]];
- then
+ [ "${vcs}" = "cvs" ] && mkdir -p ${tmp}/cvsroot
+ [ "${vcs}" = "svn" ] && mkdir -p ${tmp}/svnroot
+
+ if [ "${vcs}" = "git" ]; then
git init
touch .gitignore
git add .gitignore
git commit -a -m 'Initial Commit'
- elif [[ "${vcs}" == "svn" ]];
- then
+ elif [ "${vcs}" = "svn" ]; then
svnadmin create svnroot
svn co file://${tmp}/svnroot svn
cd svn
- elif [[ "${vcs}" == "cvs" ]];
- then
+ elif [ "${vcs}" = "cvs" ]; then
CVSROOT="${tmp}/cvsroot" cvs init
mkdir cvsroot/cvs
cvs -d:local:${tmp}/cvsroot co cvs
@@ -65,8 +64,7 @@ function make_test() {
cp ${template}/vcstest-0.0.1.ebuild ${VCSTEST}
${vcs} add $(dirname ${VCSTEST})
- if [[ "${vcs}" == "cvs" ]];
- then
+ if [ "${vcs}" = "cvs" ]; then
${vcs} add ${VCSTEST}
${vcs} add "${VCSTEST}/vcstest-0.0.1.ebuild"
fi
@@ -74,15 +72,13 @@ function make_test() {
cd ${VCSTEST}
ech ${echangelog} 'New ebuild for bug <id>.'
- if [[ "${MD5_INIT}" != "$(md5 ChangeLog)" ]];
- then
+ if [ "${MD5_INIT}" != "$(md5 ChangeLog)" ]; then
eerror "WRONG MD5_INIT!"
fi
mkdir files
cp ${template}/test.patch files
- if [[ "${vcs}" == "cvs" ]];
- then
+ if [ "${vcs}" = "cvs" ]; then
${vcs} add files/
${vcs} add files/test.patch
else
@@ -91,40 +87,35 @@ function make_test() {
ech ${echangelog} "Added adittional patch to fix foo."
- if [[ "${MD5_PATCH}" != "$(md5 ChangeLog)" ]];
- then
+ if [ "${MD5_PATCH}" != "$(md5 ChangeLog)" ]; then
eerror "WRONG MD5_PATCH!"
fi
- if [[ "${vcs}" == "svn" ]];
- then
+ if [ "${vcs}" = "svn" ]; then
${vcs} commit -m 'New ebuild for bug <id>.' ../
else
${vcs} commit -m 'New ebuild for bug <id>.'
fi
- [[ "${vcs}" == "cvs" ]] && sed -i -e 's:# $Header\: .*$:# $Header\: $:' ChangeLog
+ [ "${vcs}" = "cvs" ] && sed -i -e 's:# $Header\: .*$:# $Header\: $:' ChangeLog
cp vcstest-0.0.1.ebuild vcstest-0.0.1-r1.ebuild
${vcs} add vcstest-0.0.1-r1.ebuild
ech ${echangelog} "Revbump..."
- if [[ "${MD5_REVBUMP}" != "$(md5 ChangeLog)" ]];
- then
+ if [ "${MD5_REVBUMP}" != "$(md5 ChangeLog)" ]; then
eerror "WRONG MD5_REVBUMP!"
fi
sed -i -e 's:# Copyright 1999-2009 Gentoo Foundation:# Copyright 1999-2010 Gentoo Foundation:' vcstest-0.0.1.ebuild
ech ${echangelog} "Revbump...; Just copyright changed."
- if [[ "${MD5_COPYRIGHT}" != "$(md5 ChangeLog)" ]];
- then
+ if [ "${MD5_COPYRIGHT}" != "$(md5 ChangeLog)" ]; then
eerror "WRONG MD5_COPYRIGHT!"
fi
- if [[ "${vcs}" == "cvs" ]];
- then
+ if [ "${vcs}" = "cvs" ]; then
rm -f files/test.patch
${vcs} remove files/test.patch
else
@@ -133,27 +124,24 @@ function make_test() {
ech ${echangelog} "Revbump...; Just copyright changed; Removed obsolete patch."
- if [[ "${MD5_OBSOLETE}" != "$(md5 ChangeLog)" ]];
- then
+ if [ "${MD5_OBSOLETE}" != "$(md5 ChangeLog)" ]; then
eerror "WRONG MD5_OBSOLETE!"
fi
echo>>vcstest-0.0.1.ebuild
ech ${echangelog} "Revbump...; Just copyright changed; Removed obsolete patch; Modified more then just the copyright."
- if [[ "${MD5_FINAL}" != "$(md5 ChangeLog)" ]];
- then
+ if [ "${MD5_FINAL}" != "$(md5 ChangeLog)" ]; then
eerror "WRONG MD5_FINAL!"
fi
}
-[[ -d "${_ROOT}/tmp" ]] && rm -rf ${_ROOT}/tmp
+[ -d "${_ROOT}/tmp" ] && rm -rf ${_ROOT}/tmp
mkdir -p ${_ROOT}/tmp
ebegin "Preparing echangelog"
-if [[ -e ../echangelog ]];
-then
+if [ -e "../echangelog" ]; then
cp ../echangelog "${_ROOT}/tmp" || set $?
sed -i -e 's:use POSIX qw.*:use POSIX qw(setlocale getcwd);\nuse TEST qw(strftime);:' "${_ROOT}/tmp/echangelog" || set $?
eend ${1:-0} || exit ${1}
@@ -163,10 +151,8 @@ else
exit 1
fi
-for vcs in ${SUPPORTED_VCS[*]};
-do
- if [[ -x "$(which ${vcs} 2>/dev/null)" ]];
- then
+for vcs in $SUPPORTED_VCS; do
+ if [ -x "$(which ${vcs} 2>/dev/null)" ]; then
ebegin "Starting test with ${vcs}"
make_test $_ROOT "${vcs}" || set $?
eend ${1:-0}