Home Home > GIT Browse > packaging
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2019-07-09 22:50:28 +0200
committerMichal Suchanek <msuchanek@suse.de>2019-07-09 22:50:28 +0200
commit99a138a47a426c785b4fca302f5850ba73d2c388 (patch)
tree29544ba440cd1e9f55c5b1b591b8c99e941044c3
parent9fe85cc923627b4e6a4fb98c570e4eb7f7e5f657 (diff)
parent9d16ecd982eab5ca709eeed172c2309d6b2e9d00 (diff)
Merge branch 'scripts' into packaging
-rw-r--r--README4
-rwxr-xr-xscripts/bugzilla-cli2
-rwxr-xr-xscripts/bugzilla-create1
-rw-r--r--scripts/bugzilla/_cli.py2
-rw-r--r--scripts/git_sort/README.md192
-rwxr-xr-xscripts/git_sort/armor_origin.sh77
-rw-r--r--scripts/git_sort/backport-mode.sh343
-rwxr-xr-xscripts/git_sort/check_missing_fixes.sh17
-rw-r--r--scripts/git_sort/clean_conflicts.awk17
-rwxr-xr-xscripts/git_sort/clean_header.sh17
-rw-r--r--scripts/git_sort/exc.py16
-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/git_sort.py31
-rwxr-xr-xscripts/git_sort/ksapply.sh144
-rw-r--r--scripts/git_sort/lib.py29
-rw-r--r--scripts/git_sort/lib.sh17
-rw-r--r--scripts/git_sort/lib_from.sh17
-rw-r--r--scripts/git_sort/lib_tag.sh17
-rwxr-xr-xscripts/git_sort/merge_tool.py20
-rw-r--r--scripts/git_sort/patch.py17
-rw-r--r--scripts/git_sort/patch_body.awk17
-rw-r--r--scripts/git_sort/patch_header.awk17
-rwxr-xr-xscripts/git_sort/pre-commit.sh17
-rw-r--r--scripts/git_sort/pygit2_wrapper.py30
-rwxr-xr-xscripts/git_sort/qcp.py25
-rwxr-xr-xscripts/git_sort/qdupcheck.py20
-rwxr-xr-xscripts/git_sort/qgoto.py17
-rw-r--r--scripts/git_sort/quilt-mode.sh21
-rwxr-xr-xscripts/git_sort/refs_in_series.sh17
-rwxr-xr-xscripts/git_sort/rename_patch.sh82
-rwxr-xr-xscripts/git_sort/sequence-insert.py17
-rwxr-xr-xscripts/git_sort/series_conf.py17
-rwxr-xr-xscripts/git_sort/series_insert.py20
-rwxr-xr-xscripts/git_sort/series_sort.py55
-rw-r--r--scripts/git_sort/tests/sle12-sp2/Dockerfile2
-rw-r--r--scripts/git_sort/tests/support.py3
-rwxr-xr-xscripts/git_sort/tests/test_git_sort.py3
-rwxr-xr-xscripts/git_sort/tests/test_quilt_mode.py3
-rwxr-xr-xscripts/git_sort/tests/test_series_insert.py3
-rwxr-xr-xscripts/git_sort/tests/test_series_sort.py3
-rwxr-xr-xscripts/git_sort/update-configs.sh75
-rwxr-xr-xscripts/git_sort/update_clone.py20
-rwxr-xr-xscripts/git_sort/vi-conflicts.sh24
l---------scripts/guards1
-rw-r--r--scripts/lib/SUSE/MyBS.pm11
-rwxr-xr-xscripts/log218
-rwxr-xr-xscripts/python/suse_git/header.py2
-rwxr-xr-xscripts/python/tests/test_header.py308
-rwxr-xr-xscripts/run_oldconfig.sh31
-rwxr-xr-xscripts/sequence-patch.sh26
-rwxr-xr-xscripts/tar-up.sh3
53 files changed, 788 insertions, 1234 deletions
diff --git a/README b/README
index d7a29d1739..1c91eca8f0 100644
--- a/README
+++ b/README
@@ -361,8 +361,8 @@ Related Information
===================
Internal:
-https://wiki.innerweb.novell.com/index.php/SUSE/Labs_Publications/Kernel_Building.html
-https://wiki.innerweb.novell.com/index.php/SUSE/Labs_Publications/kernel_patches_rules
+https://wiki.suse.net/index.php/SUSE-Labs_Publications/Kernel_Building
+https://wiki.suse.net/index.php/SUSE-Labs_Publications/kernel_patches_rules
Public:
TBD
diff --git a/scripts/bugzilla-cli b/scripts/bugzilla-cli
index c06c04b6dc..c1eca50a0d 100755
--- a/scripts/bugzilla-cli
+++ b/scripts/bugzilla-cli
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
# This is a small wrapper script to simplify running the 'bugzilla'
# cli tool from a git checkout
diff --git a/scripts/bugzilla-create b/scripts/bugzilla-create
index 6036c60cd9..5d6de3c426 100755
--- a/scripts/bugzilla-create
+++ b/scripts/bugzilla-create
@@ -24,6 +24,7 @@ handle_one_patch() {
${BUGZILLA} new -p "${PRODUCT}" -c "${COMPONENT}" -a "${EMAIL}" \
${QA_EMAIL} -t "${SUBJ}" -v "${VERSION}" \
--comment "${COMMENT}" -s "CONFIRMED" \
+ --keywords Proactive-Upstream-Fix \
--no-refresh --ids > ${tmpdir}/bugid
if [ $? -ne 0 ]; then
diff --git a/scripts/bugzilla/_cli.py b/scripts/bugzilla/_cli.py
index a0a6d8302b..d314d38e9c 100644
--- a/scripts/bugzilla/_cli.py
+++ b/scripts/bugzilla/_cli.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
#
# bugzilla - a commandline frontend for the python bugzilla module
#
diff --git a/scripts/git_sort/README.md b/scripts/git_sort/README.md
index ce349495c7..b9881372cd 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:
@@ -270,6 +295,17 @@ conflict can be solved automatically using the git mergetool interface with
the script merge_tool.py. Please see the header of that file for installation
instructions.
+When using the merge tool, the LINUX_GIT reference repository must fetch from
+the repositories which are the upstream source of patches which were added in
+the remote branch of the merge (the `<commit>` argument to `git merge`) or
+which are in different subsystem maintainer sections between the local and
+remote revisions. A simple way to satisfy that condition is to fetch from all
+remotes configured for git-sort before doing a merge resolution. The script
+`scripts/git_sort/update_clone.py` can be used to create or update the
+configuration of a repository so that it contains all of the remotes
+configured for git-sort. Please see the help message of that script for more
+information.
+
As an example, the merge in kernel-source commit da87d04b3b needed conflict
resolution. Let's redo this resolution using merge_tool:
```
@@ -325,143 +361,15 @@ 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
-```
+Reporting Problems
+==================
+If you encounter problems while using any git-sort command, please send a
+report to <kernel@suse.de> which includes the following information:
+* the command you're trying to run and its output
+* which kernel-source.git commit you are working on. If your tree has
+ local changes before the command you're trying to run, commit them using
+ `git commit -n` and push to a dummy user branch (ex:
+ "users/<user>/SLE15/bugreport1") so that others can examine the tree and try
+ to reproduce the issue.
+* the output of
+ kernel-source$ GIT_DIR=$LINUX_GIT scripts/git_sort/git_sort.py -d
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/check_missing_fixes.sh b/scripts/git_sort/check_missing_fixes.sh
index c873679b81..638b5a852e 100755
--- a/scripts/git_sort/check_missing_fixes.sh
+++ b/scripts/git_sort/check_missing_fixes.sh
@@ -1,5 +1,22 @@
#!/bin/bash
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
# Check if a commit is referenced in the log of later commits.
# Useful to identify missing followup commits.
diff --git a/scripts/git_sort/clean_conflicts.awk b/scripts/git_sort/clean_conflicts.awk
index 4997fb1181..a5bb17e78b 100644
--- a/scripts/git_sort/clean_conflicts.awk
+++ b/scripts/git_sort/clean_conflicts.awk
@@ -1,5 +1,22 @@
#!/usr/bin/awk -f
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
BEGIN {
conflicts = 0
}
diff --git a/scripts/git_sort/clean_header.sh b/scripts/git_sort/clean_header.sh
index dd185e403c..b761585c8d 100755
--- a/scripts/git_sort/clean_header.sh
+++ b/scripts/git_sort/clean_header.sh
@@ -1,5 +1,22 @@
#!/bin/bash -e
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
# Filter a patch file such that it is properly formatted per SUSE rules.
# Useful when importing patches into SUSE's kernel-source.git.
diff --git a/scripts/git_sort/exc.py b/scripts/git_sort/exc.py
index b302fdc176..7f7af685f5 100644
--- a/scripts/git_sort/exc.py
+++ b/scripts/git_sort/exc.py
@@ -1,6 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
class KSException(BaseException):
pass
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/git_sort.py b/scripts/git_sort/git_sort.py
index 349a9fb20b..85d9cec0fd 100755
--- a/scripts/git_sort/git_sort.py
+++ b/scripts/git_sort/git_sort.py
@@ -1,6 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
import argparse
import bisect
import collections
@@ -10,13 +27,14 @@ import operator
import os
import os.path
import pprint
-import pygit2
import re
import shelve
import subprocess
import sys
import types
+import pygit2_wrapper as pygit2
+
class GSException(BaseException):
pass
@@ -185,7 +203,6 @@ remotes = (
Head(RepoURL("dhowells/linux-fs.git"), "keys-uefi"),
Head(RepoURL("tytso/ext4.git"), "dev"),
Head(RepoURL("s390/linux.git"), "for-linus"),
- Head(RepoURL("tj/libata.git"), "for-next"),
Head(RepoURL("https://github.com/kdave/btrfs-devel.git"), "misc-next"),
Head(RepoURL("git://people.freedesktop.org/~airlied/linux"), "drm-next"),
Head(RepoURL("git://anongit.freedesktop.org/drm/drm-misc"), "drm-misc-next"),
@@ -198,6 +215,7 @@ remotes = (
Head(RepoURL("klassert/ipsec.git")),
Head(RepoURL("klassert/ipsec-next.git")),
Head(RepoURL("mkp/scsi.git"), "4.19/scsi-queue"),
+ Head(RepoURL("mkp/scsi.git"), "5.0/scsi-fixes"),
Head(RepoURL("git://git.kernel.dk/linux-block.git"), "for-next"),
Head(RepoURL("git://git.kernel.org/pub/scm/virt/kvm/kvm.git"), "queue"),
Head(RepoURL("git://git.infradead.org/nvme.git"), "nvme-4.18"),
@@ -208,6 +226,7 @@ remotes = (
Head(RepoURL("viro/vfs.git"), "for-linus"),
Head(RepoURL("jeyu/linux.git"), "modules-next"),
Head(RepoURL("nvdimm/nvdimm.git"), "libnvdimm-for-next"),
+ Head(RepoURL("herbert/crypto-2.6.git"), "master"),
)
@@ -624,10 +643,14 @@ if __name__ == "__main__":
path = os.environ["GIT_DIR"]
except KeyError:
try:
+ # depending on the pygit2 version, discover_repository() will either
+ # raise KeyError or return None if a repository is not found.
path = pygit2.discover_repository(os.getcwd())
except KeyError:
- print("Error: Not a git repository", file=sys.stderr)
- sys.exit(1)
+ path = None
+ if path is None:
+ print("Error: Not a git repository", file=sys.stderr)
+ sys.exit(1)
repo = pygit2.Repository(path)
if args.dump_heads:
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/lib.py b/scripts/git_sort/lib.py
index 191e4b486f..9f7da0efb6 100644
--- a/scripts/git_sort/lib.py
+++ b/scripts/git_sort/lib.py
@@ -1,16 +1,34 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
import collections
import operator
import os
import os.path
-import pygit2
import re
import signal
import subprocess
import sys
+import pygit2_wrapper as pygit2
+
import exc
import git_sort
from patch import Patch
@@ -402,6 +420,15 @@ def series_sort(index, entries):
# no entry.dest
result[entry.dest_head].append(entry.value)
+ mainline = git_sort.remotes[0]
+ if mainline not in index.repo_heads:
+ raise exc.KSError(
+ "Did not find mainline information (ref \"%s\" from the repository "
+ "at \"%s\") in the repository at LINUX_GIT (\"%s\"). For more "
+ "information, please refer to the \"Configuration Requirements\" "
+ "section of \"scripts/git_sort/README.md\"." % (
+ mainline.rev, mainline.repo_url.url, index.repo.path,))
+
for head in index.repo_heads:
result[head] = flatten([
e[1]
diff --git a/scripts/git_sort/lib.sh b/scripts/git_sort/lib.sh
index 497d9f8ecb..a3b57200b3 100644
--- a/scripts/git_sort/lib.sh
+++ b/scripts/git_sort/lib.sh
@@ -1,3 +1,20 @@
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
bash_single_esc () {
sed "s/'/'\\\\''/g"
}
diff --git a/scripts/git_sort/lib_from.sh b/scripts/git_sort/lib_from.sh
index 95f8a8d36c..b69fc86b7d 100644
--- a/scripts/git_sort/lib_from.sh
+++ b/scripts/git_sort/lib_from.sh
@@ -1,3 +1,20 @@
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
# from_get
from_get () {
awk '
diff --git a/scripts/git_sort/lib_tag.sh b/scripts/git_sort/lib_tag.sh
index 6b4640f1e6..e64c302131 100644
--- a/scripts/git_sort/lib_tag.sh
+++ b/scripts/git_sort/lib_tag.sh
@@ -1,3 +1,20 @@
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
# countkeys <key>
countkeys () {
local key=$1
diff --git a/scripts/git_sort/merge_tool.py b/scripts/git_sort/merge_tool.py
index 8a70eed430..fda4c3478f 100755
--- a/scripts/git_sort/merge_tool.py
+++ b/scripts/git_sort/merge_tool.py
@@ -1,6 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
"""
Depends on `merge` from rcs
@@ -16,11 +33,12 @@ git mergetool --tool=git-sort series.conf
"""
import os.path
-import pygit2
import shutil
import subprocess
import sys
+import pygit2_wrapper as pygit2
+
import exc
import lib
import series_conf
diff --git a/scripts/git_sort/patch.py b/scripts/git_sort/patch.py
index b400b5db0b..1890d4fb91 100644
--- a/scripts/git_sort/patch.py
+++ b/scripts/git_sort/patch.py
@@ -1,6 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
import io
import re
import sys
diff --git a/scripts/git_sort/patch_body.awk b/scripts/git_sort/patch_body.awk
index b66eddd9c4..ea04ee5729 100644
--- a/scripts/git_sort/patch_body.awk
+++ b/scripts/git_sort/patch_body.awk
@@ -1,5 +1,22 @@
#!/usr/bin/awk -f
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
# from quilt's patchfns
!body && /^(---|\*\*\*|Index:)[ \t][^ \t]|^diff -/ {
diff --git a/scripts/git_sort/patch_header.awk b/scripts/git_sort/patch_header.awk
index e7f604e0f8..008161975a 100644
--- a/scripts/git_sort/patch_header.awk
+++ b/scripts/git_sort/patch_header.awk
@@ -1,5 +1,22 @@
#!/usr/bin/awk -f
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
# from quilt's patchfns
/^(---|\*\*\*|Index:)[ \t][^ \t]|^diff -/ {
diff --git a/scripts/git_sort/pre-commit.sh b/scripts/git_sort/pre-commit.sh
index 4e9fb33ef3..b6ecb8f7e0 100755
--- a/scripts/git_sort/pre-commit.sh
+++ b/scripts/git_sort/pre-commit.sh
@@ -1,5 +1,22 @@
#!/bin/bash
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
_libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
sorted_section_changed () {
diff --git a/scripts/git_sort/pygit2_wrapper.py b/scripts/git_sort/pygit2_wrapper.py
new file mode 100644
index 0000000000..0fff6a16b7
--- /dev/null
+++ b/scripts/git_sort/pygit2_wrapper.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2019 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+import sys
+
+try:
+ from pygit2 import *
+except ImportError as err:
+ print("Error: %s" % (err,), file=sys.stderr)
+ print("Please install the \"pygit2\" python3 module. For more details, "
+ "please refer to the \"Installation Requirements\" section of "
+ "\"scripts/git_sort/README.md\".", file=sys.stderr)
+ sys.exit(1)
diff --git a/scripts/git_sort/qcp.py b/scripts/git_sort/qcp.py
index 233425610a..7ac02514df 100755
--- a/scripts/git_sort/qcp.py
+++ b/scripts/git_sort/qcp.py
@@ -1,16 +1,34 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
import argparse
import io
import os
import os.path
-import pygit2
import shutil
import subprocess
import sys
import tempfile
+import pygit2_wrapper as pygit2
+
import exc
import lib
from patch import Patch
@@ -34,7 +52,10 @@ def format_import(references, tmpdir, dstdir, rev, poi=[]):
src,))
subprocess.check_call(("quilt", "import", "-P", dst, src,))
# This will remind the user to run refresh_patch.sh
- lib.touch(".pc/%s~refresh" % (dst,))
+ target_dir = os.path.join(".pc", dstdir)
+ if not os.path.isdir(target_dir):
+ os.mkdir(target_dir)
+ lib.touch(os.path.join(".pc", "%s~refresh" % (dst,)))
return 0
diff --git a/scripts/git_sort/qdupcheck.py b/scripts/git_sort/qdupcheck.py
index 72c5de79fb..a82ff49af1 100755
--- a/scripts/git_sort/qdupcheck.py
+++ b/scripts/git_sort/qdupcheck.py
@@ -1,13 +1,31 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
import argparse
import os
import os.path
-import pygit2
import subprocess
import sys
+import pygit2_wrapper as pygit2
+
import exc
import lib
import series_conf
diff --git a/scripts/git_sort/qgoto.py b/scripts/git_sort/qgoto.py
index f3a8e38e34..a164432dd2 100755
--- a/scripts/git_sort/qgoto.py
+++ b/scripts/git_sort/qgoto.py
@@ -1,6 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
import argparse
import os
import subprocess
diff --git a/scripts/git_sort/quilt-mode.sh b/scripts/git_sort/quilt-mode.sh
index c9f0b7bbaf..99aae1b874 100644
--- a/scripts/git_sort/quilt-mode.sh
+++ b/scripts/git_sort/quilt-mode.sh
@@ -1,6 +1,23 @@
# Contains a set of shell functions to assist in backporting upstream commits
# to SUSE's kernel-source.git.
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
_libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
. "$_libdir"/lib.sh
. "$_libdir"/lib_tag.sh
@@ -240,7 +257,7 @@ qadd () {
(
[ ${#series[@]} -gt 0 ] && printf "%s\n" "${series[@]}"
[ -n "$_series" ] && echo "$_series"
- ) | GIT_DIR=$git_dir "$_libdir"/git-sort
+ ) | GIT_DIR=$git_dir "$_libdir"/git_sort.py
)"
if [ -z "${series[0]}" ]; then
@@ -264,7 +281,7 @@ qedit () {
${EDITOR:-${VISUAL:-vi}} "$tmpfile"
mapfile -t series <<< "$(grep . "$tmpfile" |
- GIT_DIR=$git_dir $_libdir/git-sort)"
+ GIT_DIR=$git_dir $_libdir/git_sort.py)"
if [ -z "${series[0]}" ]; then
unset series[0]
diff --git a/scripts/git_sort/refs_in_series.sh b/scripts/git_sort/refs_in_series.sh
index cb58b7320f..43ddc05167 100755
--- a/scripts/git_sort/refs_in_series.sh
+++ b/scripts/git_sort/refs_in_series.sh
@@ -1,5 +1,22 @@
#!/bin/bash
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
# Check if a commit is already part of a patch in SUSE's kernel-source.git
# Useful to check if a list of commits have already been backported.
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/sequence-insert.py b/scripts/git_sort/sequence-insert.py
index 4a6142e2b8..78f753912a 100755
--- a/scripts/git_sort/sequence-insert.py
+++ b/scripts/git_sort/sequence-insert.py
@@ -1,6 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
"""
When we want to backport a specific commit at its right position in the sorted
sub-series, it is most efficient to use sequence_patch.sh to expand the tree up
diff --git a/scripts/git_sort/series_conf.py b/scripts/git_sort/series_conf.py
index a3ea04e3cf..86cb451c4b 100755
--- a/scripts/git_sort/series_conf.py
+++ b/scripts/git_sort/series_conf.py
@@ -1,6 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
# This script is used by the commit hook to detect if there are changes in the
# sorted section. Developers may commit to kernel-source without having changed
# the sorted section and used the git-sort tools, therefore without having the
diff --git a/scripts/git_sort/series_insert.py b/scripts/git_sort/series_insert.py
index 622b1cbea4..91297d2f17 100755
--- a/scripts/git_sort/series_insert.py
+++ b/scripts/git_sort/series_insert.py
@@ -1,6 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
"""
Script to insert new patches in series.conf according to the upstream order of
commits that the patches backport.
@@ -8,9 +25,10 @@ commits that the patches backport.
import argparse
import collections
-import pygit2
import sys
+import pygit2_wrapper as pygit2
+
import exc
import git_sort
import lib
diff --git a/scripts/git_sort/series_sort.py b/scripts/git_sort/series_sort.py
index dc62a4a2f3..444a24d0e7 100755
--- a/scripts/git_sort/series_sort.py
+++ b/scripts/git_sort/series_sort.py
@@ -1,6 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
"""
Script to sort series.conf lines according to the upstream order of commits that
the patches backport.
@@ -20,14 +37,7 @@ import argparse
import os
import sys
-try:
- import pygit2
-except ImportError as err:
- print("Error: %s" % (err,), file=sys.stderr)
- print("Please install the \"pygit2\" python3 module. For more details, "
- "please refer to the \"Installation Requirements\" section of "
- "\"scripts/git_sort/README.md\".", file=sys.stderr)
- sys.exit(1)
+import pygit2_wrapper as pygit2
import exc
import git_sort
@@ -50,22 +60,31 @@ if __name__ == "__main__":
"as appropriate. Default: false.")
parser.add_argument("series", nargs="?", metavar="series.conf",
help="series.conf file which will be modified in "
- "place. Default: read input from stdin.")
+ "place. Default: if stdin is a terminal, "
+ "\"series.conf\"; otherwise, read input from stdin.")
args = parser.parse_args()
repo_path = lib.repo_path()
repo = pygit2.Repository(repo_path)
index = git_sort.SortIndex(repo)
- if args.series is not None:
+ filter_mode = False
+ if args.series is None:
+ if sys.stdin.isatty():
+ path = "series.conf"
+ else:
+ filter_mode = True
+ else:
+ path = args.series
+ if filter_mode:
+ f = sys.stdin
+ else:
try:
- f = open(args.series)
+ f = open(path)
except FileNotFoundError as err:
print("Error: %s" % (err,), file=sys.stderr)
sys.exit(1)
- series = os.path.abspath(args.series)
- else:
- f = sys.stdin
+ series_path = os.path.abspath(path)
lines = f.readlines()
if args.prefix is not None:
@@ -74,7 +93,7 @@ if __name__ == "__main__":
try:
before, inside, after = series_conf.split(lines)
except exc.KSNotFound as err:
- if args.series is None:
+ if filter_mode:
before = []
inside = lines
after = []
@@ -120,10 +139,10 @@ if __name__ == "__main__":
after,
])
- if args.series is not None:
- f = open(series, mode="w")
- else:
+ if filter_mode:
f = sys.stdout
+ else:
+ f = open(series_path, mode="w")
f.writelines(output)
try:
lib.update_tags(index, to_update)
diff --git a/scripts/git_sort/tests/sle12-sp2/Dockerfile b/scripts/git_sort/tests/sle12-sp2/Dockerfile
index 9de8830e78..f5bfc48455 100644
--- a/scripts/git_sort/tests/sle12-sp2/Dockerfile
+++ b/scripts/git_sort/tests/sle12-sp2/Dockerfile
@@ -1,6 +1,6 @@
FROM benjamin_poirier/docker_images/sle-12-sp2:latest AS base
-RUN zypper -n ref
+RUN zypper -n --no-gpg-checks ref
FROM base AS packages
diff --git a/scripts/git_sort/tests/support.py b/scripts/git_sort/tests/support.py
index dfff2b855f..31e4c5e45a 100644
--- a/scripts/git_sort/tests/support.py
+++ b/scripts/git_sort/tests/support.py
@@ -3,7 +3,8 @@
import datetime
import os.path
-import pygit2
+
+import pygit2_wrapper as pygit2
# from http://www.pygit2.org/recipes/git-show.html
diff --git a/scripts/git_sort/tests/test_git_sort.py b/scripts/git_sort/tests/test_git_sort.py
index 187b38cfbd..5d6b82395c 100755
--- a/scripts/git_sort/tests/test_git_sort.py
+++ b/scripts/git_sort/tests/test_git_sort.py
@@ -4,7 +4,6 @@
import collections
import os
import os.path
-import pygit2
import shelve
import shutil
import subprocess
@@ -12,6 +11,8 @@ import sys
import tempfile
import unittest
+import pygit2_wrapper as pygit2
+
import git_sort
import lib
diff --git a/scripts/git_sort/tests/test_quilt_mode.py b/scripts/git_sort/tests/test_quilt_mode.py
index 95f35a74b4..1b32e4aa95 100755
--- a/scripts/git_sort/tests/test_quilt_mode.py
+++ b/scripts/git_sort/tests/test_quilt_mode.py
@@ -3,13 +3,14 @@
import os
import os.path
-import pygit2
import shutil
import subprocess
import sys
import tempfile
import unittest
+import pygit2_wrapper as pygit2
+
import git_sort
import lib
import series_conf
diff --git a/scripts/git_sort/tests/test_series_insert.py b/scripts/git_sort/tests/test_series_insert.py
index c93489a0c9..9be2e1ee6a 100755
--- a/scripts/git_sort/tests/test_series_insert.py
+++ b/scripts/git_sort/tests/test_series_insert.py
@@ -2,13 +2,14 @@
# -*- coding: utf-8 -*-
import os
-import pygit2
import shutil
import subprocess
import tempfile
import unittest
import sys
+import pygit2_wrapper as pygit2
+
import git_sort
import lib
import tests.support
diff --git a/scripts/git_sort/tests/test_series_sort.py b/scripts/git_sort/tests/test_series_sort.py
index 66317c2025..67e2e4ae56 100755
--- a/scripts/git_sort/tests/test_series_sort.py
+++ b/scripts/git_sort/tests/test_series_sort.py
@@ -3,13 +3,14 @@
import os
import os.path
-import pygit2
import shutil
import subprocess
import sys
import tempfile
import unittest
+import pygit2_wrapper as pygit2
+
import git_sort
import lib
import tests.support
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/update_clone.py b/scripts/git_sort/update_clone.py
index 7039d70c10..098fff56ee 100755
--- a/scripts/git_sort/update_clone.py
+++ b/scripts/git_sort/update_clone.py
@@ -1,12 +1,30 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
+# Copyright (C) 2018 SUSE LLC
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
import argparse
import collections
-import pygit2
import re
import shlex
+import pygit2_wrapper as pygit2
+
import git_sort
import lib
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
diff --git a/scripts/guards b/scripts/guards
new file mode 120000
index 0000000000..709cc82776
--- /dev/null
+++ b/scripts/guards
@@ -0,0 +1 @@
+../rpm/guards \ No newline at end of file
diff --git a/scripts/lib/SUSE/MyBS.pm b/scripts/lib/SUSE/MyBS.pm
index 654c788ae1..da42f3d9c7 100644
--- a/scripts/lib/SUSE/MyBS.pm
+++ b/scripts/lib/SUSE/MyBS.pm
@@ -26,7 +26,16 @@ sub new {
}
$self->{url} = URI->new($api_url);
- my $cfgfile = "$ENV{HOME}/.oscrc";
+ my $cfgfile;
+ foreach ("$ENV{HOME}/.oscrc", "$ENV{HOME}/.config/osc/oscrc") {
+ if (-f) {
+ $cfgfile = $_;
+ last;
+ }
+ }
+
+ defined $cfgfile or die "oscrc not found";
+
# replace name: value with name= value that Config::IniFiles can parse
open(my $fh, '<', $cfgfile) or die "$cfgfile: $!\n";
my $data = "";
diff --git a/scripts/log2 b/scripts/log2
index 4cb5e18c34..25ad680b4e 100755
--- a/scripts/log2
+++ b/scripts/log2
@@ -298,7 +298,7 @@ splice_series()
commit_single_patches()
{
local saved_index=$(git write-tree) patch series
- local file added=() modified_aux=() deleted=() no_edit
+ local file added=() modified_aux=() deleted=()
git cat-file blob HEAD:series.conf > "$tmpdir"/old_series
cp series.conf "$tmpdir"/new_series
@@ -341,7 +341,7 @@ commit_single_patches()
# Patches are being committed one by one for better bisectability.
# There are $# more patches to commit.
EOF
- if ! do_commit $no_edit; then
+ if ! do_commit $no_edit --no-verify; then
# restore the index so that the user does not need to git add
# the patches again
git read-tree "$saved_index"
@@ -357,7 +357,7 @@ EOF
if test -n "${modified[*]}"; then
no_edit=
fi
- if ! do_commit $no_edit -a; then
+ if ! do_commit $no_edit --no-verify -a; then
git read-tree "$saved_index"
return 1
fi
@@ -375,6 +375,16 @@ fi
"$_libdir"/check-cvs-add || exit 1
+while [ -n "$1" ] ; do
+ case "$1" in
+ --no-edit) no_edit=--no-edit
+ ;;
+ *) echo Unknown argument "$1" >&2
+ ;;
+ esac
+ shift
+done
+
trap 'rm -rf "$tmpdir"' EXIT
tmpdir=$(mktemp -d /tmp/${0##*/}.XXXXXX)
@@ -392,6 +402,8 @@ deleted=($(git diff --name-only --diff-filter=D HEAD))
scripts/check-patch-dirs "${added[@]}" "${modified[@]}" || exit 1
if only_patches; then
+ git add -u
+ "$_libdir"/git-pre-commit || exit
commit_single_patches || exit
else
# FIXME: -a should not be the default
diff --git a/scripts/python/suse_git/header.py b/scripts/python/suse_git/header.py
index e820bb56fd..262dfc8743 100755
--- a/scripts/python/suse_git/header.py
+++ b/scripts/python/suse_git/header.py
@@ -167,7 +167,7 @@ tag_map = {
'accepted' : [
{
'name' : 'SUSE',
- 'match' : '(bsc|boo|bnc|fate)#\d+',
+ 'match' : '((bsc|boo|bnc|fate)#\d+|jsc#\w+-\d+)',
},
{
'match' : '\S+',
diff --git a/scripts/python/tests/test_header.py b/scripts/python/tests/test_header.py
index 0b80a27ed1..003c0c84d9 100755
--- a/scripts/python/tests/test_header.py
+++ b/scripts/python/tests/test_header.py
@@ -8,32 +8,17 @@ from io import StringIO
from suse_git import header
-# You'll see a slightly strange pattern here:
-# try:
-# self.sometest()
-# self.assertTrue(False)
-# except Exception, e:
-# rest of test
-#
-# This is to test the exception contents. Python's unittest module
-# allows us to assert that a particular exception is raised but
-# it won't let us inspect the contents of it. The assertTrue(False)
-# will cause a test failure if an exception isn't raised; The
-# except HeaderException clause will cause a test failure if the
-# exception isn't HeaderException. When adding new test cases,
-# please follow this pattern when the test case is expecting to fail.
-
class TestHeaderChecker(unittest.TestCase):
def test_empty(self):
try:
self.header = header.Checker("")
except header.HeaderException as e:
- self.assertTrue(e.errors(header.MissingTagError) == 4)
+ self.assertEqual(4, e.errors(header.MissingTagError))
self.assertTrue(e.tag_is_missing('patch-mainline'))
self.assertTrue(e.tag_is_missing('from'))
self.assertTrue(e.tag_is_missing('subject'))
self.assertTrue(e.tag_is_missing('references'))
- self.assertTrue(e.errors() == 4)
+ self.assertEqual(4, e.errors())
def test_subject_dupe(self):
text = """
@@ -45,12 +30,11 @@ Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.DuplicateTagError) == 1)
- self.assertTrue(e.errors() == 1)
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.DuplicateTagError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_dupe(self):
text = """
@@ -62,12 +46,12 @@ Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.DuplicateTagError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.DuplicateTagError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_empty(self):
text = """
@@ -77,14 +61,14 @@ Patch-mainline:
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.EmptyTagError) == 1)
- self.assertTrue(e.errors(header.MissingTagError) == 1)
- self.assertTrue(e.tag_is_missing('patch-mainline'))
- self.assertTrue(e.errors() == 2)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.EmptyTagError))
+ self.assertEqual(1, e.errors(header.MissingTagError))
+ self.assertTrue(e.tag_is_missing('patch-mainline'))
+ self.assertEqual(2, e.errors())
def test_patch_mainline_version_no_ack_or_sob(self):
text = """
@@ -98,10 +82,10 @@ Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
try:
self.header = header.Checker(text)
except header.HeaderException as e:
- self.assertTrue(e.errors(header.MissingTagError) == 1)
+ self.assertEqual(1, e.errors(header.MissingTagError))
self.assertTrue(e.tag_is_missing('acked-by'))
self.assertTrue(e.tag_is_missing('signed-off-by'))
- self.assertTrue(e.errors() == 1)
+ self.assertEqual(1, e.errors())
def test_patch_mainline_version_correct_multi_ack(self):
text = """
@@ -215,12 +199,12 @@ Patch-mainline: n/a
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.FormatError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.FormatError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_submitted_correct_ml(self):
text = """
@@ -250,12 +234,12 @@ Patch-mainline: Submitted
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.FormatError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.FormatError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_submitted_detail_git_commit(self):
text = """
@@ -266,12 +250,12 @@ Git-repo: git://host/valid/path/to/repo
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.ExcludedTagError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.ExcludedTagError))
+ self.assertEqual(1, e.errors())
# Required/Excluded conflict between Patch-mainline (Submitted)
# and Git-commit
@@ -284,13 +268,13 @@ Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.MissingTagError) == 1)
- self.assertTrue(e.errors(header.ExcludedTagError) == 1)
- self.assertTrue(e.errors() == 2)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.MissingTagError))
+ self.assertEqual(1, e.errors(header.ExcludedTagError))
+ self.assertEqual(2, e.errors())
def test_patch_mainline_submitted_no_detail(self):
text = """
@@ -300,12 +284,12 @@ Patch-mainline: Submitted
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.FormatError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.FormatError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_never_no_detail(self):
text = """
@@ -318,8 +302,8 @@ Acked-by: developer@suse.com
try:
self.header = header.Checker(text)
except header.HeaderException as e:
- self.assertTrue(e.errors(header.FormatError) == 1)
- self.assertTrue(e.errors() == 1)
+ self.assertEqual(1, e.errors(header.FormatError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_yes_with_detail(self):
text = """
@@ -329,12 +313,12 @@ Patch-mainline: Yes, v4.1-rc1
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.FormatError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.FormatError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_yes_no_detail(self):
text = """
@@ -344,12 +328,12 @@ Patch-mainline: Yes
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.FormatError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.FormatError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_not_yet_no_detail(self):
text = """
@@ -359,12 +343,12 @@ Patch-mainline: Not yet
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.FormatError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.FormatError))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_never_detail(self):
text = """
@@ -408,9 +392,9 @@ Acked-by: developer@suse.com
self.header = header.Checker(text)
except header.HeaderException as e:
# Both policy and Git-commit require Patch-mainline
- self.assertTrue(e.errors(header.MissingTagError) == 2)
+ self.assertEqual(2, e.errors(header.MissingTagError))
self.assertTrue(e.tag_is_missing('patch-mainline'))
- self.assertTrue(e.errors() == 2)
+ self.assertEqual(2, e.errors())
def test_patch_mainline_queued_correct(self):
text = """
@@ -432,14 +416,14 @@ Patch-mainline: Queued
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.MissingTagError) == 2)
- self.assertTrue(e.tag_is_missing('git-commit'))
- self.assertTrue(e.tag_is_missing('git-repo'))
- self.assertTrue(e.errors() == 2)
+
+ e = cm.exception
+ self.assertEqual(2, e.errors(header.MissingTagError))
+ self.assertTrue(e.tag_is_missing('git-commit'))
+ self.assertTrue(e.tag_is_missing('git-repo'))
+ self.assertEqual(2, e.errors())
def test_patch_mainline_queued_with_git_repo(self):
text = """
@@ -450,15 +434,15 @@ Git-repo: git://path/to/git/repo
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- # Required by both Patch-mainline (Queued) and
- # Git-repo
- self.assertTrue(e.errors(header.MissingTagError) == 2)
- self.assertTrue(e.tag_is_missing('git-commit'))
- self.assertTrue(e.errors() == 2)
+
+ e = cm.exception
+ # Required by both Patch-mainline (Queued) and
+ # Git-repo
+ self.assertEqual(2, e.errors(header.MissingTagError))
+ self.assertTrue(e.tag_is_missing('git-commit'))
+ self.assertEqual(2, e.errors())
def test_patch_mainline_queued_with_git_commit(self):
text = """
@@ -469,13 +453,13 @@ Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.MissingTagError) == 1)
- self.assertTrue(e.tag_is_missing('git-repo'))
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.MissingTagError))
+ self.assertTrue(e.tag_is_missing('git-repo'))
+ self.assertEqual(1, e.errors())
def test_patch_mainline_invalid(self):
text = """
@@ -485,12 +469,12 @@ Patch-mainline: n/a
References: bsc#12345
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.FormatError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.FormatError))
+ self.assertEqual(1, e.errors())
def test_diff_like_description(self):
text = """
@@ -531,14 +515,14 @@ Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
References:
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.EmptyTagError) == 1)
- self.assertTrue(e.errors(header.MissingTagError) == 1)
- self.assertTrue(e.tag_is_missing('references'))
- self.assertTrue(e.errors() == 2)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.EmptyTagError))
+ self.assertEqual(1, e.errors(header.MissingTagError))
+ self.assertTrue(e.tag_is_missing('references'))
+ self.assertEqual(2, e.errors())
def test_patch_references_missing(self):
text = """
@@ -548,13 +532,13 @@ Patch-mainline: v4.2-rc1
Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.MissingTagError) == 1)
- self.assertTrue(e.tag_is_missing('references'))
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.MissingTagError))
+ self.assertTrue(e.tag_is_missing('references'))
+ self.assertEqual(1, e.errors())
def test_patch_references_multi(self):
text = """
@@ -604,24 +588,26 @@ Acked-by: developer@suse.com
self.header = header.Checker(text)
-# Enable this check when we want to require a real References tag
-# def test_patch_references_only_freeform(self):
-# text = """
-#From: developer@site.com
-#Subject: some patch
-#Patch-mainline: v4.2-rc1
-#Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-#References: fix for blahblah
-#Acked-by: developer@suse.com
-#"""
-# try:
-# self.header = header.Checker(text)
-# self.assertTrue(False)
-# except header.HeaderException, e:
-# self.assertTrue(e.errors(header.MissingTagError) == 1)
-# self.assertTrue(e.tag_is_missing('references'))
-# self.assertTrue(e.errors() == 1)
-#
+
+ @unittest.skip("Enable this check when we want to require a real "
+ "References tag")
+ def test_patch_references_only_freeform(self):
+ text = """
+From: developer@site.com
+Subject: some patch
+Patch-mainline: v4.2-rc1
+Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+References: fix for blahblah
+Acked-by: developer@suse.com
+"""
+ with self.assertRaises(header.HeaderException) as cm:
+ self.header = header.Checker(text)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.MissingTagError))
+ self.assertTrue(e.tag_is_missing('references'))
+ self.assertEqual(1, e.errors())
+
def test_patch_references_empty_update(self):
text = """
@@ -632,12 +618,12 @@ Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
References:
Acked-by: developer@suse.com
"""
- try:
+ with self.assertRaises(header.HeaderException) as cm:
self.header = header.Checker(text, True)
- self.assertTrue(False)
- except header.HeaderException as e:
- self.assertTrue(e.errors(header.EmptyTagError) == 1)
- self.assertTrue(e.errors() == 1)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.EmptyTagError))
+ self.assertEqual(1, e.errors())
def test_patch_references_missing_update(self):
text = """
@@ -697,21 +683,21 @@ Acked-by: developer@suse.com
self.header = header.Checker(text, True)
-# Enable this check when we want to require a real References tag
-# def test_patch_references_only_freeform_update(self):
-# text = """
-#From: developer@site.com
-#Subject: some patch
-#Patch-mainline: v4.2-rc1
-#Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-#References: fix for blahblah
-#Acked-by: developer@suse.com
-#"""
-# try:
-# self.header = header.Checker(text, True)
-# self.assertTrue(False)
-# except header.HeaderException, e:
-# self.assertTrue(e.errors(header.MissingTagError) == 1)
-# self.assertTrue(e.tag_is_missing('references'))
-# self.assertTrue(e.errors() == 1)
-#
+ @unittest.skip("Enable this check when we want to require a real "
+ "References tag")
+ def test_patch_references_only_freeform_update(self):
+ text = """
+From: developer@site.com
+Subject: some patch
+Patch-mainline: v4.2-rc1
+Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+References: fix for blahblah
+Acked-by: developer@suse.com
+"""
+ with self.assertRaises(header.HeaderException) as cm:
+ self.header = header.Checker(text, True)
+
+ e = cm.exception
+ self.assertEqual(1, e.errors(header.MissingTagError))
+ self.assertTrue(e.tag_is_missing('references'))
+ self.assertEqual(1, e.errors())
diff --git a/scripts/run_oldconfig.sh b/scripts/run_oldconfig.sh
index 123ab38243..de637afa3a 100755
--- a/scripts/run_oldconfig.sh
+++ b/scripts/run_oldconfig.sh
@@ -407,6 +407,37 @@ for config in $config_files; do
MAKE_ARGS="ARCH=$cpu_arch"
;;
esac
+ unset cross_arch
+ unset cross_extra
+ case $config in
+ arm64/*)
+ cross_arch="aarch64"
+ ;;
+ arm*/*)
+ cross_arch="arm"
+ cross_extra="gnueabi-"
+ ;;
+ ppc64le/*)
+ cross_arch="powerpc64le"
+ ;;
+ ppc64/*)
+ cross_arch="powerpc64"
+ ;;
+ ppc/*)
+ cross_arch="powerpc"
+ ;;
+ i386/*)
+ # hack: whatever i386-suse-linux-gcc is, it does not support asm-goto
+ cross_arch="x86_64"
+ ;;
+ *)
+ cross_arch="${config%%/*}"
+ ;;
+ esac
+ cross_compile="${CROSS_COMPILE-${cross_arch}-suse-linux-${cross_extra}}"
+ if [ -n "$cross_compile" -a -x /usr/bin/${cross_compile}gcc ]; then
+ MAKE_ARGS="$MAKE_ARGS CROSS_COMPILE=$cross_compile"
+ fi
if [ -n "$CC" ]; then
MAKE_ARGS="$MAKE_ARGS CC=$CC"
fi
diff --git a/scripts/sequence-patch.sh b/scripts/sequence-patch.sh
index 75fa028ba6..8ecbf4a61b 100755
--- a/scripts/sequence-patch.sh
+++ b/scripts/sequence-patch.sh
@@ -38,7 +38,7 @@ esac
usage() {
cat <<END
SYNOPSIS: $0 [-qv] [--symbol=...] [--dir=...]
- [--fast] [last-patch-name] [--vanilla] [--fuzz=NUM]
+ [--fast] [--rapid] [last-patch-name] [--vanilla] [--fuzz=NUM]
[--patch-dir=PATH] [--build-dir=PATH] [--config=ARCH-FLAVOR [--kabi]]
[--ctags] [--cscope] [--etags] [--skip-reverse]
@@ -65,12 +65,22 @@ SYNOPSIS: $0 [-qv] [--symbol=...] [--dir=...]
of the component patches fail to apply the tree will not be rolled
back.
+ The --rapid option will use rapidquilt to apply patches.
+
When used with last-patch-name, both --fast and --no-quilt
will set up a quilt environment for the remaining patches.
END
exit 1
}
+apply_rapid_patches() {
+ printf "%s\n" ${PATCHES_BEFORE[@]} >> $PATCH_DIR/series
+ rapidquilt push -a -d $PATCH_DIR -p $PWD $fuzz
+ status=$?
+
+ PATCHES=( ${PATCHES_AFTER[@]} )
+}
+
apply_fast_patches() {
echo "[ Fast-applying ${#PATCHES_BEFORE[@]} patches. ${#PATCHES_AFTER[@]} remain. ]"
LAST_LOG=$(echo "${PATCHES_BEFORE[@]}" | xargs cat | \
@@ -200,7 +210,7 @@ if $have_arch_patches; then
else
arch_opt=""
fi
-options=`getopt -o qvd:F: --long quilt,no-quilt,$arch_opt,symbol:,dir:,combine,fast,vanilla,fuzz,patch-dir:,build-dir:,config:,kabi,ctags,cscope,etags,skip-reverse -- "$@"`
+options=`getopt -o qvd:F: --long quilt,no-quilt,$arch_opt,symbol:,dir:,combine,fast,rapid,vanilla,fuzz,patch-dir:,build-dir:,config:,kabi,ctags,cscope,etags,skip-reverse -- "$@"`
if [ $? -ne 0 ]
then
@@ -213,6 +223,7 @@ QUIET=1
EXTRA_SYMBOLS=
QUILT=true
FAST=
+RAPID=
VANILLA=false
SP_BUILD_DIR=
CONFIG=
@@ -244,6 +255,9 @@ while true; do
--fast)
FAST=1
;;
+ --rapid)
+ RAPID=1
+ ;;
--arch)
export PATCH_ARCH=$2
shift
@@ -566,10 +580,12 @@ fi
mkdir $PATCH_DIR/.pc
echo 2 > $PATCH_DIR/.pc/.version
-if [ -z "$FAST" ]; then
- apply_patches
-else
+if [ -n "$FAST" ]; then
apply_fast_patches
+elif [ -n "$RAPID" ]; then
+ apply_rapid_patches
+else
+ apply_patches
fi
if [ -n "$EXTRA_SYMBOLS" ]; then
diff --git a/scripts/tar-up.sh b/scripts/tar-up.sh
index 90c3f3ab0a..9e5ece204b 100755
--- a/scripts/tar-up.sh
+++ b/scripts/tar-up.sh
@@ -195,8 +195,9 @@ CLEANFILES=()
trap 'if test -n "$CLEANFILES"; then rm -rf "${CLEANFILES[@]}"; fi' EXIT
tmpdir=$(mktemp -dt ${0##*/}.XXXXXX)
CLEANFILES=("${CLEANFILES[@]}" "$tmpdir")
+rpmfiles=$(ls rpm/* | grep -v "~$")
-cp -p rpm/* config.conf supported.conf doc/* $build_dir
+cp -p $rpmfiles config.conf supported.conf doc/* $build_dir
match="${flavor:+\\/$flavor$}"
match="${arch:+^+\\($(echo -n "${arch}" | sed 's/[, ]\+/\\\|/g')\\)\\>${match:+.*}}${match}"
[ -n "$match" ] && sed -i "/^$\|\s*#\|${match}/b; s/\(.*\)/#### \1/" $build_dir/config.conf