Hi Mike,

I did not verify anything, but could you please post your message as a comment 
in 
https://cwiki.apache.org/confluence/display/OFBIZ/SVN+Tips+-+svn_load_dirs+Vendor+Branch
You can also put your attachment there

Thanks

Jacques
  ----- Original Message ----- 
  From: Mike 
  To: user@ofbiz.apache.org 
  Sent: Thursday, March 17, 2011 8:19 AM
  Subject: How to setup a simple ofbiz vendor branch


  ----------------------------------
  SETUP A SIMPLE OFBIZ VENDOR BRANCH
  ----------------------------------


  I went through the pain of setting up a "vendor branch" of ofbiz, so I 
thought I'd share it with the community.  The supplied instructions in the wiki 
seemed confusing, and didn't go into detail.  Since I'm into automation, my 
script (svn_local.sh) allows the following:


  Keep a local copy of ofbiz (trunk|0904|1004), allow it to be modified, but at 
the same time have the ability to receive upstream updates from the Apache 
Ofbiz SVN server, and merge them into your own local copy.  For the most part, 
this works automatically.


  The attached ofbiz_vendor_branch.tar.gz has the script.


  To clarify, I'm not a subversion expert, so my setup is ultra simple, 
anonymous read/write, no password, etc.  My svn server is safely behind a 
firewall, so I'm not worried about multi users, passwords, hackers, etc.  This 
works for me because I'm a one man show.  Your requirements are probably 
different.


  To get started, we need to keep local copies of the following:


  http://svn.apache.org/repos/asf/ofbiz/trunk  --or--
  http://svn.apache.org/repos/asf/ofbiz/branches/release09.04  --or--
  http://svn.apache.org/repos/asf/ofbiz/branches/release10.04  --or-- all three!


  These are always kept up to date via "svn update", and are kept in 
/opt/ofbiz.svn.


  The script (svn_local.sh) allows all three (or more in the future) branches 
to be tracked.  For me, the best branch for deployment is trunk, because it 
seems to be the most stable, and gets more attention from the developers.  For 
the purpose of this setup, I'm just going focus on trunk, but tracking 0904 or 
1004 (or all three) is as easy as tweaking a variable (in svn_local.sh).


  The Apache and Local versions are kept in /opt/ofbiz.svn, and are named:


  /opt/ofbiz.svn/asf.ofbiz.0904
  /opt/ofbiz.svn/asf.ofbiz.1004
  /opt/ofbiz.svn/asf.ofbiz.trunk


  The "local" copies are called.
  /opt/ofbiz.svn/opt.ofbiz.0904
  /opt/ofbiz.svn/opt.ofbiz.1004
  /opt/ofbiz.svn/opt.ofbiz.trunk


  NOTE: Regarding this path (/opt/ofbiz.svn).  For simplicity, use the same 
path (at least initially).  The script resides in the "/opt/ofbiz.svn/bin" 
directory, and will always place the above checked out directories one level 
above the script (in /opt/ofbiz.svn).


  Also, this script runs on an Ubuntu host, I've never tried to run this on 
windows.  However, It might work under cygwin.


  Internally (within the local SVN repository), the directories are organized 
like this:


  ofbiz/
  ofbiz/asf/
  ofbiz/asf/ofbiz.1004
  ofbiz/asf/ofbiz.trunk
  ofbiz/opt/
  ofbiz/opt/ofbiz.1004
  ofbiz/opt/ofbiz.trunk


  NOTE: If you already have an SVN repository, then I'd fully analyze/test this 
process (on a separate machine) to see if it "fits" into your local SVN 
repository w/o clobbering your own stuff.  If you have "ofbiz" at the top of 
your SVN tree (like above), then there may be issues.  You have been warned!


  These directories are strictly used to track changes to the local 
repositories.  Your actual names (when you check out a working copy) could be 
different.  In my case, when I check out the working local copy, I place it in 
/opt/ofbiz.[version], and this is where I actually fire up ofbiz from (later).


  You could tweak these names, but this will require hacking the script, and it 
