Home Home > GIT Browse > scripts
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Poirier <bpoirier@suse.com>2018-12-21 17:23:52 +0900
committerBenjamin Poirier <bpoirier@suse.com>2018-12-21 17:23:52 +0900
commite5655f63f99c85ba0095d268ceeda5a9512abb2d (patch)
tree05666eaebe7c0eb55b4dbb3fd3fbb6f07d2538d3
parent0f98ccc51ed33ee1e75310f6add3fab64e5cf802 (diff)
git-sort: Remove tools not related to series_sort
Some scripts were copied over from the ksapply repository but are not needed for git-sort, series_sort or quilt-mode. In preparation for moving the series_sort code to its own repository, remove these scripts. They can still be found in the ksapply repository: https://gitlab.suse.de/benjamin_poirier/ksapply
-rw-r--r--scripts/git_sort/README.md170
-rwxr-xr-xscripts/git_sort/armor_origin.sh77
-rw-r--r--scripts/git_sort/backport-mode.sh343
-rwxr-xr-xscripts/git_sort/git-f143
-rwxr-xr-xscripts/git_sort/git-overview90
l---------scripts/git_sort/git-sort1
-rwxr-xr-xscripts/git_sort/ksapply.sh144
-rwxr-xr-xscripts/git_sort/rename_patch.sh82
-rwxr-xr-xscripts/git_sort/update-configs.sh75
-rwxr-xr-xscripts/git_sort/vi-conflicts.sh24
10 files changed, 27 insertions, 1022 deletions
diff --git a/scripts/git_sort/README.md b/scripts/git_sort/README.md
index 362254b5fa..ca8c799de5 100644
--- a/scripts/git_sort/README.md
+++ b/scripts/git_sort/README.md
@@ -160,8 +160,33 @@ ben@f1:~/local/src/kernel-source$ ./scripts/log
Example workflow to backport a series of commits using kernel-source.git
========================================================================
-Refer to the section "Generate the list of commit ids to backport" to generate
-the primary list of commits to backport, /tmp/list
+Generate the list of commit ids to backport:
+```
+upstream$ git log --no-merges --topo-order --reverse --pretty=tformat:%H v3.12.6.. -- drivers/net/ethernet/emulex/benet/ > /tmp/output
+```
+
+Optionally, generate a description of the commits to backport.
+```
+upstream$ cat /tmp/output | xargs -n1 git log -n1 --oneline > /tmp/list
+```
+
+Optionally, check if commits in the list are referenced in the logs of later
+commits which are not in the list themselves. You may wish to review these
+later commits and add them to the list.
+```
+upstream$ cat /tmp/list | check_missing_fixes.sh
+```
+
+Optionally, check which commits in the list have already been applied to
+kernel-source.git. Afterwards, you may wish to regenerate the list of commit
+ids with a different starting point; or remove from series.conf the commits
+that have already been applied and cherry-pick them again during the backport;
+or skip them during the backport.
+
+```
+# note that the path is a pattern, not just a base directory
+kernel-source$ cat /tmp/list | refs_in_series.sh "drivers/net/ethernet/emulex/benet/*"
+```
Generate the work tree with patches applied up to the first patch in the
list of commits to backport:
@@ -335,144 +360,3 @@ Untracked files:
ben@f1:~/local/src/kernel-source$ git commit
```
-
-Example workflow to backport a series of commits using kernel.git
-=================================================================
-The following instructions detail an older approach, before series.conf was
-sorted. The instructions may still be relevant to die hard users of
-kernel.git but the resulting series.conf will need to be reordered, which may
-create some context conflicts.
-
-Obtain a patch set
-------------------
-### Option 1) Patch files from an external source
-When the patches come from vendors and have uncertain content: run a first
-pass of clean_patch.sh.
-```
-patches$ for file in *; do echo $file; clean_header.sh -r "bnc#790588 FATE#313912" $file; done
-```
-
-Although not mandatory, this step gives an idea of what condition the patch
-set is in to begin with. If this step succeeds, we will be able to have nice
-tags at the end.
-
-#### Import the patch set into kernel.git
-Import the patch set into kernel.git to make sure that it applies, compiles
-and works. The custom SUSE tags (Patch-mainline, ...) will be lost in the
-process. Before doing `git am`, run armor_origin.sh which transforms the
-"Git-commit" tag into a "(cherry picked from ...)" line.
-```
-patches$ for file in *; do echo $file; armor_origin.sh $file; done
-kernel$ git am /tmp/patches/cleaned/*
-```
-
-Use `git rebase -i` to add missing commits where they belong or generally fixup
-what needs to be.
-
-```
-kernel$ git format-patch -o /tmp/patches/sp3 origin/SLE11-SP3..
-```
-
-### Option 2) Commits from a git repository
-As an alternative to the previous steps, use this procedure when there is no
-patch set that comes from the vendor and it is instead us who are doing the
-backport.
-
-#### Generate the list of commit ids to backport
-```
-upstream$ git log --no-merges --topo-order --reverse --pretty=tformat:%H v3.12.6.. -- drivers/net/ethernet/emulex/benet/ > /tmp/output
-```
-
-Optionally, generate a description of the commits to backport.
-```
-upstream$ cat /tmp/output | xargs -n1 git log -n1 --oneline > /tmp/list
-```
-
-Optionally, check if commits in the list are referenced in the logs of later
-commits which are not in the list themselves. You may wish to review these
-later commits and add them to the list.
-```
-upstream$ cat /tmp/list | check_missing_fixes.sh
-```
-
-Optionally, check which commits in the list have already been applied to
-kernel-source.git. Afterwards, you may wish to regenerate the list of commit
-ids with a different starting point; or remove from series.conf the commits
-that have already been applied and cherry-pick them again during the backport;
-or skip them during the backport.
-
-```
-# note that the path is a pattern, not just a base directory
-kernel-source$ cat /tmp/list | refs_in_series.sh "drivers/net/ethernet/emulex/benet/*"
-```
-
-#### Cherry-pick each desired commit to kernel.git
-```
-kernel$ . ../kernel-source/scripts/git_sort/backport-mode.sh
-# note that the pattern is quoted
-kernel$ bpset -s -p ../kernel-source/ -a /tmp/list_series -c /tmp/list2 "drivers/net/ethernet/emulex/benet/*"
-```
-
-Examine the next commit using the following commands
-```
-bpref
-bpnext
-bpstat
-```
-Apply the next commit completely
-```
-bpcherry-pick-all
-bpcp
-```
-
-Apply a subset of the next commit. The changes under the path specified to
-bpset are included, more can optionally be specified.
-```
-bpcherry-pick-include <path>
-bpcpi
-```
-
-After applying a commit, you may have to fix conflicts manually. Moreover,
-it's a good thing to check that the result builds. Sometimes the driver commit
-depends on a core change. In that case, the core change can be cherry-picked
-and moved just before the current commit using git rebase -i.
-
-Alternatively, instead of applying the next commit, skip it
-```
-bpskip
-```
-
-There is a command to automate the above steps. It applies the next commit and
-checks that the result builds, for all remaining commits that were fed to
-`bpset`, one commit at a time. The command stops when there are problems.
-After manually fixing the problems, the command can be run again to resume
-where it stopped. To speed things up, `make` is called with a target
-directory, which is the argument.
-```
-bpdoit drivers/net/ethernet/emulex/benet/
-
-kernel$ git format-patch -o /tmp/patches/sp3 ccdc24086d54
-```
-
-Import the patch set into kernel-source.git
--------------------------------------------
-Check series.conf to find where the patch set will go and note the last patch
-before that (ex:
-"patches.drivers/IB-0004-mlx4-Configure-extended-active-speeds.patch") and the
-next patch after that (ex: "patches.drivers/iwlwifi-sp1-compatible-options").
-```
-kernel-source$ ./scripts/sequence-patch.sh patches.drivers/IB-0004-mlx4-Configure-extended-active-speeds.patch
-kernel-source$ cd tmp/current
-kernel-source/tmp/current$ quilt import /tmp/patches/sp3/*
-kernel-source/tmp/current$ while ! ( quilt next | grep -q iwlwifi-sp1-compatible-options) &&
- ksapply.sh -R "bnc#790588 FATE#313912" -s suse.com patches.drivers/; do true; done
-kernel-source/tmp/current$ cd ../../
-```
-
-Copy the new entries to their desired location in series.conf
-```
-kernel-source/tmp/current$ vi -p series.conf tmp/current/series
-
-kernel-source$ git add -A
-kernel-source$ scripts/log
-```
diff --git a/scripts/git_sort/armor_origin.sh b/scripts/git_sort/armor_origin.sh
deleted file mode 100755
index 9a44d13d15..0000000000
--- a/scripts/git_sort/armor_origin.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/bash -e
-
-# Transform a "Git-commit" tag into a "(cherry picked from ...)" line.
-# Useful when importing patches from SUSE's kernel-source.git into
-# kernel.git.
-
-
-progname=$(basename "$0")
-libdir=$(dirname "$(readlink -f "$0")")
-filename=
-
-. "$libdir"/lib_tag.sh
-
-usage () {
- echo "Usage: $progname [options] [patch file]"
- echo ""
- echo "Options:"
- printf "\t-h, --help Print this help\n"
- echo ""
-}
-
-
-result=$(getopt -o h --long help -n "$progname" -- "$@")
-
-if [ $? != 0 ]; then
- echo "Error: getopt error" >&2
- exit 1
-fi
-
-eval set -- "$result"
-
-while true ; do
- case "$1" in
- -h|--help)
- usage
- exit 0
- ;;
- --)
- shift
- break
- ;;
- *)
- echo "Error: could not parse arguments" >&2
- exit 1
- ;;
- esac
- shift
-done
-
-# bash strips trailing newlines in variables, protect them with "---"
-if [ -n "$1" ]; then
- filename=$1
- patch=$(cat $1 && echo ---)
- shift
-else
- patch=$(cat && echo ---)
-fi
-
-if [ -n "$1" ]; then
- echo "Error: too many arguments" > /dev/stderr
- usage > /dev/stderr
- exit 1
-fi
-
-body=$(echo -n "${patch%---}" | awk -f "$libdir"/patch_body.awk && echo "---")
-header=$(echo -n "${patch%---}" | awk -f "$libdir"/patch_header.awk && echo "---")
-
-git_commit=$(echo "$header" | tag_get git-commit | awk '{print $1}')
-if [ "$git_commit" ]; then
- header=$(echo -n "$header" | tag_add "cherry picked from commit" "$git_commit")
-fi
-
-if [ -n "$filename" ]; then
- exec 1>"$filename"
-fi
-echo -n "${header%---}"
-echo -n "${body%---}"
diff --git a/scripts/git_sort/backport-mode.sh b/scripts/git_sort/backport-mode.sh
deleted file mode 100644
index 9edcd71da7..0000000000
--- a/scripts/git_sort/backport-mode.sh
+++ /dev/null
@@ -1,343 +0,0 @@
-# Contains a set of shell functions to assist in generating a patch
-# series from upstream commits.
-# Useful when porting a list of commits from upstream to SUSE's kernel.git
-
-
-_libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
-. "$_libdir"/lib.sh
-. "$_libdir"/lib_tag.sh
-
-# Read patch file names and output corresponding lines suitable for later
-# processing via the "series" environment var
-# _expand_am [prefix]
-_expand_am () {
- local prefix
-
- if [ -d "$1" ]; then
- prefix=$(readlink -f "$1")
- elif [ "$1" ]; then
- echo "Error: not a directory \"$1\"" > /dev/stderr
- return 1
- fi
-
- local p
- while read p; do
- local f
- if [ "$prefix" ]; then
- f="$prefix/$p"
- else
- f=$p
- fi
-
- if [ -r "$f" ]; then
- local ref
-
- # do the lookup and expansion in separate steps so that
- # a missing Git-commit tag results in an error from git
- # during the expand
- if ! ref=$(cat "$f" | tag_get git-commit); then
- return 1
- fi
-
- if ref=$(echo "$ref" | expand_git_ref); then
- echo "$ref am $f"
- else
- return 1
- fi
- elif echo "$p" | grep -q "^[^#]"; then
- echo "Error: cannot read \"$f\"" > /dev/stderr
- return 1
- fi
- done
-}
-
-# Read commit refs and output corresponding lines suitable for later processing
-# via the "series" environment var
-# _expand_cp
-_expand_cp () {
- local list ref
-
- if ! list=$(expand_git_ref); then
- return 1
- fi
-
- for ref in $list; do
- echo "$ref cp $ref"
- done
-}
-
-# Read lists of patches and commits and set them in a "series" environment
-# variable. If no file is specified using options, read stdin as a list of
-# commits to cherry-pick.
-# bpset [options] [path of interest for cherry-pick...]
-# Options:
-# -p, --prefix=<dir> Search for patches in this directory
-# -a, --am=<file> Also read a list of patches to apply from FILE
-# -c, --cp=<file> Also read a list of commits to cherry-pick from FILE
-# -s, --sort Sort resulting series according to upstream order
-bpset () {
- if [ $BASH_SUBSHELL -gt 0 ]; then
- echo "Error: it looks like this function is being run in a subshell. It will not be effective because its purpose is to set an environment variable. You could run it like this instead: \`${FUNCNAME[0]} <<< \$(<cmd>)\`." > /dev/stderr
- return 1
- fi
-
- local opt_prefix opt_sort
- local _series opts
- local result=$(getopt -o p:a:c:s --long prefix:,am:,cp:,sort -n "${BASH_SOURCE[0]}:${FUNCNAME[0]}()" -- "$@")
-
- if [ $? != 0 ]; then
- echo "Error: getopt error" >&2
- exit 1
- fi
-
- eval set -- "$result"
-
- while true ; do
- case "$1" in
- -p|--prefix)
- opt_prefix=$2
- shift
- ;;
- -a|--am)
- if ! _series=$(echo "$_series"; cat "$2" | _expand_am "$opt_prefix"); then
- return 1
- fi
- opts=1
- shift
- ;;
- -c|--cp)
- if ! _series=$(echo "$_series"; cat "$2" | _expand_cp); then
- return 1
- fi
- opts=1
- shift
- ;;
- -s|--sort)
- opt_sort=1
- ;;
- --)
- shift
- break
- ;;
- *)
- echo "Error: could not parse arguments" >&2
- exit 1
- ;;
- esac
- shift
- done
-
- paths_of_interest=$(
- for arg in "$@"; do
- echo "$arg"
- done
- )
-
- # if options were empty, read from stdin
- if [ -z "$opts" ] && ! _series=$(cat | _expand_cp); then
- return 1
- fi
- if [ "$opt_sort" ]; then
- _series=$(echo "$_series" | git sort)
- fi
- series=$(echo "$_series" | cut -d" " -f 2-)
-}
-
-bpref () {
- if [ -n "$series" ]; then
- set -- $(echo "$series" | head -n1)
- case "$1" in
- cp)
- echo $2
- ;;
- am)
- cat "$2" | tag_get git-commit | expand_git_ref
- ;;
- esac
- fi
-}
-
-_bpaction () {
- if [ -n "$series" ]; then
- awk '{print $1; exit}' <<< "$series"
- fi
-}
-
-_bparg () {
- if [ -n "$series" ]; then
- awk '{print $2; exit}' <<< "$series"
- fi
-}
-
-# show the first entry in the series
-bpnext () {
- if [ -n "$series" ]; then
- local ref=$(bpref)
-
- echo "$series" | head -n1
- git log -n1 --oneline $ref
- fi
-}
-alias bptop=bpnext
-
-bpstat () {
- local action=$(_bpaction)
-
- case "$action" in
- am)
- git apply --stat < $(_bparg)
- ;;
- cp)
- local ref=$(bpref)
-
- git diff --stat $ref^..$ref
- ;;
- esac
-}
-
-bpf1 () {
- local action=$(_bpaction)
-
- case "$action" in
- am)
- cat $(_bparg)
- ;;
- cp)
- git f1 $(bpref)
- ;;
- esac
-}
-
-bpskip () {
- if [ $BASH_SUBSHELL -gt 0 ]; then
- echo "Error: it looks like this function is being run in a subshell. It will not be effective because its purpose is to set an environment variable." > /dev/stderr
- return 1
- fi
- previous=$(echo "$series" | head -n1)
- series=$(awk 'NR > 1 {print}' <<< "$series")
-}
-
-bpcherry-pick-all () {
- local action=$(_bpaction)
- local arg=$(_bparg)
- bpskip
-
- case "$action" in
- am)
- if git am --reject $arg; then
- bpaddtag
- else
- return $?
- fi
- ;;
- cp)
- git cherry-pick -x $arg
- ;;
- esac
-}
-alias bpcp=bpcherry-pick-all
-
-bpaddtag () {
- local action=$(echo "$previous" | awk '{print $1}')
- local arg=$(echo "$previous" | awk '{print $2}')
- case $action in
- cp)
- git log -n1 --pretty=format:%B | \
- tag_add "cherry picked from commit" "$arg" | \
- git commit -q --amend -F -
- ;;
- am)
- local ref=$(cat "$arg" | tag_get git-commit | expand_git_ref)
- local suse_ref=$(cat "$arg" | tag_get references)
-
- git log -n1 --pretty=format:%B | \
- tag_add "cherry picked from commit" "$ref" | \
- tag_add "cherry picked for" "$suse_ref" | \
- git commit -q --amend -F -
- ;;
- esac
-}
-
-# bpcherry-pick-include <path...>
-bpcherry-pick-include () {
- local args=$(
- for arg in "$@"; do
- echo "--include \"$arg\""
- done
- while read path; do
- echo "--include \"$path\""
- done <<< "$paths_of_interest"
- )
- args=$(echo "$args" | xargs -d"\n")
- local action=$(_bpaction)
- local arg=$(_bparg)
- bpskip
- case $action in
- cp)
- local patch=$(git format-patch --stdout $arg^..$arg)
- local files=$(echo "$patch" | \
- eval "git apply --numstat $args" | cut -f3)
-
- if echo "$patch" | eval "git apply --reject $args"; then
- echo "$files" | xargs -d"\n" git add
- git commit -C $arg
- bpaddtag
- fi
- ;;
- am)
- if git am --reject $args "$arg"; then
- bpaddtag
- fi
- ;;
- esac
-}
-alias bpcpi=bpcherry-pick-include
-
-bpreset () {
- git reset --hard
- git ls-files -o --exclude-standard | xargs rm
-}
-alias bpclean=bpreset
-
-# Check that the patch passed via stdin touches only paths_of_interest
-_poicheck () {
- local args=$(
- while read path; do
- echo "--exclude \"$path\""
- done <<< "$paths_of_interest"
- )
- args=$(echo "$args" | xargs -d"\n")
-
- eval "git apply --numstat $args" | wc -l | grep -q "^0$"
-}
-
-_jobsnb=$(($(cat /proc/cpuinfo | grep "^processor\>" | wc -l) * 2))
-
-bpdoit () {
- if [ $# -lt 1 ]; then
- echo "If you want to do it, you must specify build paths!" > /dev/stderr
- echo "Usage: ${FUNCNAME[0]} <build path>..." > /dev/stderr
- return 1
- fi
-
- while [ $(bpref) ]; do
- if [ "$(_bpaction)" = "cp" ] && ! git format-patch --stdout $(bpref)^..$(bpref) | _poicheck; then
- echo "The following commit touches paths outside of the paths of interest. Please examine the situation." > /dev/stderr
- bpnext > /dev/stderr
- return 1
- fi
-
- if ! bpcp; then
- echo "The last commit did not apply successfully. Please examine the situation." > /dev/stderr
- return 1
- fi
-
- local prev_action=$(echo "$previous" | awk '{print $1}')
- # When doing many am in sequence, only build test at the end
- if ! [ "$prev_action" = "am" -a "$(_bpaction)" = "am" ] &&
- ! make -j$_jobsnb "$@"; then
- echo "The last applied commit results in a build failure. Please examine the situation." > /dev/stderr
- return 1
- fi
- done
-}
diff --git a/scripts/git_sort/git-f1 b/scripts/git_sort/git-f1
deleted file mode 100755
index 7d3c5e4490..0000000000
--- a/scripts/git_sort/git-f1
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-
-usage () {
- echo "Usage: git f1 <rev>"
- echo ""
- echo "Output one commit formatted as a patch."
- echo ""
-}
-
-if [ "$1" = "-h" ]; then
- usage
- exit
-fi
-
-rev=$1
-shift
-
-if [ -n "$1" ]; then
- echo "fatal: too many arguments" > /dev/stderr
- usage > /dev/stderr
- exit 1
-fi
-
-if ! commit=$(git rev-parse --verify "${rev:-HEAD}^{commit}"); then
- exit 1
-fi
-
-if git cat-file -p $commit | awk '
- /^parent/ {
- n++
- if (n > 1) {
- exit 1
- }
- }
- /^author/ {
- exit
- }'; then
- # not a merge
- git format-patch --stdout --notes --max-count=1 $commit
-else
- echo "Warning: $commit is a merge commit" > /dev/stderr
- git show $commit
-fi
diff --git a/scripts/git_sort/git-overview b/scripts/git_sort/git-overview
deleted file mode 100755
index a7ffb2447f..0000000000
--- a/scripts/git_sort/git-overview
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-
-progname=$(basename "$0")
-format=short
-
-usage () {
- echo "Usage: git overview <commit...>"
- echo ""
- echo "Output a summary string of commit objects"
- echo ""
- echo "Options:"
- echo " -s, --short Use format <abbrev> <subject> (<desc>) [default]"
- echo " -f, --fixes Use format <abbrev12> (\"<subject>\")"
- echo " -l, --long Use format <abbrev12> (\"<subject>\", <desc>)"
- echo " -m, --mini Use format <abbrev12> (<desc>)"
- echo " -h, --help Print this help"
- echo ""
-}
-
-result=$(getopt -o sflmh --long short,fixes,long,mini,help -n "$progname" -- "$@")
-retval=$?
-if [ $retval -eq 1 ]; then
- usage > /dev/stderr
- exit 1
-elif [ $retval -ne 0 ]; then
- echo "Error: getopt error ($retval)" > /dev/stderr
- exit 1
-fi
-
-eval set -- "$result"
-
-while true ; do
- case "$1" in
- -s|--short)
- format=short
- ;;
- -f|--fixes)
- format=fixes
- ;;
- -l|--long)
- format=long
- ;;
- -m|--mini)
- format=mini
- ;;
- -h|--help)
- usage
- exit
- ;;
- --)
- shift
- break
- ;;
- *)
- echo "Error: could not parse arguments" >&2
- exit 1
- ;;
- esac
- shift
-done
-
-revs=$(git rev-parse --default HEAD "$@")
-if [ $(echo "$revs" | wc -l) -eq 1 ]; then
- limit="--max-count=1"
-fi
-
-echo "$revs" | git rev-list $limit --stdin | while read commit; do
- if [ $format = "short" -o $format = "long" -o $format = "mini" ]; then
- desc=$(git describe --contains --match "v*" $commit 2>/dev/null)
- if [ -z "$desc" ]; then
- desc=$(git describe --contains --all $commit)
- fi
- desc="${desc%%[~^]*}"
- fi
-
- case $format in
- short)
- echo "$(git log --max-count=1 --pretty="format:%h %s" $commit) ($desc)"
- ;;
- fixes)
- echo "$(git log --max-count=1 --abbrev=12 --pretty="format:%h (\"%s\")" $commit)"
- ;;
- long)
- echo "$(git log --max-count=1 --abbrev=12 --pretty="format:%h (\"%s\"" $commit), $desc)"
- ;;
- mini)
- echo "$(git log --max-count=1 --abbrev=12 --pretty="format:%h" $commit) ($desc)"
- ;;
- esac
-done
diff --git a/scripts/git_sort/git-sort b/scripts/git_sort/git-sort
deleted file mode 120000
index 53a648ad78..0000000000
--- a/scripts/git_sort/git-sort
+++ /dev/null
@@ -1 +0,0 @@
-git_sort.py \ No newline at end of file
diff --git a/scripts/git_sort/ksapply.sh b/scripts/git_sort/ksapply.sh
deleted file mode 100755
index 8d217d542e..0000000000
--- a/scripts/git_sort/ksapply.sh
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/bash -e
-
-# Apply the next patch in the quilt queue while cleaning and renaming it.
-# Useful when importing patches into SUSE's kernel-source.git.
-
-
-progname=$(basename "$0")
-libdir=$(dirname "$(readlink -f "$0")")
-prefix=
-number="[[:digit:]]+-"
-opt_commit=
-opt_ref=
-
-usage () {
- echo "Usage: $progname [options] <dst \"patches.xxx\" dir>"
- echo ""
- echo "Options:"
- echo " -p, --prefix=<prefix> Add a prefix to the patch file name."
- echo " -n, --number Keep the number prefix in the patch file name."
- echo " -h, --help Print this help"
- echo "Options passed to clean_header.sh:"
- echo " -c, --commit=<refspec> Upstream commit id used to tag the patch file."
- echo " -r, --reference=<bsc> bsc or fate number used to tag the patch file."
- echo " -R, --soft-reference=<bsc> bsc or fate number used to tag the patch file"
- echo " if no other reference is found."
- echo " -s, --skip=<domain> Skip adding Acked-by tag if there is already an"
- echo " attribution line with an email from this domain."
- echo " (Can be used multiple times.)"
- echo ""
-}
-
-tempfiles=
-clean_tempfiles () {
- local file
-
- echo "$tempfiles" | while read -r file; do
- if [ -n "$file" -a -f "$file" ]; then
- rm "$file"
- fi
- done
-}
-trap 'clean_tempfiles' EXIT
-
-
-result=$(getopt -o p:nc:r:R:s:h --long prefix:,number,commit:,reference:,soft-reference:,skip:,help -n "$progname" -- "$@")
-
-if [ $? != 0 ]; then
- echo "Error: getopt error" >&2
- exit 1
-fi
-
-eval set -- "$result"
-
-while true ; do
- case "$1" in
- -p|--prefix)
- prefix="${2%-}-"
- shift
- ;;
- -n|--number)
- number=
- ;;
- -c|--commit)
- opt_commit=$2
- shift
- ;;
- -r|--reference)
- opt_ref=$2
- shift
- ;;
- -R|--soft-reference)
- opt_soft=$2
- shift
- ;;
- -s|--skip)
- opts_skip+="-s"
- opts_skip+=($2)
- shift
- ;;
- -h|--help)
- usage
- exit 0
- ;;
- --)
- shift
- break
- ;;
- *)
- echo "Error: could not parse arguments" >&2
- exit 1
- ;;
- esac
- shift
-done
-
-if [ -z "$1" ]; then
- echo "Error: too few arguments" > /dev/stderr
- usage > /dev/stderr
- exit 1
-fi
-
-patch_dir=$1
-shift
-if [ ! -d patches/"$patch_dir" ]; then
- echo "Error: patch directory \"$patch_dir\" does not exist" > /dev/stderr
- exit 1
-fi
-
-if [ -n "$1" ]; then
- echo "Error: too many arguments" > /dev/stderr
- usage > /dev/stderr
- exit 1
-fi
-
-if patch_file=$(QUILT_PATCHES_PREFIX=1 quilt next); then
- patch_orig=$(mktemp --tmpdir ksapply-patch_orig.XXXXXXXXXX)
- tempfiles+=$patch_orig$'\n'
- cat "$patch_file" > "$patch_orig"
- if quilt push; then
- :
- else
- exit $?
- fi
-
- ./refresh_patch.sh
- patch_new=$(mktemp --tmpdir ksapply-patch_new.XXXXXXXXXX)
- tempfiles+=$patch_new$'\n'
- cat "$patch_file" > "$patch_new"
- if ! "$libdir"/clean_header.sh -c "$opt_commit" -r "$opt_ref" -R "$opt_soft" "${opts_skip[@]}" "$patch_new"; then
- quilt pop
- cat "$patch_orig" > "$patch_file"
- exit 1
- fi
- cat "$patch_new" | awk -f "$libdir"/patch_header.awk | quilt header -r
-
- newname=$(quilt top | sed -r "s/^(patches\/)?($number)?/$prefix/")
- if ! quilt rename "$patch_dir/$newname"; then
- quilt pop
- cat "$patch_orig" > "$patch_file"
- exit 1
- fi
-else
- exit $?
-fi
diff --git a/scripts/git_sort/rename_patch.sh b/scripts/git_sort/rename_patch.sh
deleted file mode 100755
index 0bba71f160..0000000000
--- a/scripts/git_sort/rename_patch.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash -e
-
-# Move a patch file such that its new name is similar to what git format-patch
-# would have picked.
-# Useful when importing patches from a maildir.
-
-
-progname=$(basename "$0")
-libdir=$(dirname "$(readlink -f "$0")")
-filename=
-
-. "$libdir"/lib.sh
-. "$libdir"/lib_tag.sh
-
-usage () {
- echo "Usage: $progname [options] <patch file>"
- echo ""
- echo "Options:"
- printf "\t-h, --help Print this help\n"
- echo ""
-}
-
-
-result=$(getopt -o h --long help -n "$progname" -- "$@")
-
-if [ $? != 0 ]; then
- echo "Error: getopt error" >&2
- exit 1
-fi
-
-# Note the quotes around `$TEMP': they are essential!
-eval set -- "$result"
-
-while true ; do
- case "$1" in
- -h|--help)
- usage
- exit 0
- ;;
- --)
- shift
- break
- ;;
- *)
- echo "Error: could not parse arguments" >&2
- exit 1
- ;;
- esac
- shift
-done
-
-if [ -z "$1" ]; then
- echo "Error: too few arguments" > /dev/stderr
- usage > /dev/stderr
- exit 1
-fi
-
-# bash strips trailing newlines in variables, protect them with "---"
-filename=$1
-patch=$(cat $1 && echo ---)
-shift
-
-if [ -n "$1" ]; then
- echo "Error: too many arguments" > /dev/stderr
- usage > /dev/stderr
- exit 1
-fi
-
-body=$(echo -n "${patch%---}" | awk -f "$libdir"/patch_body.awk && echo ---)
-header=$(echo -n "${patch%---}" | awk -f "$libdir"/patch_header.awk && echo ---)
-
-subject=$(echo "$header" | tag_get subject)
-patch_num=$(echo "$subject" | get_patch_num)
-if [ "$patch_num" ]; then
- patch_num="$(printf %04d $patch_num)-"
-fi
-
-new_name="$patch_num$(echo "$subject" | remove_subject_annotation | format_sanitized_subject).patch"
-
-if [ "$filename" != "$new_name" ]; then
- mv "$filename" "$new_name"
-fi
diff --git a/scripts/git_sort/update-configs.sh b/scripts/git_sort/update-configs.sh
deleted file mode 100755
index 78b9d0ea77..0000000000
--- a/scripts/git_sort/update-configs.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash
-
-kernel_source=~/local/src/kernel-source/.git
-configs_dest=~/suse/configs
-
-# if we are in a checked out copy of the kernel.git or kernel-source.git repo,
-# we will copy the config for the current branch to .config
-if git_top_path=$(git rev-parse --show-toplevel 2>/dev/null) &&
- head=$(awk '
- /^ref:/ {
- match($2, "refs/heads/(.*)", a)
- print a[1]
- exit 0
- }
- {
- exit 1
- }
- ' $git_top_path/.git/HEAD) &&
- wd_remote_name=$(git config --get branch.$head.remote) &&
- wd_remote_branch=$(git config --get branch.$head.merge | awk '
- /^refs\/heads\// {
- match($1, "refs/heads/(.*)", a)
- print a[1]
- exit 0
- }
- {
- exit 1
- }
- ') &&
- url=$(git config --get "remote.$wd_remote_name.url"); then
- if echo "$url" | grep -q "/kernel-source.git$" &&
- [ -d "$git_top_path/tmp/current" ] &&
- echo "$(readlink "$git_top_path/tmp/current")" | grep -q "$wd_remote_branch$"; then
- config_dest="$git_top_path/tmp/current"
- elif echo "$url" | grep -q "/kernel.git$"; then
- config_dest=$git_top_path
- fi
-fi
-
-export GIT_DIR="$kernel_source"
-while read branch; do
- ks_remote_name=$(git config --get branch.$branch.remote)
- ks_remote_branch=$(git config --get branch.$branch.merge | awk '
- /^refs\/heads\// {
- match($1, "refs/heads/(.*)", a)
- print a[1]
- exit 0
- }
- {
- exit 1
- }
- ')
- if [ "$ks_remote_branch" != "$branch" ]; then
- continue
- fi
- ref="$ks_remote_name/$ks_remote_branch"
- object=$(git ls-tree $ref config/x86_64/default | awk '{print $3}')
- if [ "$object" ]; then
- do_copy=
- prefix=" "
-
- if [ "$config_dest" -a "$wd_remote_branch" = "$ks_remote_branch" ]; then
- do_copy=1
- prefix="* "
- fi
-
- echo "$prefix$ks_remote_branch"
-
- sanitized=$(echo "$ks_remote_branch" | sed -re 's:/:_:g')
- git cat-file blob $object > "$configs_dest/$sanitized"
- if [ "$do_copy" ]; then
- cp "$configs_dest/$sanitized" "$config_dest/.config"
- fi
- fi
-done < <(git rev-parse --symbolic --branches | grep -E "^(SLE|openSUSE|cve/|stable$|master$)")
diff --git a/scripts/git_sort/vi-conflicts.sh b/scripts/git_sort/vi-conflicts.sh
deleted file mode 100755
index 8dcb7aaf54..0000000000
--- a/scripts/git_sort/vi-conflicts.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-while read file; do
- orig=${file%.rej}
- if [ -e "$orig" ]; then
- args+=("$orig" "$file")
- fi
-done <<< "$(find ./ -name "*.rej")"
-
-git_unmerged=$(git ls-files --unmerged | awk '{print $4}' | uniq)
-if [ "$git_unmerged" ]; then
- args+=($git_unmerged)
- extra_arg='+/^[<=>]\{7}'
-fi
-
-quilt_unmerged=".pc/merge-conflicts"
-if [ -f "$quilt_unmerged" ]; then
- args+=($(cat "$quilt_unmerged"))
- extra_arg='+/^[<=>]\{7}'
-fi
-
-if [ "$args" ]; then
- vi -p "${args[@]}" $extra_arg
-fi