rpms/kernel-xen-2.6/F-7/scripts bumpspecfile.py, NONE, 1.1.2.1 configcommon.pl, NONE, 1.1.2.1 configdiff.pl, NONE, 1.1.2.1 cross-amd64.sh, NONE, 1.1.2.1 cross-i586.sh, NONE, 1.1.2.1 cross-i686.sh, NONE, 1.1.2.1 cross-ia64.sh, NONE, 1.1.2.1 cross-iseries.sh, NONE, 1.1.2.1 cross-ppc.sh, NONE, 1.1.2.1 cross-ppc64.sh, NONE, 1.1.2.1 cross-ppc8260.sh, NONE, 1.1.2.1 cross-ppc8560.sh, NONE, 1.1.2.1 cross-pseries.sh, NONE, 1.1.2.1 cross-s390.sh, NONE, 1.1.2.1 cross-s390x.sh, NONE, 1.1.2.1 newpatch.sh, NONE, 1.1.2.1 pull-upstreams.sh, NONE, 1.1.2.1 rebase-xen-hv.sh, NONE, 1.1.2.1 rebase-xen-kernel.sh, NONE, 1.1.2.1 rebase.sh, NONE, 1.1.2.1 reconfig.sh, NONE, 1.1.2.1 rediffall.pl, NONE, 1.1.2.1

Eduardo Habkost (ehabkost) fedora-extras-commits at redhat.com
Wed Oct 17 19:27:04 UTC 2007


Author: ehabkost

Update of /cvs/pkgs/rpms/kernel-xen-2.6/F-7/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2290/scripts

Added Files:
      Tag: private-ehabkost-debuginfo-branch
	bumpspecfile.py configcommon.pl configdiff.pl cross-amd64.sh 
	cross-i586.sh cross-i686.sh cross-ia64.sh cross-iseries.sh 
	cross-ppc.sh cross-ppc64.sh cross-ppc8260.sh cross-ppc8560.sh 
	cross-pseries.sh cross-s390.sh cross-s390x.sh newpatch.sh 
	pull-upstreams.sh rebase-xen-hv.sh rebase-xen-kernel.sh 
	rebase.sh reconfig.sh rediffall.pl 
Log Message:
Major package changes

- Getting spec from non-xen kernel/devel
- Using source+patches from kernel-xen-2.6/devel (2.6.21)
- -debuginfo packages should be enabled, with this package




--- NEW FILE bumpspecfile.py ---
#!/usr/bin/python
#
# FIXME: Remove hardcoded name/email.
#
import re
import sys
import time
import os
import string

class Specfile:
    def __init__(self,filename):
        file=open(filename,"r")
        self.lines=file.readlines()

    def addChangelogEntry(self,entry,email):
        changematch=re.compile(r"^%changelog")
        date=time.strftime("%a %b %d %Y",   time.localtime(time.time()))
        newchangelogentry="%changelog\n* "+date+" "+email+"\n"+entry+"\n\n"
        for i in range(len(self.lines)):
            if(changematch.match(self.lines[i])):
                self.lines[i]=newchangelogentry
                break

    def writeFile(self,filename):
        file=open(filename,"w")
        file.writelines(self.lines)
        file.close()

if __name__=="__main__":
  aspec=(sys.argv[1])
  s=Specfile(aspec)
  entry=(sys.argv[2])
  s.addChangelogEntry(entry,"Dave Jones <davej at redhat.com>")
  s.writeFile(aspec)



--- NEW FILE configcommon.pl ---
#! /usr/bin/perl

my @args=@ARGV;
my @configoptions;
my @configvalues;
my @common;
my $configcounter = 0;

# first, read the 1st file