is not recommended, at least until you understand how it works.


  The attached tar file contains the following items:


  # tar ztvf ofbiz_vendor_branch.tar.gz
  drwxr-xr-x root/root         0 2011-03-16 10:38 opt/ofbiz.svn/bin/
  -rwxr-xr-x root/root      6478 2011-03-16 09:36 opt/ofbiz.svn/bin/svn_local.sh
  -rw-r--r-- root/root      9630 2009-05-12 10:25 
opt/ofbiz.svn/bin/svn_load_dirs.README
  -rw-r--r-- root/root      7201 2011-03-16 10:12 opt/ofbiz.svn/bin/config
  -rw-r--r-- root/root      7201 2011-03-16 10:12 opt/ofbiz.svn/bin/README
  -rwxr-xr-x root/root     67335 2010-08-27 18:50 
opt/ofbiz.svn/bin/svn_load_dirs.pl
  -rwxr-xr-x root/root       436 2010-09-06 11:36 opt/ofbiz.svn/bin/svnserv
  #


  Here are the contents:
  --------------------------------------------------------------
  /opt/ofbiz.svn/bin/svnserv (used to fire up the SVN daemon)
  /opt/ofbiz.svn/bin/svn_load_dirs.pl (NOT written by me)
  /opt/ofbiz.svn/bin/svn_local.sh (MY script, that automates all)
  /opt/ofbiz.svn/bin/config (SVN client config file, discussed later)
  /opt/ofbiz.svn/bin/README (These docs)
  --------------------------------------------------------------


  NOTE: The svn_load_dirs.pl (part of Apache) is a perl script which magically 
merges the various repositories.  This one works for me, so I provided it.  It 
DOES require various perl modules that must be satisfied so it properly works.


  To get started, you will need your own SVN repository.  Here are the steps.


  --------------------------------------------------------------
  STEP 1) Create your own local SVN repository
  --------------------------------------------------------------
  # mkdir -p /var/svn/repos
  # svnadmin create /var/svn/repos


  I suggest you use /var/svn/repos, it will make it easier, and my script uses 
it (later).


  --------------------------------------------------------------
  STEP 2) Tweak SVN for anonymous read-write
  --------------------------------------------------------------
  # vi /var/svn/repos/conf/svnserv.conf


  [general]
  anon-access = write
  auth-access = write
  password-db = passwd


  Copy /opt/ofbiz.svn/bin/svnserv into /etc/init.d (unless you don't already 
have one), and fire up the svnserv init script.  You may have to tweak it 
(works for Ubuntu).


  # cp /opt/ofbiz.svn/bin/svnserv /etc/init.d
  # /etc/init.d/svnserv start


  Make sure it's running.


  /# ps -efww|grep svn
  root      6436     1  0 18:47 ?        00:00:00 svnserve -d -r /var/svn/repos


  --------------------------------------------------------------
  STEP 3) Copy the client config to the proper location.
  --------------------------------------------------------------
  NOTE:  The svn client config needs to be copied to the home directory of the 
user who runs the svn command.  In this case, probably /root/.subversion/config 
 --or-- place it in (again Ubuntu) /etc/subversion/config, which would make it 
available to all users on that machine.  Also, if you plan on running ofbiz on 
a different machine, then you need to make sure this 'config' file is on all 
machines.  so:


  # cp /opt/ofbiz.svn/bin/config /root/.subversion/config --or--
  # cp /opt/ofbiz.svn/bin/config /etc/subversion/config


  --------------------------------------------------------------
  STEP 4) Create a "svn" DNS entry for your local domain (optional)
  --------------------------------------------------------------
  If you have your own local area network and your own DNS server, it is good 
practice to create a "svn" host, which is an alias to the host where the local 
SVN repository exists.  For instance, if your local domain is "internal.net", 
create "svn.internal.net", which points to the real host.


  --------------------------------------------------------------
  STEP 5) Untar the attached tar file from the root directory
  --------------------------------------------------------------
  # cd /
  # tar zxvf /root/download/ofbiz_vendor_branch.tar.gz


  --------------------------------------------------------------
  STEP 6) Configure the script (choose trunk/branches)
  --------------------------------------------------------------
  # cd /opt/ofbiz.svn/bin
  # vi svn_local.sh


  Set the variables ofbiz_versions and local_svnserv.


  Variable: ofbiz_versions


  All three Ofbiz versions (NOT recommended)
  ofbiz_versions="trunk:trunk branches/release10.04:1004 
