User:Gekacheka:JarScripts

From MozillaWiki
Jump to: navigation, search
# One way to patch calendar source files and create Calendar jars
# without downloading the whole source tree and doing a full make
# (which requires purchasing MSVC on w2k).
# Uses cygwin commands on w2k.
#
# Commands needed (bash, cvs, file utils, diff, patch, zip):
#   bash: command and script interpreting shell
#   pushd: change directory, pushing previous directory path on stack
#   popd:  pop directory path from stack and change to that directory
#   mkdir: create directory
#   rm -r: remove directory and recursively its contents
#   cp -r: copy directory and recursively its contents
#   cvs: retrieve source files from version control server
#   zip: create jar file
#   diff: create a patch file describing changes
#   patch: apply a patch file
# 1. put sources in own directory separate from any existing mozilla directory
cd cvs0
# remove old copy if any
# -r: recursively remove directory files and subdirectories
rm -r mozilla
# 2a. get trunk
# -z3: compress during transit
$ cvs -z3 -d ":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" export -D "`date '+%Y-%m-%d %H:%M:%S %z'`" mozilla/calendar/resources mozilla/calendar/sunbird/base mozilla/calendar/sunbird/themes
# 2b. or get SUNBIRD_0_2_BRANCH
#cvs -z3 -d ":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" export -r SUNBIRD_0_2_BRANCH -D "`date '+%Y-%m-%d %H:%M:%S %z'`" mozilla/calendar/resources mozilla/calendar/sunbird/base mozilla/calendar/sunbird/themes
# 3. Copy result to another directory, e.g., so original is in cvs0/ and copy in cvs1/
# mkdir ../cvs1
# cp -r mozilla ../cvs1/
# 4. Modify copy in cvs1/.  
# 5. Make extension calendar.jar using makeCalJar.sh
# cd cvs1
# ../makeCalJar.sh
# 6a. Move new extension calendar.jar to replace old Mozilla calendar.jar
mv calendar.jar ../Mozilla/chrome/calendar.jar
# 6b. Move new extension calendar.jar to replace old Thunderbird calendar.jar
# On w2k, ${APPDATA} should be 
#   C:/Documents and Settings/${USERNAME}/Application Data
# Replace NNNNNNNN.slt with randomized name found in your filesystem.
#mv calendar.jar ${APPDATA}/Thunderbird/Profiles/default/NNNNNNNN.slt/extensions/{8e117890-a33f-424b-a2ea-deb272731365}/chrome/calendar.jar
# 6c. Move new extension calendar.jar to replace old Firefox calendar.jar
# On w2k, ${APPDATA} should be 
#   C:/Documents and Settings/${USERNAME}/Application Data
# Replace default.NNN with randomized name found in your filesystem.
#mv calendar.jar ${APPDATA}/Mozilla/Firefox/profiles/default.NNN/extensions/{8e117890-a33f-424b-a2ea-deb272731365}/chrome/calendar.jar
# 7. Run calendar and test modified jars.
# Repeat steps 4-7 until it works.
# 8. When changes work, make patch of all changes as below.
# Note some paths have "../cvs1/" prefix, so running patch needs "-p 2".
cd ../cvs0
diff -dbru8tpP -x "*[#~]" mozilla ../cvs1/mozilla >../bugNNNNN.patch
# 6. View patch in emacs (text editor) to verify it has no unnecessary changes.
# 7. test patch
# (note: "-p 2" works where "--strip=2" fails in patch2.5.8)
# -l: ignores space differences on a line such as spaces vs. tabs, 
#     or \r\n vs \n, or different indentation.
patch --dry-run -l -p 2 -i ../bugNNNNN.patch
# 8. In Bugzilla, upload patch as attachment to bug.
# NOTES
#
# emacs note: be sure current-language-environment is "UTF-8" when editing
# dtd files (menu Options | Mule | Set Language Environment)
# A 'u' should appear in the mode line while editing the file.
#
# emacs note: be sure file coding system is "Unix" (\n end-of-line,
# not "DOS" (\r\n end-of-line).  "Unix" should appear in the mode
# line, not "\".  Emacs should recognize the coding system for
# existing files.  For new files or after ediff-merge,
# use set-buffer-file-coding-system:
#   (menu Options | Mule | Set Coding Systems | For saving this buffer)
#   utf-8-unix
# or: (C-x C-m f) utf-8-unix
# Ok to use unix instead of utf-8-unix if file has only US-ASCII characters.
# 
# diff note: if diff'ing individual files by name, make sure capitalization
# is exactly the same.  If you give a different capitalization, w2k will
# find the file for reading, but it will be written with the wrong name.
# For example, patch may read weekView.xul (uppercase 'v'), but write
# weekview.xul (lowercase 'v'), so weekView.xul (uppercase 'v') won't be
# found in jar.
#
# cvs note: CVSROOT=":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot"
# fails, maybe cvs has problems on windows
#
# cvs note: update cvs0 as below fails with "no such directory 'mozilla/calendar' "
#cvs -z3 -d ":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" update -P -D "`date '+%Y-%m-%d %H:%M:%S %z'`" mozilla/calendar/resources mozilla/calendar/sunbird/base mozilla/calendar/sunbird/themes