Select Git revision
-
Administrator authoredAdministrator authored
migrate 10.71 KiB
# This file describe operations needed for migration between versions,
# both for UPGRADE and DOWNGRADE.
#
# Documentation about syntax of this file:
# https://metacpan.org/pod/App::migrate#SYNTAX
#
# You shouldn't modify anything in this file BEFORE LAST "VERSION" LINE!
# If you will do this you'll likely BREAK DOWNGRADE for some version.
# Exceptions from this rule are:
# - git rebase
# - add/remove comments, empty lines or do other visual/formatting changes
# - add new DEFINEs
# - modification of downgrade/after_downgrade operations needed to FIX
# BROKEN DOWNGRADE
#
# You shouldn't manually add "VERSION" lines - run narada-release instead.
# Exceptions from this rule are some advanced use cases like:
# - squashing several patches into one
# - merging different release branches like 1.x and 2.x
# INSTALL
# - usually it will be automatically added by ./release, and you shouldn't
# add it manually
# - this operation must be the last one, right before VERSION - to make
# sure patch&tgz will be applied exactly between before_upgrade and
# upgrade operations, and will be reversed exactly between downgrade and
# after_downgrade operations
DEFINE2 INSTALL
before_upgrade
if test -f .release/${MIGRATE_NEXT_VERSION}.patch; then
GIT_DIR=.git git apply .release/${MIGRATE_NEXT_VERSION}.patch
fi
if test -f .release/${MIGRATE_PREV_VERSION}.tgz; then
files='m{\A[.]/\n}&&next;s/\n/\0/;s/(\\.)/"\"$1\""/gee;m{/\0}||print'
dirs='m{\A[.]/\n}&&next;s/\n/\0/;s/(\\.)/"\"$1\""/gee;m{/\0}&&print'
names=$(tar tzf .release/${MIGRATE_PREV_VERSION}.tgz)
echo "$names" | perl -ne "$files" | xargs -0 -r rm -f
echo "$names" | tac | perl -ne "$dirs" | xargs -0 -r rmdir --ignore-fail-on-non-empty
fi
if test -f .release/${MIGRATE_NEXT_VERSION}.tgz; then
tar xzvpf .release/${MIGRATE_NEXT_VERSION}.tgz
fi
narada-bg-killall
after_downgrade
if test -f .release/${MIGRATE_PREV_VERSION}.patch; then
GIT_DIR=.git git apply -R .release/${MIGRATE_PREV_VERSION}.patch
fi
if test -f .release/${MIGRATE_PREV_VERSION}.tgz; then
files='m{\A[.]/\n}&&next;s/\n/\0/;s/(\\.)/"\"$1\""/gee;m{/\0}||print'
dirs='m{\A[.]/\n}&&next;s/\n/\0/;s/(\\.)/"\"$1\""/gee;m{/\0}&&print'
names=$(tar tzf .release/${MIGRATE_PREV_VERSION}.tgz)
echo "$names" | perl -ne "$files" | xargs -0 -r rm -f
echo "$names" | tac | perl -ne "$dirs" | xargs -0 -r rmdir --ignore-fail-on-non-empty
fi
if test -f .release/${MIGRATE_NEXT_VERSION}.tgz; then
tar xzvpf .release/${MIGRATE_NEXT_VERSION}.tgz
fi
narada-bg-killall
DEFINE2 only_before_upgrade
upgrade
downgrade true
DEFINE2 only_upgrade
upgrade
downgrade true
DEFINE2 only_downgrade
upgrade true
downgrade