branches/release09.04:0904"


  Trunk+1004 (also not really recommended)
  ofbiz_versions="trunk:trunk branches/release10.04:1004"


  Just Trunk:
  ofbiz_versions="trunk:trunk"


  Just 1004:
  ofbiz_versions="branches/release10.04:1004"


  The item on the right side of the colon will be used to create the name of 
the directory entry.  For instance, you check out the branch 
"branches/release10.04" and it create a directory called "opt.ofbiz.1004".


  If you choose to track multiple branches (not recommended), then your local 
SVN server will get pretty fat (and slow).  Beware.


  Variable: local_svnserv


  local_svnserv="svn://svn.internal.net"
  #local_svnserv="svn://svn"
  #local_svnserv="file:///var/svn/repos"


  Choose the way you want to access you own local repository.  If you followed 
the above directions, then you already have the svnserv daemon running. The 
first one is using the DNS name (so is the second, but there is an 
/etc/resolv.conf that has "search internal.net" defined).  This is really the 
recommended way of accessing a local SVN server.  You can then check out the 
code from ANY machine on your local area network.  If you are running on just a 
single machine, then you COULD use the "file:///..." method, which is fast (and 
least flexible).


  --------------------------------------------------------------
  STEP 7) Run the svn_load_dirs.pl utility to make sure it works
  --------------------------------------------------------------
  # cd /opt/ofbiz.svn/bin
  # ./svn_load_dirs.pl


  Look for any perl modules missing, and satisfy the requirements.  You should 
get the help syntax of the script.


  On Ubuntu, you can do a bunch of "apt-get install ITEM" to satisfy the perl 
module, or you could use the CPAN method, which consists of a bunch of:


  perl -MCPAN -e "install Digest::MD5"


  Statements until the script is happy.  Don't attempt STEP 8 until 
svn_load_dirs.pl is happy.


  ALSO:  Check svn_load_dirs.pl and verify line 32:


  my $svn = '/usr/bin/svn';


  Points to the correct svn binary (above is Ubuntu).


  # vi svn_load_dirs.pl


  --------------------------------------------------------------
  STEP 8) Run svn_local.sh in "init" mode
  --------------------------------------------------------------
  NOTE:  Don't forget STEP 3 (svn client "config") or you'll have problems with 
the next step.


  # cd /opt/ofbiz.svn/bin
  # ./svn_local.sh init
  [lots of output]


  NOTE:  This is only done ONCE (with "init"), to initially populate the 
repository.


  The script is in debug mode (during init) in case any problems occur.


  --------------------------------------------------------------
  STEP 9) Checkout the "local" (running) branch of the ofbiz repository you want
  --------------------------------------------------------------
  Decide where you want to run ofbiz.  /opt always works for me.


  # trunk example
  # cd /opt
  # svn co svn://SVN_SERVER/ofbiz/opt/ofbiz.trunk/trunk/ ofbiz.trunk --or--
  # svn co file:///var/svn/repos/ofbiz/opt/ofbiz.trunk/trunk/ ofbiz.trunk


  NOTE:  The right argument is the directory that will be created.  You can 
name it
  anything you want.  I recommend ofbiz.[trunk|branch] to match SVN.


  # 10.04 example
  # cd /opt
  # svn co svn://SVN_SERVER/ofbiz/opt/ofbiz.1004/trunk/ ofbiz.1004 --or--
  # svn co file:///var/svn/repos/ofbiz/opt/ofbiz.1004/trunk/ ofbiz.1004
  ....
  A    ofbiz.trunk/ivy.xml
  A    ofbiz.trunk/startofbizBoth.bat
  A    ofbiz.trunk/KEYS
  A    ofbiz.trunk/rc.ofbiz
  A    ofbiz.trunk/startofbizPos.bat
  Checked out revision 11.
  #


  Notice that even for 1004, you still checkout the "trunk" of the local 1004 
