5 |
# Copyright (C) 2004-2005 Red Hat, Inc. |
# Copyright (C) 2004-2005 Red Hat, Inc. |
6 |
# Copyright (C) 2005 Fedora Foundation |
# Copyright (C) 2005 Fedora Foundation |
7 |
# |
# |
8 |
# $Id: cvs-import.sh,v 1.3 2007/12/25 05:12:58 slords Exp $ |
# $Id: cvs-import.sh,v 1.7 2008/02/08 18:52:15 slords Exp $ |
9 |
|
|
10 |
|
shopt -s nocasematch |
11 |
|
|
12 |
# Initial setup |
# Initial setup |
13 |
CVSTREE=${CVSTREE:=extras} |
CVSTREE=${CVSTREE:=extras} |
29 |
WORKDIR="$(pwd)" |
WORKDIR="$(pwd)" |
30 |
fi |
fi |
31 |
|
|
32 |
|
[ -f branch ] && BRANCH=$(cat branch) |
33 |
|
|
34 |
# short usage help |
# short usage help |
35 |
Usage() { |
Usage() { |
36 |
cat <<EOF |
cat <<EOF |
49 |
} |
} |
50 |
|
|
51 |
# Parse arguments |
# Parse arguments |
|
BRANCH= |
|
52 |
MESSAGE= |
MESSAGE= |
53 |
while [ -n "$1" ] ; do |
while [ -n "$1" ] ; do |
54 |
case "$1" in |
case "$1" in |
176 |
# check if we have imported this entry |
# check if we have imported this entry |
177 |
TAG=$(echo "${NAME##[0-9]}-$VERSION-$RELEASE" | sed -e 's/[$,.:;@]/_/g') |
TAG=$(echo "${NAME##[0-9]}-$VERSION-$RELEASE" | sed -e 's/[$,.:;@]/_/g') |
178 |
LOG_ENTRY="$TAG:${BRANCH:-HEAD}:$(basename $PACKAGE)" |
LOG_ENTRY="$TAG:${BRANCH:-HEAD}:$(basename $PACKAGE)" |
179 |
|
if [ -n "$(grep ""^$LOG_ENTRY"" ./${BRANCH}/import.log 2>/dev/null)" ] ; then |
180 |
|
echo "ERROR: $PACKAGE was already imported on branch ${BRANCH:-HEAD}" |
181 |
|
CleanUp |
182 |
|
exit -2 |
183 |
|
fi |
184 |
|
# Check here as well because back in the old days we used to write it here |
185 |
if [ -n "$(grep ""^$LOG_ENTRY"" ./import.log 2>/dev/null)" ] ; then |
if [ -n "$(grep ""^$LOG_ENTRY"" ./import.log 2>/dev/null)" ] ; then |
186 |
echo "ERROR: $PACKAGE was already imported on branch ${BRANCH:-HEAD}" |
echo "ERROR: $PACKAGE was already imported on branch ${BRANCH:-HEAD}" |
187 |
CleanUp |
CleanUp |
209 |
# Remove the files that are no longer present |
# Remove the files that are no longer present |
210 |
OLDFILES=$(find ${BRANCH} -maxdepth 1 -type f \ |
OLDFILES=$(find ${BRANCH} -maxdepth 1 -type f \ |
211 |
-not -name branch \ |
-not -name branch \ |
212 |
|
-not -name import.log \ |
213 |
-not -name sources \ |
-not -name sources \ |
214 |
-not -name Makefile \ |
-not -name Makefile \ |
215 |
-not -name .cvsignore \ |
-not -name .cvsignore \ |
252 |
pushd ${BRANCH} >/dev/null |
pushd ${BRANCH} >/dev/null |
253 |
if [ "$add_file" = "yes" ] ; then |
if [ "$add_file" = "yes" ] ; then |
254 |
case $f in |
case $f in |
255 |
*.tar | *gz | *.bz2 | *.Z | *.zip | *.ZIP | \ |
*.tar | *gz | *.bz2 | *.lzma | *.Z | *.zip | \ |
256 |
*.ttf | *.bin | *.tbz | *.pdf | *.rpm | \ |
*.ttf | *.bin | *.tbz | *.tbz2 | *.pdf | *.rpm | \ |
257 |
*.jar | *.war | *.db | *.cpio | *.jisp | *.egg ) |
*.jar | *.war | *.db | *.cpio | *.jisp | *.egg | *.gem ) |
258 |
UPLOADFILES="$UPLOADFILES $f" |
UPLOADFILES="$UPLOADFILES $f" |
259 |
if [ -n "$(grep $f sources 2>/dev/null)" ] ; then |
if [ -n "$(grep $f sources 2>/dev/null)" ] ; then |
260 |
# this file existed before with a different md5sum |
# this file existed before with a different md5sum |
292 |
rm -rf $TMP2 |
rm -rf $TMP2 |
293 |
|
|
294 |
# setup finished |
# setup finished |
295 |
echo "$LOG_ENTRY:$(date +%s)" >> ./import.log |
[ -f ./${BRANCH}/import.log ] || $(touch ./${BRANCH}/import.log; cvs add ./${BRANCH}/import.log) |
296 |
|
echo "$LOG_ENTRY:$(date +%s)" >> ./${BRANCH}/import.log |
297 |
|
|
298 |
echo "=======================================================================" |
echo "=======================================================================" |
299 |
cvs -Q diff -u |
cvs -Q diff -u |
305 |
|
|
306 |
cvs -Q update && \ |
cvs -Q update && \ |
307 |
echo "cvs commit..." && \ |
echo "cvs commit..." && \ |
308 |
cvs -Q commit ${MESSAGE:+-m "$MESSAGE"} && echo "Commit Complete" |
cvs -Q commit ${MESSAGE:+-m "$MESSAGE"} && echo "Commit Complete" && \ |
309 |
|
cd ${BRANCH} && make tag && echo "Tagging '${TAG}' complete." |
310 |
|
|
311 |
# Clean up |
# Clean up |
312 |
CleanUp |
CleanUp |