3 # Usage copy import-lorikeet.sh and rebase-lorikeet.sh
4 # into an empty directory maybe call it update-heimdal
5 # and don't use it for any other work than importing lorikeet heimdal
8 # You need to pass the name of the lorikeet branch
9 # within the heimdal/ repository as first argument.
11 # You can pass skip_fetch=yes, skip_create=yes, skip_build=yes, skip_test=yes
15 DATE=`date --utc +%Y%m%d%H%M`
18 tmp_samba_branch="import-lorikeet-tmp"
19 new_samba_branch="import-${lorikeet_branch}"
20 samba_master_branch="$2"
21 test -n "$samba_master_branch" || {
22 samba_master_branch="origin/master"
25 export CC="ccache gcc"
31 # 1. check if the heimdal repository created with rebase-lorikeet.sh already
39 test -n "$lorikeet_branch" || {
40 echo "usage: $0 <lorikeet-branch> [<samba-branch>]"
47 # 2. initialize the samba repository in the samba subdir
50 mkdir samba || bailout $?
52 git init || bailout $?
53 git remote add origin https://git.samba.org/samba.git
54 git remote add local-heimdal ../heimdal
61 # 3. bring the repository uptodate
63 test x"$skip_fetch" = x"yes" || {
65 git fetch origin || bailout $?
66 git fetch local-heimdal || bailout $?
74 # It would be good if you have a lex:yacc combination which can rebuild this
79 test x"$skip_build" = x"yes" || {
80 ./configure.developer || return $?
82 test x"$skip_test" = x"yes" || {
83 TDB_NO_FSYNC=1 make -j test || return $?
91 test x"$skip_create" = x"yes" || {
93 lorikeet_commit=`git log -1 local-heimdal/$lorikeet_branch | head -1 | cut -d ' ' -f2`
94 echo "local-heimdal/$lorikeet_branch => commit:$lorikeet_commit"
96 git update-ref refs/heads/$tmp_samba_branch $samba_master_branch || bailout $?
98 git checkout $tmp_samba_branch || bailout $?
99 echo "git reset --hard HEAD"
100 git reset --hard HEAD
101 echo "git clean -d -x -f"
103 echo "git read-tree..."
104 git read-tree -u --prefix=source4/heimdal-new/ local-heimdal/$lorikeet_branch || bailout $?
105 echo "git reset --mixed HEAD"
106 git reset --mixed HEAD
107 echo "swap old -> new"
108 mv source4/heimdal source4/heimdal-old || bailout $?
109 rsync -a source4/heimdal-new/ source4/heimdal || bailout $?
110 echo "restore autogenerated files (run lexyacc.sh)"
113 heimdal_build/lexyacc.sh
114 git add heimdal/lib/asn1/asn1parse.c heimdal/lib/asn1/asn1parse.h
117 # echo "PS1=\"'import-heimdal shell'>\"" > ../.bashrc.samba_create
118 # bash --rcfile ../.bashrc.samba_create
120 echo "add changed files to the index"
121 git add -u source4/heimdal
122 echo "commit the changed files blindly"
123 git commit --no-verify -m "s4:heimdal: import $lorikeet_branch (commit $lorikeet_commit)"
124 echo "cleanup source4/heimdal"
125 rm -rf source4/heimdal
126 git checkout source4/heimdal
127 echo "try to build samba"
130 echo "Now build the tree and make it compile."
131 echo "Missing files can be copied from source4/heimdal-new/"
132 echo "Also run make test!"
135 echo "Then do a 'git add source4/heimdal' and a 'git commit --amend'"
136 echo "and write a useful commit message..."
137 echo "Then commit all needed changes outside of source4/heimdal"
138 echo "maybe splitted into multiple commits."
142 echo "if you this shell exit with 0, then $new_samba_branch will be created"
144 echo "PS1=\"'import-heimdal shell'>\"" > ../.bashrc.samba_create
145 bash --rcfile ../.bashrc.samba_create || bailout $?
146 git branch $new_samba_branch $tmp_samba_branch || bailout $?
147 echo "branch $new_samba_branch created"