open (FILE,"$args[0]") || die "Could not open $args[0]";
while (<FILE>) {
	my $str = $_;
	if (/\# ([\w]+) is not set/) {
		$configoptions[$configcounter] = $1;
		$configvalues[$configcounter] = $str;
		$common[$configcounter] = 1;
		$configcounter ++;
	} else {
		if (/([\w]+)=/) {
			$configoptions[$configcounter] = $1;
			$configvalues[$configcounter] = $str;
			$common[$configcounter] = 1;
			$configcounter ++;
		} else {
			$configoptions[$configcounter] = "foobarbar";
			$configvalues[$configcounter] = $str;
			$common[$configcounter] = 1;
			$configcounter ++;
		}
	}
};

# now, read all configfiles and see of the options match the initial one.
# if not, mark it not common
my $cntr=1;


while ($cntr < @ARGV) {
	open (FILE,$args[$cntr]) || die "Could not open $args[$cntr]";	
	while (<FILE>) {
		my $nooutput;
		my $counter;
		my $configname;

		if (/\# ([\w]+) is not set/) {
			$configname = $1;
		} else {
			if (/([\w]+)=/) {
				$configname  = $1;
			} 
		}

		$counter = 0;
		$nooutput = 0;
		while ($counter < $configcounter) {	
			if ("$configname" eq "$configoptions[$counter]") {	
				if ("$_" eq "$configvalues[$counter]") {
					1;
				} else {
					$common[$counter] = 0;
				}
			}
			$counter++;
		}
	}

	$cntr++;
}

# now print the common values
my $counter = 0;

while ($counter < $configcounter) {	
	if ($common[$counter]!=0) {
		print "$configvalues[$counter]";
	}
	$counter++;
}

1;



--- NEW FILE configdiff.pl ---
#! /usr/bin/perl

my @args=@ARGV;
my @configoptions;
my @configvalues;
my @alreadyprinted;
my $configcounter = 0;

# first, read the override file

open (FILE,"$args[0]") || die "Could not open $args[0]";
while (<FILE>) {
	my $str = $_;
	if (/\# ([\w]+) is not set/) {
		$configoptions[$configcounter] = $1;
		$configvalues[$configcounter] = $str;
		$alreadprinted[$configcounter] = 0;
		$configcounter ++;
	} else {
		if (/([\w]+)=/) {
			$configoptions[$configcounter] = $1;
			$configvalues[$configcounter] = $str;
			$alreadprinted[$configcounter] = 0;
			$configcounter ++;
		} else {
			$configoptions[$configcounter] = "$_";
			$configvalues[$configcounter] = $str;
			$alreadprinted[$configcounter] = 0;
			$configcounter ++;
		}
	}
};

# now, read and output the entire configfile, except for the overridden
# parts... for those the new value is printed.
# O(N^2) algorithm so if this is slow I need to look at it later

open (FILE2,"$args[1]") || die "Could not open $args[1]";
while (<FILE2>) {
	my $nooutput;
	my $counter;
	my $configname="$_";
	my $match;

	if (/\# ([\w]+) is not set/) {
		$configname = $1;
	} else {
		if (/([\w]+)=/) {
			$configname  = $1;
		} 
	}

	$counter = 0;
	$nooutput = 0;
	$match = 0;
#	print "C : $configname";
	while ($counter < $configcounter) {	
		if ("$configname" eq "$configoptions[$counter]") {	
			if ( ("$_" eq "$configvalues[$counter]") || ("$configname" eq "") ) {
				$match = 1;
			} else {
				$alreadyprinted[$configcounter] = 1;
				print "$_";
				$match = 1;
			}
		}
		$counter++;
	}
	if ($match == 0) {
		print "$_";
	}

}


1;


--- NEW FILE cross-amd64.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=x86_64-linux- ARCH=x86_64 hammer



--- NEW FILE cross-i586.sh ---
export PATH=$PATH:/opt/cross/bin
make ARCH=i386 i586



--- NEW FILE cross-i686.sh ---
export PATH=$PATH:/opt/cross/bin
make ARCH=i386 i686



--- NEW FILE cross-ia64.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=ia64-linux- ARCH=ia64  ia64


--- NEW FILE cross-iseries.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=ppc64-linux- ARCH=ppc64 ppc64iseries



--- NEW FILE cross-ppc.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=ppc-linux- ARCH=ppc ppc



