From 5942c48dcffc4600c389b7988c485881a8175fea Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 27 Mar 2009 07:31:11 +0100 Subject: [PATCH] lorikeet-heimdal: add scipts to rebase and import the latest version into samba4 If you use this scripts, read them! :-) metze --- import-lorikeet.sh | 171 +++++++++++++++++++++++++++++++++++++++++++++ rebase-lorikeet.sh | 103 +++++++++++++++++++++++++++ 2 files changed, 274 insertions(+) create mode 100755 import-lorikeet.sh create mode 100755 rebase-lorikeet.sh diff --git a/import-lorikeet.sh b/import-lorikeet.sh new file mode 100755 index 000000000..dbb722779 --- /dev/null +++ b/import-lorikeet.sh @@ -0,0 +1,171 @@ +#!/bin/sh +# +# Usage copy import-lorikeet.sh and rebase-lorikeet.sh +# into an empty directory maybe call it update-heimdal +# and don't use it for any other work than importing lorikeet heimdal +# into samba. +# +# You need to pass the name of the lorikeet branch +# within the heimdal/ repository as first argument. +# +# You can pass skip_fetch=yes, skip_create=yes, skip_build=yes, skip_test=yes +# as env vars +# + +DATE=`date --utc +%Y%m%d%H%M` + +lorikeet_branch="$1" +tmp_samba_branch="import-lorikeet-tmp" +new_samba_branch="import-${lorikeet_branch}" +samba_master_branch="origin/master" + +export CC="ccache gcc" + +bailout() { + exit $1; +} + +# 1. check if the heimdal repository created with rebase-lorikeet.sh already +# exist +heimdal_check() { + test -d heimdal || { + ls heimdal/ + bailout 255 + } + + test -n "$lorikeet_branch" || { + echo "usage: $0 " + bailout 1 + } + + return 0; +} + +# 2. initialize the samba repository in the samba subdir +samba_init() { + test -d samba || { + mkdir samba || bailout $? + pushd samba + git init || bailout $? + git remote add origin git://git.samba.org/samba.git + git remote add local-heimdal ../heimdal + popd + } + + return 0; +} + +# 3. bring the repository uptodate +samba_fetch() { + test x"$skip_fetch" = x"yes" || { + pushd samba + git fetch origin || bailout $? + git fetch local-heimdal || bailout $? + popd + } + + return 0; +} + +# +# It would be good if you have a lex:yacc combination which can rebuild this +# files... +# +samba_generated_files="" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/asn1/lex.c" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/asn1/parse.c" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/asn1/parse.h" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/com_err/lex.c" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/com_err/parse.c" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/com_err/parse.h" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/hx509/sel-gram.c" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/hx509/sel-gram.h" +samba_generated_files="${samba_generated_files} source4/heimdal/lib/hx509/sel-lex.c" + +build_samba() { + test x"$skip_build" = x"yes" || { + pushd source4 || return $? + ./autogen.sh || return $? + ./configure.developer || return $? + make || return $? + test x"$skip_test" = x"yes" || { + make test || return $? + } + popd + } + + return 0; +} + +samba_create() { + test x"$skip_create" = x"yes" || { + pushd samba + lorikeet_commit=`git log -1 local-heimdal/$lorikeet_branch | head -1 | cut -d ' ' -f2` + echo "local-heimdal/$lorikeet_branch => commit:$lorikeet_commit" + echo "git update-ref" + git update-ref refs/heads/$tmp_samba_branch $samba_master_branch || bailout $? + echo "git checkout" + git checkout $tmp_samba_branch || bailout $? + echo "git reset --hard HEAD" + git reset --hard HEAD + echo "git clean -d -x -f" + git clean -d -x -f + echo "git read-tree..." + git read-tree -u --prefix=source4/heimdal-new/ local-heimdal/$lorikeet_branch || bailout $? + echo "git reset --mixed HEAD" + git reset --mixed HEAD + echo "swap old -> new" + mv source4/heimdal source4/heimdal-old || bailout $? + rsync -a source4/heimdal-new/ source4/heimdal || bailout $? + echo "restore autogenerated files" + for f in ${samba_generated_files};do + echo "restore file: $f" + test -e $f && { + echo "file: $f: already exists" + bailout 255 + } + git checkout $f + done + # echo "PS1=\"'import-heimdal shell'>\"" > ../.bashrc.samba_create + # bash --rcfile ../.bashrc.samba_create + # bailout 255 + echo "add changed files to the index" + git add -u source4/heimdal + echo "commit the changed files blindly" + git commit -m "s4:heimdal: import $lorikeet_branch (commit $lorikeet_commit)" + echo "cleanup source4/heimdal" + rm -rf source4/heimdal + git checkout source4/heimdal + echo "try to build samba" + build_samba || { + echo "" + echo "Now build the tree and make it compile." + echo "Missing files can be copied from source4/heimdal-new/" + echo "Also run make test!" + } + echo "" + echo "Then do a 'git add source4/heimdal' and a 'git commit --amend'" + echo "and write a useful commit message..." + echo "Then commit all needed changes outside of source4/heimdal" + echo "maybe splitted into multiple commits." + echo "" + echo "!!!!!!!!!" + echo "" + echo "if you this shell exit with 0, then $new_samba_branch will be created" + echo "" + echo "PS1=\"'import-heimdal shell'>\"" > ../.bashrc.samba_create + bash --rcfile ../.bashrc.samba_create || bailout $? + git branch $new_samba_branch $tmp_samba_branch || bailout $? + echo "branch $new_samba_branch created" + popd + } + + return 0; +} + +heimdal_check +samba_init + +samba_fetch +samba_create + diff --git a/rebase-lorikeet.sh b/rebase-lorikeet.sh new file mode 100755 index 000000000..270f6d28b --- /dev/null +++ b/rebase-lorikeet.sh @@ -0,0 +1,103 @@ +#!/bin/sh +# +# Usage copy import-lorikeet.sh and rebase-lorikeet.sh +# into an empty directory maybe call it update-heimdal +# and don't use it for any other work than importing lorikeet heimdal +# into samba. +# +# These parameter might be changed: +# +# heimdal_my_wip_name +# heimdal_my_wip_url +# old_lorikeet_branch +# +# you can pass skip_fetch=yes and/or skip_rebase=yes as env vars +# + +# this needs to be reachable from +old_lorikeet_branch=$1 + +DATE=`date --utc +%Y%m%d%H%M` + +heimdal_my_wip_name="heimdal-my-wip" +heimdal_my_wip_url="git://git.samba.org/metze/heimdal/wip.git" + +if test x"$old_lorikeet_branch" = x""; then + old_lorikeet_branch="heimdal-metze-wip/lorikeet-heimdal" +fi + +tmp_lorikeet_branch="lorikeet-heimdal-tmp" +new_lorikeet_branch="lorikeet-heimdal-${DATE}" + +bailout() { + exit $1; +} + +# 1. create a local heimdal repository in the heimdal subdir + +heimdal_init() { + test -d heimdal || { + mkdir heimdal || bailout $? + pushd heimdal + git init || bailout $? + git remote add heimdal-svnmirror git://git.samba.org/metze/heimdal/svnmirror.git + git remote add heimdal-metze-wip git://git.samba.org/metze/heimdal/wip.git + git remote add ${heimdal_my_wip_name} ${heimdal_my_wip_url} + popd + } + + return 0; +} + +# 2. bring the repository uptodate +heimdal_fetch() { + test x"$skip_fetch" = x"yes" || { + pushd heimdal + git fetch heimdal-svnmirror || bailout $? + git fetch heimdal-metze-wip || bailout $? + git fetch ${heimdal_my_wip_name} || bailout $? + popd + } + + return 0; +} + +# 3. rebase the old_lorikeet_branch on top of heimdals trunk +heimdal_rebase() { + test x"$skip_rebase" = x"yes" || { + pushd heimdal + echo "git update-ref" + git update-ref refs/heads/$tmp_lorikeet_branch $old_lorikeet_branch || bailout $? + echo "git checkout" + git checkout $tmp_lorikeet_branch || bailout $? + echo "git reset --hard HEAD" + git reset --hard HEAD + echo "git rebase" + git rebase heimdal-svnmirror/trunk || { + echo "PS1=\"'git-rebase shell'>\"" > ../.bashrc.heimdal_rebase + bash --rcfile ../.bashrc.heimdal_rebase || { + ret=$? + echo "git rebase --abort (just in case)" + git rebase --abort + bailout $ret + } + } + echo "git rebase --abort (just in case)" + git rebase --abort + echo "Now build and test the lorikeet heimdal tree" + echo "and exit with 0 if you want to create a $new_lorikeet_branch branch" + echo "" + echo "PS1=\"'build shell'>\"" > ../.bashrc.heimdal_build + bash --rcfile ../.bashrc.heimdal_build || bailout $? + git branch $new_lorikeet_branch $tmp_lorikeet_branch || bailout $? + echo "branch $new_lorikeet_branch created" + popd + } + + return 0; +} + +heimdal_init +heimdal_fetch +heimdal_rebase + -- 2.34.1