From e49c01a8230509fc3f92ceb77d5db51a46e640c2 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Sun, 19 Jun 2016 16:37:35 +0200 Subject: [PATCH] Debug mode. When enabled it takes previous created patch and always create new patch out on the top of everythig. U-boot and kernel sources are not updating when this mode is enabled. After debbuging is done, patch must be moved somewhere else, that you can start with new patch creating since name is fixed. (u-boot|kernel-family-branch.patch) --- common.sh | 20 ++++++++++++++------ general.sh | 28 +++++++++++++++------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/common.sh b/common.sh index 49ed0740d7..5614eb6380 100644 --- a/common.sh +++ b/common.sh @@ -392,19 +392,27 @@ userpatch_create() # create commit to start from clean source git add . git -c user.name='Armbian User' -c user.email='user@example.org' commit -q -m "Cleaning working copy" + + local patch="$SRC/userpatches/patch/$1-$LINUXFAMILY-$BRANCH.patch" + + # apply previous user debug mode created patches + [[ -f "$patch" && $1 == "u-boot" ]] && display_alert "Applying existing u-boot patch" "$patch" "wrn" && patch --batch --silent -p1 -N < $patch + [[ -f "$patch" && $1 == "kernel" ]] && display_alert "Applying existing kernel patch" "$patch" "wrn" && patch --batch --silent -p1 -N < $patch # prompt to alter source display_alert "Make your changes in this directory:" "$(pwd)" "wrn" - read -p 'Press after you are done with changes to the source' + display_alert "Press after you are done" "waiting" "wrn" + read + tput cuu1 git add . # create patch out of changes - if ! git diff-index --quiet --cached HEAD; then - #if [[ "$(git status --porcelain)" ]]; then - git diff --staged > $SRC/userpatches/patch/$1-$LINUXFAMILY-$(date +'%d.%m.%Y_%H_%M_%S').patch - display_alert "You will find your patch here:" "$SRC/userpatches/patch/$1-$LINUXFAMILY-$(date +'%d.%m.%Y').patch" "info" + if ! git diff-index --quiet --cached HEAD; then + git diff --staged > $patch + display_alert "You will find your patch here:" "$patch" "info" else display_alert "No changes found, skipping patch creation" "" "wrn" fi git reset --soft HEAD~ + for i in {3..1..1};do echo -n "$i." && sleep 1; done fi -} +} \ No newline at end of file diff --git a/general.sh b/general.sh index ffd80f8806..98cdcb67db 100644 --- a/general.sh +++ b/general.sh @@ -132,19 +132,21 @@ if [ -d "$SOURCES/$2/$GITHUBSUBDIR" ]; then if [[ "$3" != "" ]] && [[ "$bar_1" == "$localbar" || "$bar_2" == "$localbar" ]] || [[ "$3" == "" && "$bar_3" == "$localbar" ]] || [[ $bar_1 == "" && $bar_2 == "" ]]; then display_alert "... you have latest sources" "$2 $3" "info" else - display_alert "... your sources are outdated - creating new shallow clone" "$2 $3" "info" - if [[ -z "$GITHUBSUBDIR" ]]; then - rm -rf $SOURCES/$2".old" - mv $SOURCES/$2 $SOURCES/$2".old" - else - rm -rf $SOURCES/$2/$GITHUBSUBDIR".old" - mv $SOURCES/$2/$GITHUBSUBDIR $SOURCES/$2/$GITHUBSUBDIR".old" - fi - - if [[ -n $3 && -n "$(git ls-remote $1 | grep "$tag")" ]]; then - git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 --depth 1 || git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 - else - git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR --depth 1 + if [ $DEBUG_MODE != yes ]; then + display_alert "... your sources are outdated - creating new shallow clone" "$2 $3" "info" + if [[ -z "$GITHUBSUBDIR" ]]; then + rm -rf $SOURCES/$2".old" + mv $SOURCES/$2 $SOURCES/$2".old" + else + rm -rf $SOURCES/$2/$GITHUBSUBDIR".old" + mv $SOURCES/$2/$GITHUBSUBDIR $SOURCES/$2/$GITHUBSUBDIR".old" + fi + + if [[ -n $3 && -n "$(git ls-remote $1 | grep "$tag")" ]]; then + git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 --depth 1 || git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 + else + git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR --depth 1 + fi fi cd $SOURCES/$2/$GITHUBSUBDIR git checkout -q