• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/support/scripts/apply-patches.sh
Ryan BarnettRyan Barnett committed aab481c14e309 Dec 2015
Raw file
Source viewDiff to previous
        series_patches="`grep -Ev "^#" ${path}/series | cut -d ' ' -f1 2> /dev/null`"
 
1
#!/usr/bin/env bash
2
# A little script I whipped up to make it easy to
3
# patch source trees and have sane error handling
4
# -Erik
5
#
6
# (c) 2002 Erik Andersen <andersen@codepoet.org>
7
#
8
# Parameters:
9
# - "-s", optional. Silent operation, don't print anything if there
10
# isn't any error.
11
# - the build directory, optional, default value is '.'. The place where are
12
# the package sources.
13
# - the patch directory, optional, default '../kernel-patches'. The place
14
# where are the scripts you want to apply.
15
# - other parameters are the patch name patterns, optional, default value is
16
# '*'. Pattern(s) describing the patch names you want to apply.
17
#
18
# The script will look recursively for patches from the patch directory. If a
19
# file named 'series' exists then the patches mentioned in it will be applied
20
# as plain patches, regardless of their file name. If no 'series' file exists,
21
# the script will look for file names matching pattern(s). If the name
22
# ends with '.tar.*', '.tbz2' or '.tgz', the file is considered as an archive
23
# and will be uncompressed into a directory named
24
# '.patches-name_of_the_archive-unpacked'. It's the turn of this directory to
25
# be scanned with '*' as pattern. Remember that scanning is recursive. Other
26
# files than series file and archives are considered as a patch.
27
#
28
# Once a patch is found, the script will try to apply it. If its name doesn't
29
# end with '.gz', '.bz', '.bz2', '.xz', '.zip', '.Z', '.diff*' or '.patch*',
30
# it will be skipped. If necessary, the patch will be uncompressed before being
31
# applied. The list of the patches applied is stored in '.applied_patches_list'
32
# file in the build directory.
33
​
34
silent=
35
if [ "$1" = "-s" ] ; then
36
    # add option to be used by the patch tool
37
    silent=-s
38
    shift
39
fi
40
​
41
# Set directories from arguments, or use defaults.
42
builddir=${1-.}
43
patchdir=${2-../kernel-patches}
44
shift 2
45
patchpattern=${@-*}
46
​
47
# use a well defined sorting order
48
export LC_COLLATE=C
49
​
50
if [ ! -d "${builddir}" ] ; then
51
    echo "Aborting.  '${builddir}' is not a directory."
52
    exit 1
53
fi
54
if [ ! -d "${patchdir}" ] ; then
55
    echo "Aborting.  '${patchdir}' is not a directory."
56
    exit 1
57
fi
58
​
59
# Remove any rejects present BEFORE patching - Because if there are
60
# any, even if patches are well applied, at the end it will complain
61
# about rejects in builddir.
62
find ${builddir}/ '(' -name '*.rej' -o -name '.*.rej' ')' -print0 | \
63
    xargs -0 -r rm -f
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.