/[smecontribs]/common/cvs-import.sh
ViewVC logotype

Diff of /common/cvs-import.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.2 by slords, Tue Dec 25 05:10:12 2007 UTC Revision 1.7 by slords, Tue Nov 25 16:20:10 2008 UTC
# Line 5  Line 5 
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.1 2007/11/08 18:10:19 slords Exp $  # $Id: cvs-import.sh,v 1.5 2008/07/30 18:02:28 slords Exp $
9    
10    shopt -s nocasematch
11    
12  # Initial setup  # Initial setup
13  CVSTREE=${CVSTREE:=extras}  CVSTREE=${CVSTREE:=extras}
# Line 27  if test -w $(pwd) ; then Line 29  if test -w $(pwd) ; then
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
# Line 45  EOF Line 49  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
# Line 142  NAME := $NAME Line 145  NAME := $NAME
145  SPECFILE = \$(firstword \$(wildcard *.spec))  SPECFILE = \$(firstword \$(wildcard *.spec))
146    
147  define find-makefile-common  define find-makefile-common
148  for d in ../common ../../common ; do if [ -f \$\$d/Makefile.common ] ; then if [ -f \$\$d/CVS/Root -a -w \$\$/Makefile.common ] ; then cd \$\$d ; cvs -Q update ; fi ; echo "\$\$d/Makefile.common" ; break ; fi ; done  for d in common ../common ../../common ; do if [ -f \$\$d/Makefile.common ] ; then if [ -f \$\$d/CVS/Root -a -w \$\$/Makefile.common ] ; then cd \$\$d ; cvs -Q update ; fi ; echo "\$\$d/Makefile.common" ; break ; fi ; done
149  endef  endef
150    
151  MAKEFILE_COMMON := \$(shell \$(find-makefile-common))  MAKEFILE_COMMON := \$(shell \$(find-makefile-common))
# Line 150  MAKEFILE_COMMON := \$(shell \$(find-make Line 153  MAKEFILE_COMMON := \$(shell \$(find-make
153  ifeq (\$(MAKEFILE_COMMON),)  ifeq (\$(MAKEFILE_COMMON),)
154  # attept a checkout  # attept a checkout
155  define checkout-makefile-common  define checkout-makefile-common
156  test -f CVS/Root && { cd .. ; cvs -Q -d \$\$(cat CVS/Root) checkout common && echo "../common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2  test -f CVS/Root && { cvs -Q -d \$\$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
157  endef  endef
158    
159  MAKEFILE_COMMON := \$(shell \$(checkout-makefile-common))  MAKEFILE_COMMON := \$(shell \$(checkout-makefile-common))
# Line 173  cd $TOPLEVEL/$NAME Line 176  cd $TOPLEVEL/$NAME
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
# Line 200  FILES=$(rpm -qpl $PACKAGE 2>/dev/null) Line 209  FILES=$(rpm -qpl $PACKAGE 2>/dev/null)
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 \
# Line 242  for _f in $FILES ; do Line 252  for _f in $FILES ; do
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
# Line 282  popd >/dev/null Line 292  popd >/dev/null
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
# Line 290  echo "================================== Line 301  echo "==================================
301  echo "Please check the above cvs diff."  echo "Please check the above cvs diff."
302  echo "If you want to make any changes before committing, please press Ctrl-C."  echo "If you want to make any changes before committing, please press Ctrl-C."
303  echo "Otherwise press Enter to proceed to commit."  echo "Otherwise press Enter to proceed to commit."
304  #read  read
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


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed