rpms/kernel/devel/scripts rebase.sh,NONE,1.1

Dave Jones (davej) fedora-extras-commits at redhat.com
Tue Jul 3 20:26:17 UTC 2007


Author: davej

Update of /cvs/pkgs/rpms/kernel/devel/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14197/scripts

Added Files:
	rebase.sh 
Log Message:
Add a script to make rebasing easier.
So far only tested on git->git transitions.
Will be fleshed out further each time a different transition occurs.




--- NEW FILE rebase.sh ---
#!/bin/bash

# Is there a new snapshot ?
export OLD=`grep ^patch upstream | tail -n1 | sed s/patch-// | sed s/\.bz2//`
export OLDBASE=`echo $OLD | sed s/-/\ /g | sed s/2\.6\.// | awk '{ print $1 }'`
export OLDRC=`echo $OLD | sed s/-/\ /g | sed s/rc// | awk '{ print $2 }'`
export OLDGIT=`echo $OLD | sed s/-/\ /g | sed s/git// | awk '{ print $3 }'`

NEW=`lynx -dump http://www.kernel.org/kdist/finger_banner | grep "snapshot for the stable"`
if [ "${?}" != 0 ] ; then
  echo "No new git snapshot of stable branch".
  exit
fi
export NEW=`echo $NEW | awk '{ print $11 }'`
export NEWBASE=`echo $NEW | sed s/-/\ /g | sed s/2\.6\.// | awk '{ print $1 }'`
export NEWRC=`echo $NEW | sed s/-/\ /g | sed s/rc// | awk '{ print $2 }'`
export NEWGIT=`echo $NEW | sed s/-/\ /g | sed s/git// | awk '{ print $3 }'`

echo "OLD kernel was $OLD  BASE=$OLDBASE RC=$OLDRC GIT=$OLDGIT"
echo "NEW kernel is  $NEW  BASE=$NEWBASE RC=$NEWRC GIT=$NEWGIT"

if [ "$OLDBASE" = "$NEWBASE" ]; then
  echo Same base
else
  echo "Rebasing across point releases not yet done."
  exit
fi

if [ "$OLDRC" != "$NEWRC" ]; then
  echo "Different rc. Rebasing from $OLDRC to $NEWRC"
  perl -p -i -e 's/^%define\ rcrev\ $ENV{"OLDRC"}/\%define\ rcrev\ $ENV{"NEWRC"}/' kernel-2.6.spec
fi

if [ "$OLDGIT" != "$NEWGIT" ]; then
  echo "Different git. Rebasing from git$OLDGIT to git$NEWGIT"
  perl -p -i -e 's/^%define\ gitrev\ $ENV{"OLDGIT"}/\%define\ gitrev\ $ENV{"NEWGIT"}/' kernel-2.6.spec
  perl -p -i -e 's/$ENV{OLD}/$ENV{NEW}/' .cvsignore
  perl -p -i -e 's/$ENV{OLD}/$ENV{NEW}/' upstream
  #TODO: Remove the $OLD line from sources

  make download
  make upload FILES=patch-$NEW.bz2

  cvs add patch-$NEW.bz2.sign
  rm -f patch-$OLD.bz2
  rm -f patch-$OLD.bz2.sign
  cvs remove patch-$OLD.bz2.sign
fi

#TODO: Call this only if we changed version.
bumpspecfile.py kernel-2.6.spec "- $NEW"
make clog





More information about the scm-commits mailing list