repository


  --------------------------------------------------------------
  STEP 10) Check things out, test, etc.
  --------------------------------------------------------------
  Change directory, and run "svn info" You should see a low revision #, like 11.


  # cd /opt/ofbiz.trunk; svn info; svn log


  The "Last Changed Rev:" is probably r11.  The log should show "Initial 
import...."


  --------------------------------------------------------------
  STEP 11) Change something, commit changes to your local repository
  --------------------------------------------------------------
  # cd /opt/ofbiz.trunk/hot-deploy
  # mkdir newapp
  # svn add newapp
  A       newapp
  # svn commit
  --------------------------------------------------------------
  This is a newapp in hot-deploy
  --This line, and those below, will be ignored--


  A    hot-deploy/newapp
  --------------------------------------------------------------
  Adding         hot-deploy/newapp


  Committed revision 12.


  --------------------------------------------------------------
  STEP 12)  Run updates from Apache OFBIZ, and "merge" changes into your local 
repo.
  --------------------------------------------------------------
  Sometime later, after the developers tweaked something in trunk, run the 
following:


  # cd /opt/ofbiz.svn/bin
  # ./svn_local.sh


  If nothing changed, then you'll see:
  --------------------------------------------------------------
  NOTE: FOUND svn_load_dirs.pl in [/opt/ofbiz.svn/bin/svn_load_dirs.pl]
  Remote ASF: http://svn.apache.org/repos/asf/ofbiz/trunk
  Local  ASF: svn://svn/ofbiz/asf/ofbiz.trunk
  Local  OFB: svn://svn/ofbiz/opt/ofbiz.trunk


  http://svn.apache.org/repos/asf/ofbiz/trunk Revision: 1082281
  Last Changed Revisions:  Last:1082281 Current:1082281
  Repository revisions match
  #
  --------------------------------------------------------------
  Otherwise, you'll lots of magical output that hopefully ends up with your 
local svn repository opt.ofbiz.[trunk|branch] updated with fresh 
patches/changes from Ofbiz being merged into your own changes being made 
locally.


  This works automatically for the most part, but on occasion you may have a 
collision when you might have to accept/reject a merge option.


  The script also creates directories like this:


  /opt/ofbiz.svn/asf.ofbiz.trunk.1079456
  /opt/ofbiz.svn/asf.ofbiz.trunk.1080107
  /opt/ofbiz.svn/asf.ofbiz.trunk.1080776
  /opt/ofbiz.svn/asf.ofbiz.trunk.1081185


  Which are checked out versions of trunk.  These can be blown away if you 
like, but I like them because I can do stuff like "diffing" between revisions:


  diff -r asf.ofbiz.trunk.1081444 asf.ofbiz.trunk.1081740


  --------------------------------------------------------------
  STEP 13) Update your local (running) copy of ofbiz with the latest changes.
  --------------------------------------------------------------
  Suppose you (like me) run the "running" version of ofbiz in /opt/ofbiz.trunk, 
which you checked out in STEP 9.


  You run the update/merge process:


  # cd /opt/ofbiz.svn/bin
  # ./svn_local.sh
  [lots of output]


  Even though you did the above steps, the copy you are running in 
/opt/ofbiz.trunk is STILL running the old code.  You must also update your 
running (checked out) code, like this:


  # cd /opt/ofbiz.trunk
  # svn update
  ....... update statements ............


  /etc/init.d/ofbiz.trunk restart ... etc..


  Thats it.  If you have problems initially creating the repository, make sure 
you followed STEP #3.  You can always blow away the /var/svn/repos, and re-init.


  If any errors show up, you can always un-comment line #6 "set -x" to show the 
debug steps.


  If you already have a modified ofbiz directory that you want to merge into 
this process, then that will be tricky, and a lot more work.  However, you 
could probably do it like this:


  Run the above procedure, checking out a new code branch (like in STEP 9).  
You then need to detect the changes between your existing, running code and 
copy each modified (or missing) file/directory (i.e., one by one into the 
checked out directory (/opt/ofbiz.trunk).  Then, just:


  # cd /opt/ofbiz.trunk
  # svn commit


  I hope this helps someone.  Good luck!!

Reply via email to