--- NEW FILE cross-ppc64.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=ppc64-linux- ARCH=ppc64 ppc64



--- NEW FILE cross-ppc8260.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=ppc-linux- ARCH=ppc ppc8260



--- NEW FILE cross-ppc8560.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=ppc-linux- ARCH=ppc ppc8560



--- NEW FILE cross-pseries.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=ppc64-linux- ARCH=ppc64 pseries64



--- NEW FILE cross-s390.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=s390-linux- ARCH=s390  s390


--- NEW FILE cross-s390x.sh ---
export PATH=$PATH:/opt/cross/bin
make CROSS_COMPILE=s390x-linux- ARCH=s390  s390x


--- NEW FILE newpatch.sh ---
#!/bin/sh
# Easy application of new patches.
# Always adds to the very end. (Bumps last patch nr by 100)
# Parameters:
# $1 - patch filename 
# $2 - description

OLD=$(grep ^Patch kernel.spec  | tail -n1 | awk '{ print $1 }' | sed s/Patch// | sed s/://)
NEW=$(($OLD/100*100+100))

sed -i "/^Patch$OLD:\ /a#\ $2\nPatch$NEW:\ $1" kernel.spec

LAST=$(grep ^ApplyPatch kernel.spec | tail -n1 | awk '{ print $2 }')

sed -i "/^ApplyPatch $LAST/aApplyPatch $1" kernel.spec

cvs add $1

scripts/bumpspecfile.py kernel.spec "- $2"
make clog



--- NEW FILE pull-upstreams.sh ---
#!/bin/bash

wget http://people.redhat.com/roland/utrace/2.6-current/series
for i in `grep patch$ series`
do
  rm -f linux-2.6-$i
  wget http://people.redhat.com/roland/utrace/2.6-current/$i
  mv $i linux-2.6-$i
done
rm -f series



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

# it only rebases de hypervisor now

set -x

pushd xen || exit 1
make clean
popd

CSET=`hg tip | grep "changeset:" | cut -f2 -d':' | sed 's/ //g'`
tar cvf xen-$CSET.tar xen || exit 1
rm -f xen-$CSET.tar.bz2
bzip2 -v9 xen-$CSET.tar || exit 1

set +x

ls -l xen-$CSET.tar.bz2


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

# you are supposed to have both linux-2.6 "upstream tree"
# and linux-2.6-xen-fedora mercurial updated against that tree

# it needs linux-2.6 linux-2.6-xen and linux-2.6-xen-fedora on the current directory
# with the right changesets on them.

set -x

# remove previous patch if it exist
rm -f linux-2.6-xen.patch

for repo in linux-2.6 linux-2.6-xen-fedora xen-3.0.3-testing linux-2.6-xen-3.0.3 ; do
    if [ ! -d $repo/ ]; then
	echo "$repo directory don't exist";
	exit 1
    else
	echo "  * $repo `cd $repo; (hg tip | grep 'changeset:')`" >> linux-2.6-xen.patch
    fi
done

/usr/bin/diff -urNp --exclude=".hg*" --exclude="*.orig" --exclude="*~" \
    /scratch/src/linux-2.6.18/  linux-2.6-xen-fedora/ >> linux-2.6-xen.patch


set +x

ls -lh linux-2.6-xen.patch


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

# Current kernel bits
if [ `grep -c ^patch upstream` -ge 1 ]; then
  export OLD=`grep ^patch upstream | tail -n1 | sed s/patch-// | sed s/\.bz2//`
else
  export OLD=`grep linux-2.6 upstream | tail -n1 | sed s/linux-// | sed s/\.tar\.bz2//`
fi
export OLDBASE=`echo $OLD | sed s/-/\ /g | sed s/2\.6\.// | awk '{ print $1 }'`
if [ `echo $OLD | grep -c rc` -ge 1 ]; then
  export OLDRC=`echo $OLD | sed s/-/\ /g | sed s/rc// | awk '{ print $2 }'`
  if [ `echo $OLD | grep -c git` -ge 1 ]; then
    export OLDGIT=`echo $OLD | sed s/-/\ /g | sed s/git// | awk '{ print $3 }'`
  else
    export OLDGIT=0
  fi
else
  export OLDRC=0
  if [ `echo $OLD | grep -c git` -ge 1 ]; then
    export OLDGIT=`echo $OLD | sed s/-/\ /g | sed s/git// | awk '{ print $2 }'`
  else
    export OLDGIT=0
  fi
fi

# Is there a new snapshot or prepatch ?
NEW=`lynx -dump http://www.kernel.org/kdist/finger_banner | grep "snapshot for the stable"`
if [ -z "$NEW" ] ; then
  NEW=`lynx -dump http://www.kernel.org/kdist/finger_banner | grep "prepatch for the stable"`
  if [ -z "$NEW" ] ; then
    if [ "$OLDRC" -ne 0 ] ; then
      NEW=`lynx -dump http://www.kernel.org/kdist/finger_banner | grep "stable version of the Linux kernel is"`
    else
      echo "No new rc or git snapshot of stable branch".
      exit
    fi
  fi
fi
export N=`echo $NEW | awk '{ print $11 }'`
if [ -z "$N" ]; then
  # "Stable version"
  export NEW=`echo $NEW | awk '{ print $10 }'`
else
  export NEW=`echo $NEW | awk '{ print $11 }'`
fi

export NEWBASE=`echo $NEW | sed s/-/\ /g | sed s/2\.6\.// | awk '{ print $1 }'`
if [ `echo $NEW | grep -c rc` -ge 1 ]; then
  export NEWRC=`echo $NEW | sed s/-/\ /g | sed s/rc// | awk '{ print $2 }'`
  if [ `echo $NEW | grep -c git` -ge 1 ]; then
    export NEWGIT=`echo $NEW | sed s/-/\ /g | sed s/git// | awk '{ print $3 }'`
  else
    export NEWGIT=0
  fi
else
  export NEWRC=0
  if [ `echo $NEW | grep -c git` -ge 1 ]; then
    export NEWGIT=`echo $NEW | sed s/-/\ /g | sed s/git// | awk '{ print $2 }'`
  else
    export NEWGIT=0
  fi
fi

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

if [ "$OLDRC" -eq 0 -a "$OLDGIT" -eq 0 -a "$OLDGIT" -ne "$NEWGIT" ]; then
  echo "Rebasing from a stable release to a new git snapshot"
  perl -p -i -e 's/^%define\ released_kernel\ 1/\%define\ released_kernel\ 0/' kernel.spec
  # force these to zero in this case, they may not have been when we rebased to stable
  perl -p -i -e 's/^%define\ rcrev.*/\%define\ rcrev\ 0/' kernel.spec
  perl -p -i -e 's/^%define\ gitrev.*/\%define\ gitrev\ 0/' kernel.spec
fi

if [ "$NEWRC" -eq 0 -a "$NEWGIT" -eq 0 ]; then
  echo "Rebasing from -rc to final release."
  perl -p -i -e 's/^%define\ released_kernel\ 0/\%define\ released_kernel\ 1/' kernel.spec
  export TARBALL_BASE=$(($OLDBASE-1))
  perl -p -i -e 's/^%define\ base_sublevel\ $ENV{TARBALL_BASE}/%define\ base_sublevel\ $ENV{NEWBASE}/' kernel.spec
  perl -p -i -e 's/^%define\ rcrev.*/\%define\ rcrev\ 0/' kernel.spec
  perl -p -i -e 's/^%define\ gitrev.*/\%define\ gitrev\ 0/' kernel.spec

  grep -v kernel-2.6.$TARBALL_BASE .cvsignore >.cvsignore.tmp ; mv .cvsignore.tmp .cvsignore
  echo kernel-2.6.$NEWBASE >> .cvsignore

  for i in upstream sources .cvsignore
  do
   grep -v linux-2.6.$(($OLDBASE-1)).tar.bz2 $i > .$i.tmp; mv .$i.tmp $i
   grep -v patch-2.6.$OLDBASE-rc$OLDRC.bz2 $i > .$i.tmp; mv .$i.tmp $i
   grep -v patch-2.6.$OLDBASE-rc$OLDRC-git$OLDGIT.bz2 $i > .$i.tmp; mv .$i.tmp $i
  done

  echo linux-2.6.$TARBALL_BASE.tar.bz2 >> upstream

  rm -f linux-2.6.$(($OLDBASE-1)).tar.bz2
  rm -f linux-2.6.$(($OLDBASE-1)).tar.bz2.sign
  rm -f patch-2.6.$OLDBASE-rc$OLDRC.bz2
  rm -f patch-2.6.$OLDBASE-rc$OLDRC.bz2.sign
  rm -f patch-2.6.$OLDBASE-rc$OLDRC-git$OLDGIT.bz2
  rm -f patch-2.6.$OLDBASE-rc$OLDRC-git$OLDGIT.bz2.sign

  cvs remove linux-2.6.$(($OLDBASE-1)).tar.bz2.sign
  cvs remove patch-2.6.$OLDBASE-rc$OLDRC.bz2.sign
  cvs remove patch-2.6.$OLDBASE-rc$OLDRC-git$OLDGIT.bz2.sign

  make download
  make upload FILES=linux-$NEW.tar.bz2

  cvs add linux-$NEW.tar.bz2.sign

  bumpspecfile.py kernel.spec "- $NEW"
  make clog
  echo FIXME! Fix up fedora_cvs_origin
  make verrel
  exit
fi

if [ "$OLDRC" != "$NEWRC" ]; then
  echo "Different rc. Rebasing from $OLDRC to $NEWRC"
  perl -p -i -e 's/^%define\ rcrev.*/\%define\ rcrev\ $ENV{"NEWRC"}/' kernel.spec
  perl -p -i -e 's/$ENV{OLDBASE}-rc$ENV{OLDRC}.bz2/$ENV{NEWBASE}-rc$ENV{NEWRC}.bz2/' .cvsignore
  perl -p -i -e 's/$ENV{OLDBASE}-rc$ENV{OLDRC}.bz2/$ENV{NEWBASE}-rc$ENV{NEWRC}.bz2/' upstream
  grep -v patch-2.6.$OLDBASE-rc$OLDRC.bz2 sources > .sources.tmp; mv .sources.tmp sources
  if [ `grep -c patch-2.6.$NEWBASE-rc$NEWRC.bz2 upstream` -eq 0 ]; then
    echo patch-2.6.$NEWBASE-rc$NEWRC.bz2 >> .cvsignore
    echo patch-2.6.$NEWBASE-rc$NEWRC.bz2 >> upstream
  fi
  rm -f patch-2.6.$OLDBASE-rc$OLDRC.bz2
  cvs remove patch-2.6.$OLDBASE-rc$OLDRC.bz2.sign
fi

if [ "$OLDGIT" != "$NEWGIT" ]; then
  if [ "$OLDRC" -eq 0 -a "$OLDGIT" -eq 0 ]; then
    echo "Rebasing to pre-rc git$NEWGIT"
  else
    echo "Different git. Rebasing from git$OLDGIT to git$NEWGIT"
  fi
  perl -p -i -e 's/^%define\ gitrev.*/\%define\ gitrev\ $ENV{"NEWGIT"}/' kernel.spec
  if [ "$OLDGIT" -ne 0 ]; then
    if [ "$NEWGIT" -ne 0 ]; then
      perl -p -i -e 's/$ENV{OLD}/$ENV{NEW}/' .cvsignore
      perl -p -i -e 's/$ENV{OLD}/$ENV{NEW}/' upstream
    fi
    grep -v patch-$OLD.bz2 sources > .sources.tmp; mv .sources.tmp sources
    grep -v patch-$OLD.bz2 upstream > .upstream.tmp; mv .upstream.tmp upstream
  else
    echo patch-$NEW.bz2 >> .cvsignore
    echo patch-$NEW.bz2 >> upstream
  fi

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

  cvs add patch-$NEW.bz2.sign
  if [ "$OLDGIT" -ne 0 ]; then
    rm -f patch-$OLD.bz2
    rm -f patch-$OLD.bz2.sign
  fi
  cvs remove patch-$OLD.bz2.sign
fi

if [ "$OLDRC" != "$NEWRC" -o "$OLDGIT" != "$NEWGIT" ]; then
  bumpspecfile.py kernel.spec "- $NEW"
  make clog
fi



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

base_sublevel=$(grep "^%define base_sublevel" kernel.spec | head -n1 | awk '{ print $3 }')

if [ `grep -c "^%define released_kernel 1" kernel.spec` -ge 1 ]; then
  V=$base_sublevel
else
  let V=$base_sublevel+1
fi

cd kernel-2.6.$base_sublevel/linux-2.6.$base_sublevel.noarch/
rm -f kernel-*.config
cp ../../kernel-2.6.$V-*.config .

for i in kernel-*.config
do
	echo $i
	rm -f .config
	cp $i .config
	Arch=`head -1 .config | cut -b 3-`
	make ARCH=$Arch nonint_oldconfig > /dev/null || exit 1
	echo "# $Arch" > configs/$i
	cat .config >> configs/$i
	echo
done



--- NEW FILE rediffall.pl ---
#!/usr/bin/perl -w
#
# Script to rediff all patches in the spec
# Usage: perl -w rediffall.pl < kernel-2.4.spec
#
# $workdir is where the new rediff'ed patches are created
# $origdir is where the original patches and tarball are located
#
# Note that both $workdir and $origdir must be absolute path names.
# Suggestion: create a /kernel symbolic link to the top of your CVS tree.

my $workdir = "/dev/shm/redifftree";
my $origdir = "/home/davej/devel";
my $kernver = "linux-2.6.17";
my $datestrip = "s/^\\(\\(+++\\|---\\) [^[:blank:]]\\+\\)[[:blank:]].*/\\1/";
my $patchindex = 0;
my @patchlist;

# phase 1: create a tree
print "Extracting pristine source..\n";
system("mkdir -p $workdir");
system("rm -rf $workdir/*");
chdir("$workdir");
system("tar -jxvf $origdir/$kernver.tar.bz2 > /dev/null");
system("cp -al $kernver linux-$patchindex");

# phase 2: read the spec from stdin and store all patches
print "Reading specfile..\n";

while (<>) {
	my $line = $_;
	if ($line =~ /^Patch([0-9]+)\: ([a-zA-Z0-9\-\_\.\+]+\.patch)/) {
		$patchlist[$1] = $2;
	} else {
		if ($line =~ /^Patch([0-9]+)\: ([a-zA-Z0-9\-\_\.]+\.bz2)/) {
			$patchlist[$1] = $2;
		}
	}

	if ($line =~ /^%patch([0-9]+) -p1/) {
		# copy the tree, apply the patch, diff and remove the old tree
		my $oldindex = $patchindex;
		$patchindex = $1;

		print "rediffing patch number $patchindex: $patchlist[$patchindex]\n";

		system("cp -al linux-$oldindex linux-$patchindex");
		chdir("linux-$patchindex");
		if ($patchlist[$patchindex] =~ /bz2/) {
			system("bzcat $origdir/$patchlist[$patchindex] | patch -p1 &>/dev/null");
		} else {
			system("cat $origdir/$patchlist[$patchindex] | patch -p1 &>/dev/null");
		}
		chdir("$workdir");
		system("rm -f `find -name \"*orig\"`");
		if ($patchlist[$patchindex] =~ /bz2/) {
		} else {
			system("diff -urNp --exclude-from=/home/davej/.exclude linux-$oldindex linux-$patchindex | sed '$datestrip' > $patchlist[$patchindex]");
		}
		system("rm -rf linux-$oldindex");
	}
};

1;




More information about the fedora-extras-commits mailing list