summaryrefslogtreecommitdiff |
diff options
author | Kernel Build Daemon <kbuild@suse.de> | 2019-01-17 07:22:50 +0100 |
---|---|---|
committer | Kernel Build Daemon <kbuild@suse.de> | 2019-01-17 07:22:50 +0100 |
commit | e140be3cb1bd5acfa11edf690e3d27738fc9beaa (patch) | |
tree | 616c1a47f2b63bfc31cbfda1dc39ce485b7ff3b3 | |
parent | 2beaffaecc647e443f57b8aa872f02d53f46dde0 (diff) | |
parent | ca1ed8e8e194c5091851e9a52063726525b6b3da (diff) |
Merge branch 'SLE12-SP3' into openSUSE-42.3
44 files changed, 841 insertions, 1217 deletions
diff --git a/patches.fixes/0001-drm-fb-helper-Ignore-the-value-of-fb_var_screeninfo..patch b/patches.fixes/0001-drm-fb-helper-Ignore-the-value-of-fb_var_screeninfo..patch new file mode 100644 index 0000000000..36af2ad489 --- /dev/null +++ b/patches.fixes/0001-drm-fb-helper-Ignore-the-value-of-fb_var_screeninfo..patch @@ -0,0 +1,78 @@ +From 66a8d5bfb518f9f12d47e1d2dce1732279f9451e Mon Sep 17 00:00:00 2001 +From: Ivan Mironov <mironov.ivan@gmail.com> +Date: Tue, 8 Jan 2019 12:23:53 +0500 +Subject: drm/fb-helper: Ignore the value of fb_var_screeninfo.pixclock +Git-commit: 66a8d5bfb518f9f12d47e1d2dce1732279f9451e +Patch-mainline: v5.0-rc2 +References: bsc#1106929 + +Strict requirement of pixclock to be zero breaks support of SDL 1.2 +which contains hardcoded table of supported video modes with non-zero +pixclock values[1]. + +To better understand which pixclock values are considered valid and how +driver should handle these values, I briefly examined few existing fbdev +drivers and documentation in Documentation/fb/. And it looks like there +are no strict rules on that and actual behaviour varies: + + * some drivers treat (pixclock == 0) as "use defaults" (uvesafb.c); + * some treat (pixclock == 0) as invalid value which leads to + -EINVAL (clps711x-fb.c); + * some pass converted pixclock value to hardware (uvesafb.c); + * some are trying to find nearest value from predefined table + (vga16fb.c, video_gx.c). + +Given this, I believe that it should be safe to just ignore this value if +changing is not supported. It seems that any portable fbdev application +which was not written only for one specific device working under one +specific kernel version should not rely on any particular behaviour of +pixclock anyway. + +However, while enabling SDL1 applications to work out of the box when +there is no /etc/fb.modes with valid settings, this change affects the +video mode choosing logic in SDL. Depending on current screen +resolution, contents of /etc/fb.modes and resolution requested by +application, this may lead to user-visible difference (not always): +image will be displayed in a right way, but it will be aligned to the +left instead of center. There is no "right behaviour" here as well, as +emulated fbdev, opposing to old fbdev drivers, simply ignores any +requsts of video mode changes with resolutions smaller than current. + +The easiest way to reproduce this problem is to install sdl-sopwith[2], +remove /etc/fb.modes file if it exists, and then try to run sopwith +from console without X. At least in Fedora 29, sopwith may be simply +installed from standard repositories. + +[1] SDL 1.2.15 source code, src/video/fbcon/SDL_fbvideo.c, vesa_timings +[2] http://sdl-sopwith.sourceforge.net/ + +Signed-off-by: Ivan Mironov <mironov.ivan@gmail.com> +Cc: stable@vger.kernel.org +Fixes: 79e539453b34e ("DRM: i915: add mode setting support") +Fixes: 771fe6b912fca ("drm/radeon: introduce kernel modesetting for radeon hardware") +Fixes: 785b93ef8c309 ("drm/kms: move driver specific fb common code to helper functions (v2)") +Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> +Link: https://patchwork.freedesktop.org/patch/msgid/20190108072353.28078-3-mironov.ivan@gmail.com +Acked-by: Thomas Zimmermann <tzimmermann@suse.de> +--- + drivers/gpu/drm/drm_fb_helper.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/drm_fb_helper.c ++++ b/drivers/gpu/drm/drm_fb_helper.c +@@ -1109,9 +1109,14 @@ int drm_fb_helper_check_var(struct fb_va + struct drm_framebuffer *fb = fb_helper->fb; + int depth; + +- if (var->pixclock != 0 || in_dbg_master()) ++ if (in_dbg_master()) + return -EINVAL; + ++ if (var->pixclock != 0) { ++ DRM_DEBUG("fbdev emulation doesn't support changing the pixel clock, value of pixclock is ignored\n"); ++ var->pixclock = 0; ++ } ++ + /* Need to resize the fb object !!! */ + if (var->bits_per_pixel > fb->bits_per_pixel || + var->xres > fb->width || var->yres > fb->height || diff --git a/patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch b/patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch new file mode 100644 index 0000000000..f3fb709487 --- /dev/null +++ b/patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch @@ -0,0 +1,44 @@ +From 0b944d3a4bba6b25f43aed530f4fa85c04d162a6 Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig <hch@lst.de> +Date: Sun, 30 Oct 2016 11:42:01 -0500 +Subject: [PATCH] aio: hold an extra file reference over AIO read/write + operations +References: bsc#1116027 +Git-commit: 0b944d3a4bba6b25f43aed530f4fa85c04d162a6 +Patch-mainline: v4.9-rc5 + +Otherwise we might dereference an already freed file and/or inode +when aio_complete is called before we return from the read_iter or +write_iter method. + +Signed-off-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> +Signed-off-by: Thomas Abraham <tabraham@suse.com> +[tabraham@suse.com: handled backport - minor modification for context] +--- + fs/aio.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/fs/aio.c b/fs/aio.c +index 1157e13a36d6..0aa71d338c04 100644 +--- a/fs/aio.c ++++ b/fs/aio.c +@@ -1460,6 +1460,7 @@ static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode, + + len = ret; + ++ get_file(file); + if (rw == WRITE) + file_start_write(file); + +@@ -1467,6 +1468,7 @@ static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode, + + if (rw == WRITE) + file_end_write(file); ++ fput(file); + kfree(iovec); + break; + +-- +2.13.7 + diff --git a/patches.rpmify/powerpc-boot-Request-no-dynamic-linker-for-boot-wrap.patch b/patches.rpmify/powerpc-boot-Request-no-dynamic-linker-for-boot-wrap.patch new file mode 100644 index 0000000000..4fe8ea4f6d --- /dev/null +++ b/patches.rpmify/powerpc-boot-Request-no-dynamic-linker-for-boot-wrap.patch @@ -0,0 +1,78 @@ +From 1d2c031c6a487bc3564a44e746e8b0e2f7d3187d Mon Sep 17 00:00:00 2001 +From: Nicholas Piggin <npiggin@gmail.com> +Date: Mon, 28 Nov 2016 12:42:26 +1100 +Subject: [PATCH] powerpc/boot: Request no dynamic linker for boot wrapper + +References: bsc#1070805 +Patch-mainline: v4.10-rc1 +Git-commit: ff45000fcb56b5b0f1a14a865d3541746d838a0a + +The boot wrapper performs its own relocations and does not require +PT_INTERP segment. However currently we don't tell the linker that. + +Prior to binutils 2.28 that works OK. But since binutils commit +1a9ccd70f9a7 ("Fix the linker so that it will not silently generate ELF +binaries with invalid program headers. Fix readelf to report such +invalid binaries.") binutils tries to create a program header segment +due to PT_INTERP, and the link fails because there is no space for it: + + ld: arch/powerpc/boot/zImage.pseries: Not enough room for program headers, try linking with -N + ld: final link failed: Bad value + +So tell the linker not to do that, by passing --no-dynamic-linker. + +Cc: stable@vger.kernel.org +Reported-by: Anton Blanchard <anton@samba.org> +Signed-off-by: Nicholas Piggin <npiggin@gmail.com> +[mpe: Drop dependency on ld-version.sh and massage change log] +Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> +Acked-by: Michal Suchanek <msuchanek@suse.de> +--- + arch/powerpc/boot/wrapper | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper +index ceaa75d5a684..be4831acda22 100755 +--- a/arch/powerpc/boot/wrapper ++++ b/arch/powerpc/boot/wrapper +@@ -161,6 +161,28 @@ case "$elfformat" in + elf32-powerpc) format=elf32ppc ;; + esac + ++ld_version() ++{ ++ # Poached from scripts/ld-version.sh, but we don't want to call that because ++ # this script (wrapper) is distributed separately from the kernel source. ++ # Extract linker version number from stdin and turn into single number. ++ awk '{ ++ gsub(".*\\)", ""); ++ gsub(".*version ", ""); ++ gsub("-.*", ""); ++ split($1,a, "."); ++ print a[1]*100000000 + a[2]*1000000 + a[3]*10000; ++ exit ++ }' ++} ++ ++# Do not include PT_INTERP segment when linking pie. Non-pie linking ++# just ignores this option. ++LD_VERSION=$(${CROSS}ld --version | ld_version) ++LD_NO_DL_MIN_VERSION=$(echo 2.26 | ld_version) ++if [ "$LD_VERSION" -ge "$LD_NO_DL_MIN_VERSION" ] ; then ++ nodl="--no-dynamic-linker" ++fi + + platformo=$object/"$platform".o + lds=$object/zImage.lds +@@ -412,7 +434,7 @@ if [ "$platform" != "miboot" ]; then + if [ -n "$link_address" ] ; then + text_start="-Ttext $link_address" + fi +- ${CROSS}ld -m $format -T $lds $text_start $pie -o "$ofile" \ ++ ${CROSS}ld -m $format -T $lds $text_start $pie $nodl -o "$ofile" \ + $platformo $tmp $object/wrapper.a + rm $tmp + fi +-- +2.19.2 + diff --git a/patches.rpmify/ppc64le-build-vmlinux.patch b/patches.rpmify/ppc64le-build-vmlinux.patch deleted file mode 100644 index 997def9a00..0000000000 --- a/patches.rpmify/ppc64le-build-vmlinux.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Dinar Valeev <dvaleev@suse.com> -Subject: PPC: Build only vmlinux target -Patch-Mainline: no, tbd (ancient patch) - -References: bsc#1070805 - -The zImage target doesn't build on ppc64le and we only ever -care about the resulting vmlinux file anyway, so drop compilation -of the zImage target for us. - -Signed-off-by: Dinar Valeev <dvaleev@suse.com> -Signed-off-by: Alexander Graf <agraf@suse.de> - ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -222,7 +222,7 @@ core-$(CONFIG_PERF_EVENTS) += arch/power - drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ - - # Default to zImage, override when needed --all: zImage -+all: vmlinux - - # With make 3.82 we cannot mix normal and wildcard targets - BOOT_TARGETS1 := zImage zImage.initrd uImage - 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/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 5f2c2ae33c..a07d737172 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 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..f029267b7e 100644 --- a/scripts/git_sort/lib.py +++ b/scripts/git_sort/lib.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 collections import operator import os 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..f3a148d946 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 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/qcp.py b/scripts/git_sort/qcp.py index 233425610a..1b69943372 100755 --- a/scripts/git_sort/qcp.py +++ b/scripts/git_sort/qcp.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 io import os diff --git a/scripts/git_sort/qdupcheck.py b/scripts/git_sort/qdupcheck.py index 72c5de79fb..d8c7920feb 100755 --- a/scripts/git_sort/qdupcheck.py +++ b/scripts/git_sort/qdupcheck.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 os.path 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..b6ab09c380 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 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..d55d7d0d79 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. diff --git a/scripts/git_sort/series_sort.py b/scripts/git_sort/series_sort.py index dc62a4a2f3..ae50761a97 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. 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..0223235dfa 100755 --- a/scripts/git_sort/update_clone.py +++ b/scripts/git_sort/update_clone.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 collections import pygit2 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/log2 b/scripts/log2 index 40c9e21ac3..79bdf5543d 100755 --- a/scripts/log2 +++ b/scripts/log2 @@ -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 @@ -400,6 +400,7 @@ modified=($(git diff --name-only --diff-filter=MT HEAD)) deleted=($(git diff --name-only --diff-filter=D HEAD)) if only_patches; then + "$_libdir"/git-pre-commit || exit commit_single_patches || exit else # FIXME: -a should not be the default 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 diff --git a/series.conf b/series.conf index d7ac832df1..7034ab047d 100644 --- a/series.conf +++ b/series.conf @@ -5270,7 +5270,6 @@ ######################################################## patches.rpmify/firmware-path patches.rpmify/cloneconfig.diff - patches.rpmify/ppc64le-build-vmlinux.patch patches.rpmify/powerpc-Blacklist-GCC-5.4-6.1-and-6.2.patch ######################################################## @@ -17968,6 +17967,7 @@ patches.arch/powerpc-perf-0012-update-attribute_group-data-structure.patch patches.arch/powerpc-perf-0013-power9-raw-event-format-encoding.patch patches.arch/powerpc-perf-0014-macros-for-power9-format-encoding.patch + patches.rpmify/powerpc-boot-Request-no-dynamic-linker-for-boot-wrap.patch patches.arch/arm64-ls1043-0024-soc-fsl-fix-spelling-mistakes-in-critical-error-mess.patch patches.arch/arm64-ls1043-0025-soc-qman-Check-ioremap-return-value.patch patches.arch/arm64-ls1043-0026-soc-qman-Replace-of_get_property-with-portable-equiv.patch @@ -23856,6 +23856,7 @@ patches.drivers/iommu-amd-fix-amd_iommu-force_isolation patches.fixes/0001-fbdev-fbmem-behave-better-with-small-rotated-display.patch patches.fixes/0001-fbdev-fbcon-Fix-unregister-crash-when-more-than-one-.patch + patches.fixes/0001-drm-fb-helper-Ignore-the-value-of-fb_var_screeninfo..patch ######################################################## # end of sorted patches @@ -25268,6 +25269,7 @@ patches.suse/hpwdt-calculate-reload-each-use.patch patches.suse/hpwdt-add-dynamic-debug.patch + patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch ######################################################## # You'd better have a good reason for adding a patch # below here. |