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)

This commit is contained in:
Igor Pecovnik 2016-06-19 16:37:35 +02:00
parent b5ffd50e4c
commit e49c01a823
2 changed files with 29 additions and 19 deletions

View File

@ -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 <Enter> after you are done with changes to the source'
display_alert "Press <Enter> 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
}
}

View File

@ -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