summaryrefslogtreecommitdiffstats
path: root/dts/scripts
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-11-17 09:54:19 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-11-17 09:54:19 +0100
commit68a902345d0643c303379599d7d29471ca296700 (patch)
tree21240ae6279a6999e904613eda239ba34f1bc62c /dts/scripts
parent80c2876fd7d8f4b8bb0caa3160b966147e6c8d46 (diff)
downloadbarebox-68a902345d0643c303379599d7d29471ca296700.tar.gz
barebox-68a902345d0643c303379599d7d29471ca296700.tar.xz
dts: update to v4.14-rc6
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'dts/scripts')
-rwxr-xr-xdts/scripts/cronjob14
-rwxr-xr-xdts/scripts/filter.sh3
-rwxr-xr-xdts/scripts/flatten-symlinks.sh31
-rwxr-xr-xdts/scripts/git-filter-branch557
-rwxr-xr-xdts/scripts/index-filter.sh6
-rwxr-xr-xdts/scripts/merge-new-release.sh28
-rwxr-xr-xdts/scripts/rewrite-index.pl72
-rw-r--r--dts/scripts/rewrite-paths.sed38
8 files changed, 112 insertions, 637 deletions
diff --git a/dts/scripts/cronjob b/dts/scripts/cronjob
index eeedca0506..628e91ea0d 100755
--- a/dts/scripts/cronjob
+++ b/dts/scripts/cronjob
@@ -77,15 +77,15 @@ echo
#echo
DATE=$(date +%Y%m%d)
-LATEST=latest-${DATE}
+TESTBRANCH=test-${DATE}
MERGE_OUTPUT=`(
set -e
-git checkout -b ${LATEST} origin/master
+git checkout -b ${TESTBRANCH} origin/master
git merge --no-edit upstream/dts
) 2>&1 `
-REF=$(git show-ref --verify refs/heads/${LATEST})
+REF=$(git show-ref --verify refs/heads/${TESTBRANCH})
echo "Testing: ${REF}"
-if git log ${LATEST} -- MAINTAINERS | grep --quiet . ; then
+if git log ${TESTBRANCH} -- MAINTAINERS | grep --quiet . ; then
echo "Filter branch has upstream-only content (MAINTAINERS file)"
exit 1
fi
@@ -105,6 +105,12 @@ echo
echo "Switching back to master branch"
git checkout master
+echo "Recording refs/tests/${DATE}"
+git update-ref refs/tests/${DATE} ${TESTBRANCH}
+
+echo "Removing ${TESTBRANCH}"
+git branch -D "${TESTBRANCH}"
+
echo "Final State:"
for branch in ${BRANCHES} ; do
REF=$(git show-ref --verify refs/heads/${branch})
diff --git a/dts/scripts/filter.sh b/dts/scripts/filter.sh
index e82218a1ca..e1f6bac298 100755
--- a/dts/scripts/filter.sh
+++ b/dts/scripts/filter.sh
@@ -27,10 +27,11 @@ rm -f .git/refs/original/refs/heads/${UPSTREAM_REWRITTEN}
git branch -f $UPSTREAM_REWRITTEN FETCH_HEAD
-sh $SCRIPTS/git-filter-branch --force \
+git filter-branch --force \
--index-filter ${SCRIPTS}/index-filter.sh \
--msg-filter 'cat && /bin/echo -e "\n[ upstream commit: $GIT_COMMIT ]"' \
--tag-name-filter 'while read t ; do /bin/echo -n $t-dts-raw ; done' \
+ --parent-filter 'sed "s/-p //g" | xargs -r git show-branch --independent | sed "s/\</-p /g"' \
--prune-empty --state-branch refs/heads/filter-state \
-- $RANGE
diff --git a/dts/scripts/flatten-symlinks.sh b/dts/scripts/flatten-symlinks.sh
deleted file mode 100755
index 84d007f40f..0000000000
--- a/dts/scripts/flatten-symlinks.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-set -e
-
-while read mode object stage path ; do
- case "$mode" in
- 120000)
- # symbolic link
- deref=$(echo $GIT_COMMIT:$path | git cat-file --batch-check='deref-ok %(objectname)' --follow-symlinks)
- case "$deref" in
- deref-ok*)
- echo -e "100644 ${deref#deref-ok } $stage\t$path"
- ;;
- dangling*) # skip
- ;;
- *) # the rest, missing etc
- echo >&2 "Failed to parse symlink $GIT_COMMIT:$path $deref"
- exit 1
- ;;
- esac
- ;;
- 100*)
- # Regular file, just pass through
- echo -e "$mode $object $stage\t$path"
- ;;
- *)
- echo >&2 "Unhandled ls-tree entry: $line"
- exit 1
- ;;
- esac
-done
diff --git a/dts/scripts/git-filter-branch b/dts/scripts/git-filter-branch
deleted file mode 100755
index 0e839ae682..0000000000
--- a/dts/scripts/git-filter-branch
+++ /dev/null
@@ -1,557 +0,0 @@
-#!/bin/sh
-#
-# Rewrite revision history
-# Copyright (c) Petr Baudis, 2006
-# Minimal changes to "port" it to core-git (c) Johannes Schindelin, 2007
-#
-# Lets you rewrite the revision history of the current branch, creating
-# a new branch. You can specify a number of filters to modify the commits,
-# files and trees.
-
-# The following functions will also be available in the commit filter:
-
-export PATH=/usr/lib/git-core:$PATH
-
-functions=$(cat << \EOF
-warn () {
- echo "$*" >&2
-}
-
-map()
-{
- # if it was not rewritten, take the original
- if test -r "$workdir/../map/$1"
- then
- cat "$workdir/../map/$1"
- else
- echo "$1"
- fi
-}
-
-# if you run 'skip_commit "$@"' in a commit filter, it will print
-# the (mapped) parents, effectively skipping the commit.
-
-skip_commit()
-{
- shift;
- while [ -n "$1" ];
- do
- shift;
- map "$1";
- shift;
- done;
-}
-
-# if you run 'git_commit_non_empty_tree "$@"' in a commit filter,
-# it will skip commits that leave the tree untouched, commit the other.
-git_commit_non_empty_tree()
-{
- if test $# = 3 && test "$1" = $(git rev-parse "$3^{tree}"); then
- map "$3"
- else
- git commit-tree "$@"
- fi
-}
-# override die(): this version puts in an extra line break, so that
-# the progress is still visible
-
-die()
-{
- echo >&2
- echo "$*" >&2
- exit 1
-}
-EOF
-)
-
-eval "$functions"
-
-# When piped a commit, output a script to set the ident of either
-# "author" or "committer
-
-set_ident () {
- lid="$(echo "$1" | tr "[A-Z]" "[a-z]")"
- uid="$(echo "$1" | tr "[a-z]" "[A-Z]")"
- pick_id_script='
- /^'$lid' /{
- s/'\''/'\''\\'\'\''/g
- h
- s/^'$lid' \([^<]*\) <[^>]*> .*$/\1/
- s/'\''/'\''\'\'\''/g
- s/.*/GIT_'$uid'_NAME='\''&'\''; export GIT_'$uid'_NAME/p
-
- g
- s/^'$lid' [^<]* <\([^>]*\)> .*$/\1/
- s/'\''/'\''\'\'\''/g
- s/.*/GIT_'$uid'_EMAIL='\''&'\''; export GIT_'$uid'_EMAIL/p
-
- g
- s/^'$lid' [^<]* <[^>]*> \(.*\)$/\1/
- s/'\''/'\''\'\'\''/g
- s/.*/GIT_'$uid'_DATE='\''&'\''; export GIT_'$uid'_DATE/p
-
- q
- }
- '
-
- LANG=C LC_ALL=C sed -ne "$pick_id_script"
- # Ensure non-empty id name.
- echo "case \"\$GIT_${uid}_NAME\" in \"\") GIT_${uid}_NAME=\"\${GIT_${uid}_EMAIL%%@*}\" && export GIT_${uid}_NAME;; esac"
-}
-
-USAGE="[--env-filter <command>] [--tree-filter <command>]
- [--index-filter <command>] [--parent-filter <command>]
- [--msg-filter <command>] [--commit-filter <command>]
- [--tag-name-filter <command>] [--subdirectory-filter <directory>]
- [--original <namespace>] [-d <directory>] [-f | --force]
- [--state-branch <branch>]
- [<rev-list options>...]"
-
-OPTIONS_SPEC=
-. git-sh-setup
-
-if [ "$(is_bare_repository)" = false ]; then
- require_clean_work_tree 'rewrite branches'
-fi
-
-tempdir=.git-rewrite
-filter_env=
-filter_tree=
-filter_index=
-filter_parent=
-filter_msg=cat
-filter_commit=
-filter_tag_name=
-filter_subdir=
-state_branch=
-orig_namespace=refs/original/
-force=
-prune_empty=
-remap_to_ancestor=
-while :
-do
- case "$1" in
- --)
- shift
- break
- ;;
- --force|-f)
- shift
- force=t
- continue
- ;;
- --remap-to-ancestor)
- # deprecated ($remap_to_ancestor is set now automatically)
- shift
- remap_to_ancestor=t
- continue
- ;;
- --prune-empty)
- shift
- prune_empty=t
- continue
- ;;
- -*)
- ;;
- *)
- break;
- esac
-
- # all switches take one argument
- ARG="$1"
- case "$#" in 1) usage ;; esac
- shift
- OPTARG="$1"
- shift
-
- case "$ARG" in
- -d)
- tempdir="$OPTARG"
- ;;
- --env-filter)
- filter_env="$OPTARG"
- ;;
- --tree-filter)
- filter_tree="$OPTARG"
- ;;
- --index-filter)
- filter_index="$OPTARG"
- ;;
- --parent-filter)
- filter_parent="$OPTARG"
- ;;
- --msg-filter)
- filter_msg="$OPTARG"
- ;;
- --commit-filter)
- filter_commit="$functions; $OPTARG"
- ;;
- --tag-name-filter)
- filter_tag_name="$OPTARG"
- ;;
- --subdirectory-filter)
- filter_subdir="$OPTARG"
- remap_to_ancestor=t
- ;;
- --original)
- orig_namespace=$(expr "$OPTARG/" : '\(.*[^/]\)/*$')/
- ;;
- --state-branch)
- state_branch="$OPTARG"
- ;;
- *)
- usage
- ;;
- esac
-done
-
-case "$prune_empty,$filter_commit" in
-,)
- filter_commit='git commit-tree "$@"';;
-t,)
- filter_commit="$functions;"' git_commit_non_empty_tree "$@"';;
-,*)
- ;;
-*)
- die "Cannot set --prune-empty and --commit-filter at the same time"
-esac
-
-case "$force" in
-t)
- rm -rf "$tempdir"
-;;
-'')
- test -d "$tempdir" &&
- die "$tempdir already exists, please remove it"
-esac
-mkdir -p "$tempdir/t" &&
-tempdir="$(cd "$tempdir"; pwd)" &&
-cd "$tempdir/t" &&
-workdir="$(pwd)" ||
-die ""
-
-# Remove tempdir on exit
-trap 'cd ../..; rm -rf "$tempdir"' 0
-
-ORIG_GIT_DIR="$GIT_DIR"
-ORIG_GIT_WORK_TREE="$GIT_WORK_TREE"
-ORIG_GIT_INDEX_FILE="$GIT_INDEX_FILE"
-GIT_WORK_TREE=.
-export GIT_DIR GIT_WORK_TREE
-
-# Make sure refs/original is empty
-git for-each-ref > "$tempdir"/backup-refs || exit
-while read sha1 type name
-do
- case "$force,$name" in
- ,$orig_namespace*)
- die "Cannot create a new backup.
-A previous backup already exists in $orig_namespace
-Force overwriting the backup with -f"
- ;;
- t,$orig_namespace*)
- git update-ref -d "$name" $sha1
- ;;
- esac
-done < "$tempdir"/backup-refs
-
-# The refs should be updated if their heads were rewritten
-git rev-parse --no-flags --revs-only --symbolic-full-name \
- --default HEAD "$@" > "$tempdir"/raw-heads || exit
-sed -e '/^^/d' "$tempdir"/raw-heads >"$tempdir"/heads
-
-test -s "$tempdir"/heads ||
- die "Which ref do you want to rewrite?"
-
-GIT_INDEX_FILE="$(pwd)/../index"
-export GIT_INDEX_FILE
-
-# map old->new commit ids for rewriting parents
-mkdir ../map || die "Could not create map/ directory"
-
-if [ -n "$state_branch" ] ; then
- state_commit=`git show-ref -s "$state_branch"`
- if [ -n "$state_commit" ] ; then
- echo "Populating map from $state_branch ($state_commit)" 1>&2
- git show "$state_commit":filter.map |
- perl -n -e 'm/(.*):(.*)/ or die;
- open F, ">../map/$1" or die;
- print F "$2" or die;
- close(F) or die'
- else
- echo "Branch $state_branch does not exist. Will create" 1>&2
- fi
-fi
-
-# we need "--" only if there are no path arguments in $@
-nonrevs=$(git rev-parse --no-revs "$@") || exit
-if test -z "$nonrevs"
-then
- dashdash=--
-else
- dashdash=
- remap_to_ancestor=t
-fi
-
-rev_args=$(git rev-parse --revs-only "$@")
-
-case "$filter_subdir" in
-"")
- eval set -- "$(git rev-parse --sq --no-revs "$@")"
- ;;
-*)
- eval set -- "$(git rev-parse --sq --no-revs "$@" $dashdash \
- "$filter_subdir")"
- ;;
-esac
-
-git rev-list --reverse --topo-order --default HEAD \
- --parents --simplify-merges $rev_args "$@" > ../revs ||
- die "Could not get the commits"
-commits=$(wc -l <../revs | tr -d " ")
-
-test $commits -eq 0 && die "Found nothing to rewrite"
-
-# Rewrite the commits
-
-git_filter_branch__commit_count=0
-while read commit parents; do
- git_filter_branch__commit_count=$(($git_filter_branch__commit_count+1))
- printf "\rRewrite $commit ($git_filter_branch__commit_count/$commits)"
-
- case "$filter_subdir" in
- "")
- git read-tree -i -m $commit
- ;;
- *)
- # The commit may not have the subdirectory at all
- err=$(git read-tree -i -m $commit:"$filter_subdir" 2>&1) || {
- if ! git rev-parse -q --verify $commit:"$filter_subdir"
- then
- rm -f "$GIT_INDEX_FILE"
- else
- echo >&2 "$err"
- false
- fi
- }
- esac || die "Could not initialize the index"
-
- GIT_COMMIT=$commit
- export GIT_COMMIT
- git cat-file commit "$commit" >../commit ||
- die "Cannot read commit $commit"
-
- eval "$(set_ident AUTHOR <../commit)" ||
- die "setting author failed for commit $commit"
- eval "$(set_ident COMMITTER <../commit)" ||
- die "setting committer failed for commit $commit"
- eval "$filter_env" < /dev/null ||
- die "env filter failed: $filter_env"
-
- if [ "$filter_tree" ]; then
- git checkout-index -f -u -a ||
- die "Could not checkout the index"
- # files that $commit removed are now still in the working tree;
- # remove them, else they would be added again
- git clean -d -q -f -x
- eval "$filter_tree" < /dev/null ||
- die "tree filter failed: $filter_tree"
-
- (
- git diff-index -r --name-only --ignore-submodules $commit &&
- git ls-files --others
- ) > "$tempdir"/tree-state || exit
- git update-index --add --replace --remove --stdin \
- < "$tempdir"/tree-state || exit
- fi
-
- eval "$filter_index" < /dev/null ||
- die "index filter failed: $filter_index"
-
- parentstr=
- for parent in $parents; do
- for reparent in $(map "$parent"); do
- parentstr="$parentstr -p $reparent"
- done
- done
- if [ "$filter_parent" ]; then
- parentstr="$(echo "$parentstr" | eval "$filter_parent")" ||
- die "parent filter failed: $filter_parent"
- fi
-
- sed -e '1,/^$/d' <../commit | \
- eval "$filter_msg" > ../message ||
- die "msg filter failed: $filter_msg"
- workdir=$workdir /bin/sh -c "$filter_commit" "git commit-tree" \
- $(git write-tree) $parentstr < ../message > ../map/$commit ||
- die "could not write rewritten commit"
-done <../revs
-
-# If we are filtering for paths, as in the case of a subdirectory
-# filter, it is possible that a specified head is not in the set of
-# rewritten commits, because it was pruned by the revision walker.
-# Ancestor remapping fixes this by mapping these heads to the unique
-# nearest ancestor that survived the pruning.
-
-if test "$remap_to_ancestor" = t
-then
- while read ref
- do
- sha1=$(git rev-parse "$ref"^0)
- test -f "$workdir"/../map/$sha1 && continue
- ancestor=$(git rev-list --simplify-merges -1 "$ref" "$@")
- test "$ancestor" && echo $(map $ancestor) >> "$workdir"/../map/$sha1
- done < "$tempdir"/heads
-fi
-
-# Finally update the refs
-
-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
-_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
-echo
-while read ref
-do
- # avoid rewriting a ref twice
- test -f "$orig_namespace$ref" && continue
-
- sha1=$(git rev-parse "$ref"^0)
- rewritten=$(map $sha1)
-
- test $sha1 = "$rewritten" &&
- warn "WARNING: Ref '$ref' is unchanged" &&
- continue
-
- case "$rewritten" in
- '')
- echo "Ref '$ref' was deleted"
- git update-ref -m "filter-branch: delete" -d "$ref" $sha1 ||
- die "Could not delete $ref"
- ;;
- $_x40)
- echo "Ref '$ref' was rewritten"
- if ! git update-ref -m "filter-branch: rewrite" \
- "$ref" $rewritten $sha1 2>/dev/null; then
- if test $(git cat-file -t "$ref") = tag; then
- if test -z "$filter_tag_name"; then
- warn "WARNING: You said to rewrite tagged commits, but not the corresponding tag."
- warn "WARNING: Perhaps use '--tag-name-filter cat' to rewrite the tag."
- fi
- else
- die "Could not rewrite $ref"
- fi
- fi
- ;;
- *)
- # NEEDSWORK: possibly add -Werror, making this an error
- warn "WARNING: '$ref' was rewritten into multiple commits:"
- warn "$rewritten"
- warn "WARNING: Ref '$ref' points to the first one now."
- rewritten=$(echo "$rewritten" | head -n 1)
- git update-ref -m "filter-branch: rewrite to first" \
- "$ref" $rewritten $sha1 ||
- die "Could not rewrite $ref"
- ;;
- esac
- git update-ref -m "filter-branch: backup" "$orig_namespace$ref" $sha1 ||
- exit
-done < "$tempdir"/heads
-
-# TODO: This should possibly go, with the semantics that all positive given
-# refs are updated, and their original heads stored in refs/original/
-# Filter tags
-
-if [ "$filter_tag_name" ]; then
- git for-each-ref --format='%(objectname) %(objecttype) %(refname)' refs/tags |
- while read sha1 type ref; do
- ref="${ref#refs/tags/}"
- # XXX: Rewrite tagged trees as well?
- if [ "$type" != "commit" -a "$type" != "tag" ]; then
- continue;
- fi
-
- if [ "$type" = "tag" ]; then
- # Dereference to a commit
- sha1t="$sha1"
- sha1="$(git rev-parse -q "$sha1"^{commit})" || continue
- fi
-
- [ -f "../map/$sha1" ] || continue
- new_sha1="$(cat "../map/$sha1")"
- GIT_COMMIT="$sha1"
- export GIT_COMMIT
- new_ref="$(echo "$ref" | eval "$filter_tag_name")" ||
- die "tag name filter failed: $filter_tag_name"
-
- echo "$ref -> $new_ref ($sha1 -> $new_sha1)"
-
- if [ "$type" = "tag" ]; then
- new_sha1=$( ( printf 'object %s\ntype commit\ntag %s\n' \
- "$new_sha1" "$new_ref"
- git cat-file tag "$ref" |
- awk '/^tagger/ { tagged=1 }
- /^$/ { if (!tagged && !done) { print "tagger Unknown <unknown@example.com> 0 +0000" } ; done=1 }
- // { print }' |
- sed -n \
- -e '1,/^$/{
- /^object /d
- /^type /d
- /^tag /d
- }' \
- -e '/^-----BEGIN PGP SIGNATURE-----/q' \
- -e 'p' ) |
- git mktag) ||
- die "Could not create new tag object for $ref"
- if git cat-file tag "$ref" | \
- sane_grep '^-----BEGIN PGP SIGNATURE-----' >/dev/null 2>&1
- then
- warn "gpg signature stripped from tag object $sha1t"
- fi
- fi
-
- git update-ref "refs/tags/$new_ref" "$new_sha1" ||
- die "Could not write tag $new_ref"
- done
-fi
-
-if [ -n "$state_branch" ] ; then
- echo "Saving rewrite state to $state_branch" 1>&2
- STATE_BLOB=$(ls ../map |
- perl -n -e 'chomp();
- open F, "<../map/$_" or die;
- chomp($f = <F>); print "$_:$f\n";' |
- git hash-object -w --stdin )
- STATE_TREE=$(/bin/echo -e "100644 blob $STATE_BLOB\tfilter.map" | git mktree)
- STATE_PARENT=$(git show-ref -s "$state_branch")
- unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
- unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE
- if [ -n "$STATE_PARENT" ] ; then
- STATE_COMMIT=$(/bin/echo "Sync" | git commit-tree "$STATE_TREE" -p "$STATE_PARENT")
- else
- STATE_COMMIT=$(/bin/echo "Sync" | git commit-tree "$STATE_TREE" )
- fi
- git update-ref "$state_branch" "$STATE_COMMIT"
-fi
-
-cd ../..
-rm -rf "$tempdir"
-
-trap - 0
-
-unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
-test -z "$ORIG_GIT_DIR" || {
- GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
-}
-test -z "$ORIG_GIT_WORK_TREE" || {
- GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&
- export GIT_WORK_TREE
-}
-test -z "$ORIG_GIT_INDEX_FILE" || {
- GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" &&
- export GIT_INDEX_FILE
-}
-
-if [ "$(is_bare_repository)" = false ]; then
- git read-tree -u -m HEAD || exit
-fi
-
-exit 0
diff --git a/dts/scripts/index-filter.sh b/dts/scripts/index-filter.sh
index e672867ce3..9610855020 100755
--- a/dts/scripts/index-filter.sh
+++ b/dts/scripts/index-filter.sh
@@ -3,11 +3,7 @@
set -e
set -o pipefail
-crumbs=/tmp/device-tree-export
-git ls-files -s | tee $crumbs-orig | \
- ${SCRIPTS}/flatten-symlinks.sh | tee $crumbs-flattened | \
- sed -n -f ${SCRIPTS}/rewrite-paths.sed | tee $crumbs-rewritten | \
- GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info
+${SCRIPTS}/rewrite-index.pl | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info
if [ -f "$GIT_INDEX_FILE.new" ] ; then
mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"
diff --git a/dts/scripts/merge-new-release.sh b/dts/scripts/merge-new-release.sh
index a6cf3491c9..bd2dc29618 100755
--- a/dts/scripts/merge-new-release.sh
+++ b/dts/scripts/merge-new-release.sh
@@ -16,7 +16,33 @@ v=$1
set -ex
-git merge --no-edit "${v}-raw"
+# Use the date of Linus' originally tagged commit for the merge. This might
+# differ from what the commit that the rewritten tag points to, since the
+# orignal commit may have been discarded.
+export GIT_AUTHOR_DATE=$(git log -1 --format=%ad "${v%-dts}")
+if [ ! "${GIT_AUTHOR_DATE}" ] ; then
+ echo >&2 "Unable to determine commit date for merge"
+ exit 1
+fi
+if [ "${v}" = "v2.6.12-rc2-dts" ] ; then
+ auh="--allow-unrelated-histories"
+fi
+git merge $auh --no-edit "${v}-raw"
git clean -fdqx
+# Use the date of Linus' original tag for the tag.
+case "${v%-dts}" in
+ v2.6.12*|v2.6.13-rc[123])
+ # Commits from v2.6.12-rc2..v2.6.13-rc3 lacked the date. So use the commit's
+ # date.
+ export GIT_COMMITTER_DATE="${GIT_AUTHOR_DATE}"
+ ;;
+ *)
+ export GIT_COMMITTER_DATE="$(git for-each-ref --format='%(taggerdate)' "refs/tags/${v%-dts}")"
+ ;;
+esac
+if [ ! "${GIT_COMMITTER_DATE}" ] ; then
+ echo >&2 "Unable to determine date for tag"
+ exit 1
+fi
git tag -s -m "Tagging ${v}" -u 695A46C6 "${v}"
make -k -j12 -s
diff --git a/dts/scripts/rewrite-index.pl b/dts/scripts/rewrite-index.pl
new file mode 100755
index 0000000000..ef89839ab1
--- /dev/null
+++ b/dts/scripts/rewrite-index.pl
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use IPC::Open2;
+my $pid;
+
+open(my $lsfiles, "-|", "git ls-files -s") or die "fork lsfiles: $!";
+
+while (<$lsfiles>) {
+ if ($_ =~ m/^120000 ([0-9a-f]{40}) (.*)\t(.*)/) {
+ my ($obj, $stage, $path) = ($1,$2,$3);
+ if (!defined $pid) {
+ $pid = open2(*Rderef, *Wderef, "git cat-file --batch-check='deref-ok %(objectname)' --follow-symlinks")
+ or die "open git cat-file: $!";
+ }
+ print Wderef "$ENV{GIT_COMMIT}:$path\n" or die "write Wderef: $!";
+ my $deref = <Rderef>;
+ if ($deref =~ m/^deref-ok ([0-9a-f]{40})$/) {
+ $_ = "100644 $1 $stage\t$path\n"
+ } elsif ($deref =~ /^dangling /) {
+ # Skip next line
+ my $dummy = <Rderef>;
+ } else {
+ die "Failed to parse symlink $ENV{GIT_COMMIT}:$path $deref";
+ }
+ }
+
+ my $m = 0;
+
+ # Keep the copyright. Also ensures we never have a completely empty commit.
+ $m++ if m/\tCOPYING$/;
+
+ # A few architectures have dts files at non standard paths. Massage those into
+ # a standard arch/ARCH/boot/dts first.
+
+ # symlink: arch/microblaze/boot/dts/system.dts -> ../../platform/generic/system.dts
+ next if m,\tarch/microblaze/boot/dts/system.dts$,;
+ $m++ if s,\tarch/microblaze/platform/generic/(system.dts)$,\tarch/microblaze/boot/dts/$1,;
+
+ # arch/mips/lantiq/dts/easy50712.dts
+ # arch/mips/lantiq/dts/danube.dtsi
+ # arch/mips/netlogic/dts/xlp_evp.dts
+ # arch/mips/ralink/dts/rt3050.dtsi
+ # arch/mips/ralink/dts/rt3052_eval.dts
+ $m++ if s,\tarch/mips/([^/]*)/dts/(.*\.dts.?)$,\tarch/mips/boot/dts/$2,;
+
+ # arch/mips/cavium-octeon/octeon_68xx.dts
+ # arch/mips/cavium-octeon/octeon_3xxx.dts
+ # arch/mips/mti-sead3/sead3.dts
+ $m++ if s,\tarch/mips/([^/]*)/([^/]*\.dts.?)$,\tarch/mips/boot/dts/$2,;
+
+ # arch/x86/platform/ce4100/falconfalls.dts
+ $m++ if s,\tarch/x86/platform/ce4100/falconfalls.dts,\tarch/x86/boot/dts/falconfalls.dts,;
+
+ # test cases
+ $m++ if s,\tdrivers/of/testcase-data/,\ttestcase-data/,;
+
+ # Now rewrite generic DTS paths
+ $m++ if s,\tarch/([^/]*)/boot/dts/(.*\.dts.?)$,\tsrc/$1/$2,;
+ $m++ if s,\tarch/([^/]*)/boot/dts/(.*\.h)$,\tsrc/$1/$2,;
+
+ # Also rewrite the DTS include paths for dtc+cpp support
+ $m++ if s,\tarch/([^/]*)/include/dts/,\tsrc/$1/include/,;
+ $m++ if s,\tinclude/dt-bindings/,\tinclude/dt-bindings/,;
+
+ # Rewrite the bindings subdirectory
+ $m++ if s,\tDocumentation/devicetree/bindings/,\tBindings/,;
+
+ print if $m > 0;
+}
+kill $pid if $pid;
+exit 0;
diff --git a/dts/scripts/rewrite-paths.sed b/dts/scripts/rewrite-paths.sed
deleted file mode 100644
index b73fbce71b..0000000000
--- a/dts/scripts/rewrite-paths.sed
+++ /dev/null
@@ -1,38 +0,0 @@
-# Keep the copyright. Also ensures we never have a completely empty commit.
-/\tCOPYING$/p
-
-# A few architectures have dts files at non standard paths. Massage those into
-# a standard arch/ARCH/boot/dts first.
-
-# symlink: arch/microblaze/boot/dts/system.dts -> ../../platform/generic/system.dts
-\,\tarch/microblaze/boot/dts/system.dts$,d
-s,\tarch/microblaze/platform/generic/\(system.dts\)$,\tarch/microblaze/boot/dts/\1,g
-
-# arch/mips/lantiq/dts/easy50712.dts
-# arch/mips/lantiq/dts/danube.dtsi
-# arch/mips/netlogic/dts/xlp_evp.dts
-# arch/mips/ralink/dts/rt3050.dtsi
-# arch/mips/ralink/dts/rt3052_eval.dts
-s,\tarch/mips/\([^/]*\)/dts/\(.*\.dts.\?\)$,\tarch/mips/boot/dts/\2,g
-
-# arch/mips/cavium-octeon/octeon_68xx.dts
-# arch/mips/cavium-octeon/octeon_3xxx.dts
-# arch/mips/mti-sead3/sead3.dts
-s,\tarch/mips/\([^/]*\)/\([^/]*\.dts.\?\)$,\tarch/mips/boot/dts/\2,g
-
-# arch/x86/platform/ce4100/falconfalls.dts
-s,\tarch/x86/platform/ce4100/falconfalls.dts,\tarch/x86/boot/dts/falconfalls.dts,g
-
-# test cases
-s,\tdrivers/of/testcase-data/,\ttestcase-data/,gp
-
-# Now rewrite generic DTS paths
-s,\tarch/\([^/]*\)/boot/dts/\(.*\.dts.\?\)$,\tsrc/\1/\2,gp
-s,\tarch/\([^/]*\)/boot/dts/\(.*\.h\)$,\tsrc/\1/\2,gp
-
-# Also rewrite the DTS include paths for dtc+cpp support
-s,\tarch/\([^/]*\)/include/dts/,\tsrc/\1/include/,gp
-s,\tinclude/dt-bindings/,\tinclude/dt-bindings/,gp
-
-# Rewrite the bindings subdirectory
-s,\tDocumentation/devicetree/bindings/,\tBindings/,gp