diff options
Diffstat (limited to 'freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts')
23 files changed, 1205 insertions, 0 deletions
diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/add-changelog.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/add-changelog.sh new file mode 100755 index 000000000..fa0157afb --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/add-changelog.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Emulate the changelog part of rpmdev-bumpspec without the bumping of the +# rev. Because Laura keeps typoing her name and the date. + +CURDATE=`date +"%a %b %d %Y"` +PACKAGER=`rpmdev-packager` +CHANGELOG="%changelog\n* $CURDATE $PACKAGER\n- $1\n" + +awk -v CHANGE="$CHANGELOG" '/%changelog/ {print CHANGE} \ + !/%changelog/ { print $0 }' \ + < kernel.spec > kernel.spec.tmp +mv kernel.spec.tmp kernel.spec diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/allarchconfig.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/allarchconfig.sh new file mode 100755 index 000000000..f80c23197 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/allarchconfig.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Run from within a source tree. + +for i in configs/kernel-*.config +do + cp -f $i .config + Arch=`head -1 .config | cut -b 3-` + echo $Arch \($i\) + make ARCH=$Arch listnewconfig | grep -E '^CONFIG_' >.newoptions || true; + if [ -s .newoptions ]; then + cat .newoptions; + exit 1; + fi; + rm -f .newoptions; +done + diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/bumpspecfile.py b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/bumpspecfile.py new file mode 100755 index 000000000..bc02ab300 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/bumpspecfile.py @@ -0,0 +1,76 @@ +#!/usr/bin/python +# +# Uses git config options user.name and user.email, falls +# back to env vars $GIT_COMMITTER_NAME and $GIT_COMMITTER_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() + self.vr="" + + def getNextVR(self,aspec): + # Get VR for changelog entry. + (ver,rel) = os.popen("LC_ALL=C rpm --specfile -q --qf '%%{version} %%{release}\n' --define 'dist %%{nil}' %s | head -1" % aspec).read().strip().split(' ') + pos = 0 + # general released kernel case, bump 1st field + fedora_build = rel.split('.')[pos] + if fedora_build == "0": + # this is a devel kernel, bump 2nd field + pos = 1 + elif rel.split('.')[-1] != fedora_build: + # this is a branch, must bump 3rd field + pos = 2 + fedora_build = rel.split('.')[pos] + if pos == 1 and len(rel.split('.')) > 4: + # uh... what? devel kernel in a branch? private build? just do no VR in clog... + print "Warning: not adding any VR to changelog, couldn't tell for sure which field to bump" + pos = -1 + next_fedora_build = int(fedora_build) + 1 + if pos == 0: + nextrel = str(next_fedora_build) + elif pos == 1: + nextrel = "0." + str(next_fedora_build) + elif pos == 2: + nextrel = rel.split('.')[0] + "." + rel.split('.')[1] + "." + str(next_fedora_build) + if pos >= 0: + for s in rel.split('.')[pos + 1:]: + nextrel = nextrel + "." + s + self.vr = " "+ver+'-'+nextrel + + def addChangelogEntry(self,entry): + user = os.popen("git config --get user.name").read().rstrip() + if (user == ""): + user = os.environ.get("GIT_COMMITTER_NAME","Unknown") + email = os.popen("git config --get user.email").read().rstrip() + if (email == ""): + email = os.environ.get("GIT_COMMITTER_EMAIL","unknown") + if (email == "unknown"): + email = os.environ.get("USER","unknown")+"@fedoraproject.org" + changematch=re.compile(r"^%changelog") + date=time.strftime("%a %b %d %Y", time.localtime(time.time())) + newchangelogentry="%changelog\n* "+date+" "+user+" <"+email+">"+self.vr+"\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.getNextVR(aspec) + s.addChangelogEntry(entry) + s.writeFile(aspec) + diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-TODO.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-TODO.sh new file mode 100755 index 000000000..7067f0b44 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-TODO.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +for i in `grep ^* TODO | awk '{ print $2 }'` +do + if [ ! -f $i ]; then + echo "$i referenced in the TODO, but isn't in CVS!" + fi; +done + +# sometimes dead stuff lingers in cvs, even though it's not in the specfile. +for i in *.patch +do + for j in $(grep $i kernel.spec | grep Apply.*Patch | awk '{ print $2 }' | wc -l) + do + if [ "$j" = "0" ]; then + echo $i is in CVS, but not applied in spec file. + grep $i TODO | awk '{ print $2 " is also still in the TODO" }' + fi + done +done + +#for i in `grep ApplyPatch kernel.spec | awk '{ print $2 }'` +#do +# R=$(grep $i TODO) +# echo "$i is in CVS, but not mentioned in the TODO!" +#done + diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-configs.pl b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-configs.pl new file mode 100644 index 000000000..10282aa74 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-configs.pl @@ -0,0 +1,83 @@ +# By Paul Bolle October 2014. +# +# Contributed to the public domain by its author. + +use 5.016; +use warnings; +use autodie; + +use File::Find; + +my @Kconfigs; + +my $Kconfigre = qr/Kconfig.*/; +my $configre = qr/^\s*(menu)?config\s+(?<config>(\w+))$/; +my $CONFIG_re = qr/\bCONFIG_(?<CONFIG_>(\w+))/; + +sub match { + push( @Kconfigs, $File::Find::name ) if ($_ =~ $Kconfigre); +} + +sub parse_kconfig { + my ($path) = @_; + + my @ret; + + open( my $kconfig, "<", $path ); + my $slurp = do { local $/ = undef; <$kconfig> }; + close( $kconfig ); + my @lines = split ( /\n/, $slurp ); + foreach my $line (@lines) { + if ($line =~ /$configre/) { + push( @ret, $+{config} ); + } + } + + @ret; +} + +sub parse_shipped { + my ($path) = @_; + + my @ret; + + open( my $shipped, "<", $path ); + my $slurp = do { local $/ = undef; <$shipped> }; + close( $shipped ); + my @lines = split ( /\n/, $slurp ); + my $i = 1; + foreach my $line (@lines) { + if ($line =~ /$CONFIG_re/) { + push( @ret, [$i, $+{CONFIG_}] ); + } + $i++; + } + + @ret; +} + +exit main ( @ARGV ); + +sub main { + my %configs; + + find( \&match, @_ ); + + foreach my $Kconfig (@Kconfigs) { + my (@tmp) = parse_kconfig( $Kconfig ); + foreach my $config ( @tmp ) { + $configs{ $config }++; + } + } + + foreach my $shipped (glob("config-*")) { + my (@tmp) = parse_shipped( $shipped ); + foreach my $ref ( @tmp ) { + say( STDERR "$shipped:$ref->[0]: No Kconfig symbol matches 'CONFIG_$ref->[1]'" ) + unless (grep( /$ref->[1]/, keys( %configs ))); + } + } + + 0; +} + diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-patchlist.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-patchlist.sh new file mode 100755 index 000000000..134e41e97 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/check-patchlist.sh @@ -0,0 +1,113 @@ +#! /bin/sh +# This script was created in a effort to make patch management a bit easier. +# It list all the patches in the current tree and identifies if they are +# present in the kernel.spec, PatchList.txt, both files or neither. +# +# eg. ./check-patchlist.sh [optional flag] + +function usage(){ + echo "List all the patches currently in the tree. It also helps identify" + echo "if the patch is present in kernel.spec or PatchList.txt. " + echo "-h, --help " + echo "-t, --tracked patches in both kernel.spec and PatchList.txt " + echo "-p, --patchlist patches added to PatchList.txt. " + echo "-s, --specfile patches added to kernel.spec. " + echo "-n, --not-tracked patches in the tree but not in PatchList.txt " + echo " or kernel.spec " +} + +BASEDIR=$(dirname "$( cd $(dirname $BASH_SOURCE[0]) && pwd)") +pushd $BASEDIR > /dev/null + +function list_all(){ + echo "===========Legend===========================" + echo ". In kernel.spec " + echo "* In PatchList.txt " + echo "+ In PatchList.txt & Kernel.spec " + echo "- Neither in PatchList.txt nor kernel.spec" + echo "============================================" + for patch in $(ls *.patch); do + if [ ! -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ] + then + echo "+ ${patch}" # Patches in kernel.spec and PatchList.txt + + elif [ ! -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ] + then + echo "* ${patch}" # Patches in PatchList.txt but not in kernel.spec + + elif [ -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ] + then + echo ". ${patch}" # Patches in kernel.spec but not in PatchList.txt + + else + echo "- ${patch}" # Neither in PatchList.txt nor kernel.spec + + fi + done +} + +function list_present_not_added(){ + for patch in $(ls *.patch); do + if [ -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ] + then + echo $patch + fi + done +} + +function list_present_added(){ + for patch in $(ls *.patch); do + if [ ! -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ] + then + echo $patch + fi + done +} + +function list_patchList(){ + for patch in $(ls *.patch); do + if [ ! -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ] + then + echo $patch + fi + done + +} +function list_specfile(){ + for patch in $(ls *.patch); do + if [ -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ] + then + echo $patch + fi + done +} + +if [ -z "$@" ]; then + list_all +else + + for opt in "$@"; do + case $opt in + -t|--tracked) + list_present_added + ;; + -s|--specfile) + list_specfile + ;; + -h|--help) + usage + ;; + -n|--not-added) + list_present_not_added + ;; + -p|--patchlist) + list_patchList + ;; + *) + usage + ;; + esac + done +fi + +popd > /dev/null diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/combine.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/combine.sh new file mode 100755 index 000000000..86a68d302 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/combine.sh @@ -0,0 +1,34 @@ +#! /bin/sh + +# combine a set of quilt patches + +# $1 : base dir (source tree) +# $2 : quilt dir (patches to apply) +# $3 : pre-patch to apply first (optional) + +# e.g.: +# combine.sh /home/user/fedora/trunk/kernel/F-11/kernel-2.6.30/vanilla-2.6.30 \ +# /home/user/git/stable-queue/queue-2.6.30 \ +# /home/user/fedora/trunk/kernel/F-11/patch-2.6.30.5.bz2 + +if [ $# -lt 2 ] ; then + exit 1 +fi + +TD="combine_temp.d" + +cd $1 || exit 1 +cd .. +[ -d $TD ] && rm -Rf $TD +mkdir $TD || exit 1 +cd $TD + +cp -al ../$(basename $1) work.d +cd work.d +[ "$3" ] && bzcat $3 | patch -p1 -s +ln -s $2 patches +[ -h patches ] || exit 1 +quilt snapshot +quilt upgrade +quilt push -a -q +quilt diff --snapshot >../combined.patch diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/configcommon.pl b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/configcommon.pl new file mode 100644 index 000000000..38bbe80dc --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/configcommon.pl @@ -0,0 +1,82 @@ +#! /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; + diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/configdiff.pl b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/configdiff.pl new file mode 100644 index 000000000..848d8df0f --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/configdiff.pl @@ -0,0 +1,76 @@ +#! /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; diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/cross-aarch64 b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/cross-aarch64 new file mode 100755 index 000000000..dc0645e49 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/cross-aarch64 @@ -0,0 +1,3 @@ +#!/bin/sh + +rpmbuild --target aarch64 --with cross --without debuginfo --without perf --without tools --define "__strip /usr/bin/aarch64-linux-gnu-strip" --rebuild $1 diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/cross-arm b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/cross-arm new file mode 100755 index 000000000..0aae07741 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/cross-arm @@ -0,0 +1,3 @@ +#!/bin/sh + +rpmbuild --target armv7hl --with cross --without debuginfo --without perf --without tools --define "__strip /usr/bin/arm-linux-gnu-strip" --rebuild $1 diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/fast-build.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/fast-build.sh new file mode 100755 index 000000000..8286a110f --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/fast-build.sh @@ -0,0 +1,13 @@ +#! /bin/sh +# Description: +# rpmbuild combo to build the given architecture without +# debugging information, perf or tools. +# +# Sample usage: +# ./fast-build.sh x86_64 kernel-4.7.0-0.rc1.git1.2.fc25.src.rpm + +if [ -z "$1" ] || [ -z "$2" ]; then + echo "usage: $0 [ arch ] [ kernel-x.x.x.fcxx.src.rpm ] " +fi + +rpmbuild --target $1 --without debug --without debuginfo --without perf --without tools --rebuild $2 diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/fixup-bumpspec.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/fixup-bumpspec.sh new file mode 100755 index 000000000..1a38de222 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/fixup-bumpspec.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# rpmdev-bumpspec 'helpfully' bumps the release which we don't always want. +# This script fixes it up. + +RELEASE=`grep "%global baserelease" kernel.spec | cut -d ' ' -f 3` +export RELEASE=$(($RELEASE-1)) +perl -p -i -e 's|%global baserelease.*|%global baserelease $ENV{'RELEASE'}|' kernel.spec +TODAY=`date +"%a %b %d %Y"` +awk -v DATE="$TODAY" 'START { marked = 0; } $0 ~ DATE { if (marked == 1) { print $0 } else {out=$1; for(i = 2; i <= NF - 2; i++) { out=out" "$i } print out; marked = 1; } } $0 !~ DATE { print $0; }' < kernel.spec > kernel.spec.tmp +mv kernel.spec.tmp kernel.spec diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/generate-git-snapshot.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/generate-git-snapshot.sh new file mode 100755 index 000000000..242200ef6 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/generate-git-snapshot.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# This script allows for the generation of a git snapshot between the upstream +# git tree and the current tree. +# +# Prerequisites: +# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc +# or wherever. + +# Look to see if LINUX_GIT is set in local .bashrc +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi + +if [ ! -d "$LINUX_GIT" ]; then + echo "error: set \$LINUX_GIT to point at upstream git tree" + exit 1 +fi + +VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz// | sed s/[\(\)]//g) + +if [ -z "$VER" ] ; +then + VER=$(grep linux sources | head -1 | awk '{ print $2 }' | sed s/linux-// | sed s/.tar.xz// | sed s/[\(\)]//g) +fi + +OLDGIT=$(grep gitrev kernel.spec | head -n1 | sed s/%define\ gitrev\ //) +export NEWGIT=$(($OLDGIT+1)) + +pushd $LINUX_GIT + +git diff v$VER.. > /tmp/patch-$VER-git$NEWGIT +xz -9 /tmp/patch-$VER-git$NEWGIT +DESC=$(git describe) +git rev-list --max-count=1 HEAD > /tmp/gitrev +popd + +mv /tmp/patch-$VER-git$NEWGIT.xz . +mv /tmp/gitrev . + +perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec + +perl -p -i -e 's|%define gitrev.*|%define gitrev $ENV{'NEWGIT'}|' kernel.spec + +rpmdev-bumpspec -c "Linux $DESC" kernel.spec diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/generate-perf-man.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/generate-perf-man.sh new file mode 100755 index 000000000..f5332ad86 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/generate-perf-man.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Small script to generate the perf-man tarball. The script relies on having +# LINUX_GIT set in your local .bashrc. By default the script will use the +# the kernel version of the upstream tree set in LINUX_GIT. Use --version=x.y +# to set a specific version. + +# [Default] eg. ./scritps/generate-perf-man +# eg. ./scripts/generate-perf-man --version=4.8 +function usage(){ + echo + echo "Helps generate the perf-man tarball " + echo "-h, --help " + echo + echo "./generate-perf-man.sh #Generates using upstream kernel version" + echo + echo "./generate-perf-man.sh --version=x.y #Generate using x.y version" +} + +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi + +if [ ! -d "$LINUX_GIT" ]; then + echo "Error: \$LINUX_GIT is not set to the upstream git tree." + exit 1 +fi + +BASEDIR=$(dirname "$(cd $(dirname $BASH_SOURCE[0]) && pwd)") +pushd "$LINUX_GIT" > /dev/null +KERNEL_VERSION=$( awk '/^VERSION =/ {print $3}' Makefile ) +KERNEL_PATCHLEVEL=$( awk '/^PATCHLEVEL =/ {print $3}' Makefile ) + +if [ ! -z "$@" ]; then + for opt in "$@"; do + case $opt in + --version=*.*) + version="${opt#*=}" + KERNEL_VERSION=$( awk -F. '{print $1}' <<< $version ) + KERNEL_PATCHLEVEL=$( awk -F. '{print $2}' <<< $version ) + ;; + -h | --help) + usage + exit 0 + ;; + *) + ;; + esac + done +fi +cd tools/kvm/kvm_stat/ +make man +mv kvm_stat.1 ../../perf/Documentation +cd ../../perf/Documentation/ +make +tar -czvf $BASEDIR/perf-man-${KERNEL_VERSION}.${KERNEL_PATCHLEVEL}.tar.gz *.1 +make clean +rm kvm_stat.1 +popd diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/grab-logs.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/grab-logs.sh new file mode 100755 index 000000000..571b503bb --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/grab-logs.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Script helps download the build logs for the current tree. +# The downloaded logs will be saved in a logs/ within the +# tree. + +BASEDIR="$(dirname "$(cd $(dirname $BASH_SOURCE[0]) && pwd)")" +pushd $BASEDIR > /dev/null + +VER=$(fedpkg verrel) +ver=$(echo $VER | sed -e 's/-/ /g' | awk '{print $2}') +rev=$(echo $VER | sed -e 's/-/ /g' | awk '{print $3}') + +# keep logs in one place. If logs directory does not exist, make it. +if [ -d "$BASEDIR/logs" ]; then + DIR="$BASEDIR/logs" +else + mkdir "$BASEDIR/logs" + DIR="$BASEDIR/logs" +fi + +# Common architectures that have build logs. +ARCHS[0]=i686 +ARCHS[1]=x86_64 +ARCHS[2]=noarch +ARCHS[3]=armv7hl + +for arch in ${ARCHS[@]}; do + URL=http://kojipkgs.fedoraproject.org/packages/kernel/$ver/$rev/data/logs/$arch/build.log + # Only download logs if exist + wget --spider -q $URL + if [ $? -eq 0 ]; then + wget -O $DIR/build-$VER-$arch.log $URL + fi +done +popd > /dev/null diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/kernel-version.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/kernel-version.sh new file mode 100644 index 000000000..e2ec93a5a --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/kernel-version.sh @@ -0,0 +1,8 @@ +VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz// | tr -d "()") + +if [ -z "$VER" ] ; +then + VER=$(grep linux sources | head -1 | awk '{ print $2 }' | sed s/linux-// | sed s/.tar.xz// | tr -d "()") +fi + + diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/newpatch.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/newpatch.sh new file mode 100755 index 000000000..2d7498655 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/newpatch.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# Facilitates the addition of a new patch to the source tree. +# -- Moves patch to tree +# -- Adds patch to kernel.spec list of patches +# -- Adds patch to git +# -- change buildid macro to the name of the patch being added + +# Base directory is relative to where the script is. +BASEDIR="$(dirname "$(cd $(dirname $BASH_SOURCE[0]) && pwd)")" +pushd $BASEDIR > /dev/null +# Check for at least patch +if [ "$#" -lt 1 ]; then + echo "usage: $0 [ /path/to/patch/ ] [ description ]" + exit 1 +fi +PATCHDIR=$1 +DESC=$2 +PATCH="$(basename "$PATCHDIR")" +# Kernel.spec file in the current tree +SPECFILE="$BASEDIR/kernel.spec" +# If adding patch from outside the source tree move it to the source tree +if [ -z "$(ls | grep $PATCH)" ]; then + cp $PATCHDIR $BASEDIR/ +fi + +if [ ! -z "$(grep $PATCH $SPECFILE)" ] +then + echo "$PATCH already in kernel.spec" + exit 1 +fi +# ID number of the last patch in kernel.spec +LPATCH_ID=$(grep ^Patch $SPECFILE | tail -n1 | awk '{ print $1 }' | sed s/Patch// | sed s/://) +# ID of the next patch to be added to kernel.spec +NPATCH_ID=$(($LPATCH_ID + 1 )) +# Add patch with new id at the end of the list of patches +sed -i "/^Patch$LPATCH_ID:\ /a#\ $DESC\nPatch$NPATCH_ID:\ $PATCH" $SPECFILE +# Add it to git +git add $PATCH +BUILDID_PATCH="$(echo $PATCH | sed 's/\-/\_/g' )" +sed -i "s/^.*define buildid .*$/%define buildid .$BUILDID_PATCH/" $SPECFILE +popd > /dev/null diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rawhide-rc.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rawhide-rc.sh new file mode 100755 index 000000000..40f32a8fe --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rawhide-rc.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# Generate a commit for a rawhide RC release + +source scripts/kernel-version.sh + +klist -s +if [ ! $? -eq 0 ]; then + echo "klist couldn't read the credential cache." + echo "Do you need to fix your kerberos tokens?" + exit 1 +fi + +make release +# fixup the release because rpmdev-bumpspec *sigh* +scripts/fixup-bumpspec.sh +fedpkg commit -c + +# Figure out what is our RC +RC=`grep "%global rcrev" kernel.spec| cut -d ' ' -f 3` +RC=$(($RC+1)) +BASE=`grep "%define base_sublevel" kernel.spec| cut -d ' ' -f 3` +OLDBASE=$BASE +# See comment in kernel.spec about the base numbering +BASE=$(($BASE+1)) + +# Kill all patches +awk '!/patch/ { print $0 }' < sources > sources.tmp +mv sources.tmp sources + +# Grab the tarball +if [ ! -f patch-4.$BASE-rc$RC.xz ]; then + wget -O patch-4.$BASE-rc$RC https://git.kernel.org/torvalds/p/v4.$BASE-rc$RC/v4.$OLDBASE + if [ ! $? -eq 0 ]; then + exit 1 + fi + xz -9 patch-4.$BASE-rc$RC + fedpkg upload patch-4.$BASE-rc$RC.xz +fi + +# bump rcrev in the spec and set git snapshot to 0 +RC=$RC perl -p -i -e 's|%global rcrev.*|%global rcrev $ENV{'RC'}|' kernel.spec + +perl -p -i -e 's|%define gitrev.*|%define gitrev 0|' kernel.spec + +perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec + +rpmdev-bumpspec -c "Linux v4.$BASE-rc$RC" kernel.spec diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rawhide-snapshot.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rawhide-snapshot.sh new file mode 100755 index 000000000..210216b98 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rawhide-snapshot.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# A coffeeproof rawhide script. You should be able to run this before the +# coffee has kicked in and generate a good rawhide commit. +# +# - Updates the local Fedora tree to master and verifies that you are working +# off of the correct master +# - Updates the upstream tree to the latest master. +# - Generates a git snapshot via generate-git-snapshot.sh +# - Clears out old git snapshots from the sources +# - Uploads the new snapshot + +source scripts/kernel-version.sh + +klist -s +if [ ! $? -eq 0 ]; then + echo "klist couldn't read the credential cache." + echo "Do you need to fix your kerberos tokens?" + exit 1 +fi + +git fetch origin +if [ "$(git rev-parse origin/master)" != "$(git rev-parse HEAD)" ]; then + echo "I just did a git fetch and this branch does not match master" + echo "Re-check out this branch to work off of the latest master" + exit 1 +fi + +if [ ! -d "$LINUX_GIT" ]; then + echo "error: set \$LINUX_GIT to point at an upstream git tree" + exit 1 +fi + +git -C $LINUX_GIT pull +if [ ! $? -eq 0 ]; then + echo "Git pull failed. Is your tree clean/correct?" + exit 1 +fi + +git -C $LINUX_GIT describe --tags HEAD | grep -q "\-g" +if [ ! $? -eq 0 ]; then + echo "Trying to snapshot off of a tagged git." + echo "I don't think this is what you want" + exit 1 +fi + +if [ "$(git -C $LINUX_GIT rev-parse origin/master)" == `cat gitrev` ]; then + echo "Last snapshot commit matches current master. Nothing to do" + echo "\o/" + exit 0 +fi + +GIT=`grep "%define gitrev" kernel.spec | cut -d ' ' -f 3` +if [ "$GIT" -eq 0 ]; then + make debug + ./scripts/fixup-bumpspec.sh + fedpkg commit -c +fi + +./scripts/generate-git-snapshot.sh + +#Nuke the old patch from the source +awk '!/git/ { print $0 }' < sources > sources.tmp +mv sources.tmp sources + +GIT=`grep "%define gitrev" kernel.spec | cut -d ' ' -f 3` +fedpkg upload patch-$VER-git$GIT.xz diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rediffall.pl b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rediffall.pl new file mode 100644 index 000000000..29f12beb9 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/rediffall.pl @@ -0,0 +1,64 @@ +#!/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; diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/sort-config b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/sort-config new file mode 100755 index 000000000..399709f18 --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/sort-config @@ -0,0 +1,226 @@ +#!/bin/bash + +FC=($(fedpkg verrel | awk -F. '{print $NF}')) + +SRC=($(ls config-* 2>/dev/null)) + +TGT=($(ls kernel-*.$FC/linux-*.$2/configs/kernel-*-*.config \ + kernel-*.$FC/linux-*.$2/configs/kernel-*-*-debug.config 2>/dev/null)) +TGT1=(${TGT[*]#kernel-*.$FC/linux-*.$2/configs/kernel-*-}) + +ALL_OPTS="cdfimn" + +if [ $# -lt 2 ] ; then + echo -e "Usage:\n $(basename $0) [-$ALL_OPTS] input target\n" + echo -e " Sort input config file into the same order as the target\n" + echo -e " -c: insert comments about non-matching/impossible items" + echo -e " -d: show raw unsorted output with extra debug text" + echo -e " -f: force output to match what is in the target config," + echo -e " and/or remove impossible config items" + echo -e " -i: find impossible config items" + echo -e " -m: find changed config items" + echo -e " -n: do not sort output\n" + echo -e " input: source config file" ' [' "${SRC[*]#config-}" ']\n' + echo -e " target: output arch name" ' [' "${TGT1[*]%.config}" ']\n' + exit 1 +fi + +while getopts "$ALL_OPTS" OPTION ; do +case $OPTION in +c) + ADDCOMMENT=1 ;; +d) + DEBUG=1 ;; +f) + FORCE=1 ;; +i) + FIND_IMPOSS=1 ;; +m) + FIND_CHANGED=1 ;; +n) + NOSORT=1 ;; +\?) + exit 2 ;; +esac +done + +if [ "$FORCE" -a "$ADDCOMMENT" ] ; then + echo "-f and -c options cannot be used together" + exit 2 +fi + +shift $((OPTIND-1)) + +TEMPFILES="xx00 xx01 xx98 xx99" +TEMPLEFT= +for FILE in $TEMPFILES ; do + [ -f "$FILE" ] && TEMPLEFT="Y" +done +if [ "$TEMPLEFT" ] ; then + echo "WARNING! Output files named xx?? already exist." >&2 + read -p "Press <Enter> to erase files, or Ctrl-C to exit..." + echo >&2 +fi +rm -f $TEMPFILES + +SRCFILE=config-$1 +[ ! -f $SRCFILE ] && echo "Input file" $SRCFILE "missing" && exit 2 + +TGTFILE=kernel-*.$FC/linux-*.$2/configs/kernel-*-$2.config +[ ! -f $TGTFILE ] && echo "No target file matching" $TGTFILE "exists" && exit 2 + +[ "$FIND_IMPOSS" ] && \ + find kernel-*.$FC/*.$2 -name Kconfig\* -type f \ + | xargs egrep -s -h '^[[:space:]]*(menu)?config[[:space:]]+' \ + | sed -r 's/^[[:space:]]*(menu)?config[[:space:]]+/CONFIG_/' \ + | sort | uniq >xx98 + +extract_optname() { + # extract the option name from $TEXT, setting $OPTNAME + OPTNAME= + if [ "${TEXT:0:7}" = "CONFIG_" ] ; then + OPTNAME=${TEXT%%=*} + elif [ "${TEXT:0:9}" = "# CONFIG_" ] ; then + OPTNAME=${TEXT%" is not set"} + OPTNAME=${OPTNAME#\# } + fi +} + +print_saved_comments() { + if [ $IX -gt 0 ] ; then + [ "$DEBUG" ] && echo " ->" $IX "comments were saved" + (( IX-- )) + for IX in $(seq 0 $IX) ; do + echo "$LINE":"${SAVECOMMENT[$IX]}" + done + unset SAVECOMMENT + IX=0 + fi +} + +assign_line_number() { + # use input line numbers if not sorting + [ "$NOSORT" ] && LINE=$IN + # make sure it has a line number + [ -z "$LINE" ] && LINE=999999 +} + +IX=0 +IN=0 +declare -a SAVECOMMENT + +cat ${SRCFILE} | { +while read TEXT ; do + + LINE= + COMMENT= + + # replace empty lines + [ -z "$TEXT" ] && TEXT='//' + + if [ "${TEXT:0:7}" = "CONFIG_" -o "${TEXT:0:9}" = "# CONFIG_" ] ; then + + LINE=$(grep -n "^$TEXT" $TGTFILE | head -1 | cut -f 1 -d ':') + if [ -z "$LINE" ] ; then + [ "$DEBUG" ] && echo "nofind ->" "$TEXT" + + extract_optname + if [ "$OPTNAME" ] ; then + + if [ "$FIND_CHANGED" ] ; then + for FINDTEXT in "^${OPTNAME}=" "^# ${OPTNAME} is not set" ; do + if [ -z "$LINE" ] ; then + [ "$DEBUG" ] && echo "looking for ->" "$FINDTEXT" + LINE=$(grep -n "$FINDTEXT" $TGTFILE | head -1 | cut -f 1 -d ':') + if [ "$LINE" ] ; then + CHANGED=$(grep "$FINDTEXT" $TGTFILE | head -1) + if [ "$FORCE" ] ; then + TEXT=$CHANGED + [ "$DEBUG" ] && echo 'forced ->' "$TEXT" + else + if [ "$ADDCOMMENT" ] ; then + if [ ${CHANGED:0:1} = '#' ] ; then + NEWOPT="not set" + else + NEWOPT=${CHANGED#$OPTNAME} + fi + COMMENT="# -- Next option changed to \"${NEWOPT}\" at target line $LINE --" + fi + fi + fi + fi + done + fi + + if [ "$FIND_IMPOSS" -a -z "$LINE" -a -z "$COMMENT" ] ; then + POSSIBLE=$(grep -n "^$OPTNAME" xx98) + if [ -z "$POSSIBLE" ] ; then + if [ "$ADDCOMMENT" ] ; then + COMMENT="# -- Next option is impossible --" + elif [ "$FORCE" ] ; then + [ "$DEBUG" ] && echo 'impossible ->' "$TEXT" + TEXT="" + fi + fi + fi + + fi + + fi + + else + # not a config variable + COMMENT="$TEXT" + TEXT= + fi + + [ "$DEBUG" -a "$COMMENT" ] && echo "comment ->" "$LINE" "$COMMENT" + [ "$DEBUG" -a "$TEXT" ] && echo "text ->" "$LINE" "$TEXT" + + if [ "$TEXT" ] ; then + + assign_line_number + + # print the saved comments first + print_saved_comments + # now print the latest comment and text + [ "$COMMENT" ] && echo "$LINE":"$COMMENT" + echo "$LINE":"$TEXT" + + elif [ "$COMMENT" ] ; then + + # no output yet, save the comment + SAVECOMMENT[$IX]="$COMMENT" + let IX++ + [ "$DEBUG" ] && echo 'savecomment (#'${IX}')' + + fi + + let IN++ + +done +# flush the buffers +assign_line_number +print_saved_comments +[ "$DEBUG" ] && echo "$IN lines read from input" +} >xx99 + +if [ "$DEBUG" ] ; then + # just show the raw output with debug info, then exit + cat xx99 +else + + # split output into two files, for matched and unmatched items + cat xx99 | sort -s -t ":" -k 1g | csplit -k -s - /^999999/ 2>/dev/null + + cat xx00 | cut -f 2- -d ':' | sed 's/^\/\/$//' + if [ -s xx01 ] ; then + echo + echo '# ------------ UNMATCHED OPTIONS ------------' + echo + cat xx01 | cut -f 2- -d ':' | sed 's/^\/\/$//' + fi + +fi + +rm -f $TEMPFILES diff --git a/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/stable-update.sh b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/stable-update.sh new file mode 100755 index 000000000..eefd9a96d --- /dev/null +++ b/freed-ora/tags/f26/4.15.10-200.fc26.gnu/scripts/stable-update.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# +# Author: Laura Abbott <labbott@fedoraproject.org> +# +# Apply a stable patch update to the Fedora tree. This takes care of +# - Downloading the patch from kernel.org +# - Uploading the source file +# - Removing old patch files +# - Updating the spec file stable version +# - Adding a proper changelog entry +# +# Based on steps from https://fedoraproject.org/wiki/Kernel/DayToDay#Stable_kernel_update +# +# Args: Stable version to update (e.g. 4.7.7, 4.8.1) + +if [ $# -lt 1 ]; then + echo "Need a version" + exit 1 +fi + +VERSION=`echo $1 | cut -d . -f 1` +if [ -z $VERSION ]; then + echo "Malformed version $1" + exit 1 +fi +PATCHLEVEL=`echo $1 | cut -d . -f 2` +if [ -z $VERSION ]; then + echo "Malformed version $1" + exit 1 +fi +SUBLEVEL=`echo $1 | cut -d . -f 3` +if [ -z $VERSION ]; then + echo "Malformed version $1" + exit 1 +fi + +if [ ! -f patch-$1.xz ]; then + wget https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-$1.xz + if [ ! $? -eq 0 ]; then + echo "Download fail" + exit 1 + fi +fi + +grep $1 sources &> /dev/null +if [ ! $? -eq 0 ]; then + fedpkg upload patch-$1.xz + + # Cryptic awk: search for the previous patch level (if one exists) and + # remove it from the source file + awk -v VER=$VERSION.$PATCHLEVEL.$((SUBLEVEL-1)) '$0 !~ VER { print $0; }' < sources > sources.tmp + mv sources.tmp sources +fi + +# Update the stable level +awk -v STABLE=$SUBLEVEL '/%define stable_update/ \ + { print "%define stable_update " STABLE } \ + !/%define stable_update/ { print $0 }' \ + < kernel.spec > kernel.spec.tmp +mv kernel.spec.tmp kernel.spec + +# Reset the base release for use with rpmdev-bumpspec +BASERELEASE=`cat kernel.spec | grep "%global baserelease" | cut -d ' ' -f 3 | head -c 1`00 +BASERELEASE=$(($BASERELEASE-1)) +BASERELEASE=$BASERELEASE perl -p -i -e 's|%global baserelease.*|%global baserelease $ENV{'BASERELEASE'}|' kernel.spec + +rpmdev-bumpspec -c "Linux v$1" kernel.spec |