You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by wa...@apache.org on 2020/10/31 21:01:48 UTC

[openoffice-org] branch main updated: Prepared most of the migration scripting.

This is an automated email from the ASF dual-hosted git repository.

wave pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openoffice-org.git


The following commit(s) were added to refs/heads/main by this push:
     new ddc96ae  Prepared most of the migration scripting.
ddc96ae is described below

commit ddc96ae60cbbe29ee9ae27e7bff26c767ccbfdc3
Author: Dave Fisher <da...@davefisher.tech>
AuthorDate: Sat Oct 31 14:00:42 2020 -0700

    Prepared most of the migration scripting.
---
 templates/page.gsp                      |   2 +-
 tools/{readme.txt => README-TO-CMS.txt} |   0
 tools/README.md                         | 143 ++++++++++++++++++++++++++++++++
 tools/convert2md.sh                     |  32 +++++++
 tools/migration2git.sh                  |  67 +++++++++++++++
 tools/push2git.sh                       |  34 ++++++++
 6 files changed, 277 insertions(+), 1 deletion(-)

diff --git a/templates/page.gsp b/templates/page.gsp
index e6bbafe..889cc76 100644
--- a/templates/page.gsp
+++ b/templates/page.gsp
@@ -1,7 +1,7 @@
 <%
   // from jbake - content.file, content.uri and content.body
   // from page metadata - content.title and content.css
-  if ( content.file.endsWith(".html") ) {
+  if ( content.file.endsWith(".html") || content.file.endsWith(".htm") ) {
     // using content.body if html get content.header, content.bodytag, and content.extracted_body
     include "html_extract.gsp"
   }
diff --git a/tools/readme.txt b/tools/README-TO-CMS.txt
similarity index 100%
rename from tools/readme.txt
rename to tools/README-TO-CMS.txt
diff --git a/tools/README.md b/tools/README.md
new file mode 100644
index 0000000..519c262
--- /dev/null
+++ b/tools/README.md
@@ -0,0 +1,143 @@
+== Editing the Git Site
+
+1. Clone the Git Repository
+
+```
+cd ~/Development/openoffice
+rm -rf ooo-site.git
+git clone https://gitbox.apache.org/repos/asf/openoffice-org.git ooo-site.git
+git fetch
+git pull
+git checkout main
+```
+
+2. Modify Pages
+
+```
+cd ~/Development/openoffice/ooo-sit.git/content/
+```
+
+* Html pages are `*.html` and `*.htm`
+  - Full html pages are rewrapped.
+  - Html fragments are wrapped.
+* Markdown pages are `*.md`
+* Special purpose Markdown which also need to be delcared in `templates/ssi_paths.gsp`
+  - `brand.md` are specialised translations for the website header.
+  - `topnav.md` is the top navigator.
+  - `leftnav.md` is the left navigator.
+  - `rightnav.md` is the right naviagator
+
+3. Modify Assets
+
+```
+cd ~/Development/openoffice/ooo-sit.git/assets/
+```
+
+* These are copied to the site unmodified.
+
+== Migration Instructions
+
+1. Checkout Old SVN CMS version of site.
+
+```
+cd ~/Development/openoffice
+rm -rf ooo-site
+svn co https://svn.apache.org/repos/asf/openoffice/ooo-site/trunk ooo-site
+```
+
+1. Setup Environment variables.
+
+```
+# location of CMS content
+export SVNPATH="~/Development/openoffice/ooo-site/content"
+# location of Git repository checkout
+export GITPATH="~/Development/openoffice/ooo-site.git"
+```
+
+2. List of Folders.
+   It is likely that these won't be done in one session. Make the list and track what you've migrated.
+
+```
+cd ${SVNPATH}
+find . -type d -depth 1 -print | sed -e 's!./!!' | sort
+```
+
+You could compare with the git targets with:
+
+```
+cd ${GITPATH}/assets
+find . -type d -depth 1 -print | sed -e 's!./!!' | sort
+cd ${GITPATH}/content
+
+3. Migration of a Folder.
+
+```
+cd ${SVNPATH}
+${GITPATH}/tools/migration2git.sh downloads
+```
+
+== Tool Scripts
+
+1. tools/push2git.sh ${1} ${2} ${3}
+
+```
+# ${1} Category 'assets','content'
+# ${2} Path to commit
+# ${3} Description for commit message - 'assets','large asset','html content','Markdown pages','brand','navigator'
+cd ${GITPATH}
+git add ${1}/${2}
+git commit -m 'Migration of ${2} ${3}'
+git push
+```
+
+2. tools/convert2md.sh ${1} ${2}
+```
+# ${1} Template type 'brand','navigator','page'
+# ${2} Path of mdtext file to convert to md file
+echo 'type=${1}' > ${GITPATH}/content/${2}
+nawk -f ${GITPATH}/tools/convert2md.awk ${2} >> ${GITPATH}/content/${2}
+```
+
+3. tools/migration2git.sh ${1}
+
+```
+# ${1} Site folder to migrate
+cd ${SVNPATH}
+echo 'Migrating ${SVNPATH}/${1} to ${GITPATH}
+echo
+# 1 - Tree structure
+echo 'copy directory structure to assets and content trees'
+find ${1} -type d ! -empty -exec mkdir -p ${GITPATH}/assets/{} \; -exec mkdir -p ${GITPATH}/content/{} \;
+# git does not commit empty directories
+echo
+# 2 - Large Assets
+echo 'copy assets larger than 3M as separate commits'
+find ${1} -type f -size +3M -exec cp {} ${GITPATH}/assets/{} \; -exec ${GITPATH}/tools/push2git.sh assets {} 'large asset'\; 	
+echo
+# 3 - Assets
+echo 'copy assets not (html and mdtext) to assets tree'
+find ${1} -type f ! -name "*.html" ! -name "*.htm" ! -name "*.mdtext" ! -size +3M -exec cp -p {} ${GITPATH}/assets/{} \;
+# commit and push
+${GITPATH}/tools/push2git.sh assets ${1} 'assets'
+echo
+# 4 - HTML
+echo 'copy html to content tree'
+find ${1}  -type f \( -name "*.html" -or -name "*.htm" \) ! -size +3M -exec cp -p {} ${GITPATH}/content/{} \;
+# commit and push
+${GITPATH}/tools/push2git.sh content ${1} 'html content'
+echo
+# 5 - Brand
+echo 'Convert brand'
+find ${1} -name "brand.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh brand {} \; -exec ${GITPATH}/tools/push2git.sh assets {} 'brand'\;
+echo
+# 6 - Navigators
+echo 'Convert navigators'
+find ${1} -name "*nav.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh navigator {} \; -exec ${GITPATH}/tools/push2git.sh assets {} 'navigator'\;
+echo
+# 7 - Markdown
+echo 'Convert markdown pages'
+find ${1} -name "*.mdtext" ! -name "brand.mdtext" ! -name "*nav.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh page {} \;
+# commit and push
+${GITPATH}/tools/push2git.sh content ${1} 'Markdown pages'
+echo
+```
diff --git a/tools/convert2md.sh b/tools/convert2md.sh
new file mode 100755
index 0000000..e23ed0f
--- /dev/null
+++ b/tools/convert2md.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# tools/convert2md.sh ${1} ${2}
+# ${1} Template type 'brand','navigator','page'
+# ${2} Path of mdtext file to convert to md file
+
+if test "$#" != 2; then
+  echo "USAGE: $0 Type Path
+  exit 1
+fi
+
+echo 'type=${1}' > ${GITPATH}/content/${2}
+nawk -f ${GITPATH}/tools/convert2md.awk ${2} >> ${GITPATH}/content/${2}
+
diff --git a/tools/migration2git.sh b/tools/migration2git.sh
new file mode 100755
index 0000000..875c958
--- /dev/null
+++ b/tools/migration2git.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# tools/migration2git.sh ${1}
+# ${1} Site folder to migrate
+
+if test "$#" != 1; then
+  echo "USAGE: $0 Folder
+  exit 1
+fi
+
+cd ${SVNPATH}
+echo 'Migrating ${SVNPATH}/${1} to ${GITPATH}
+echo
+# 1 - Tree structure
+echo 'copy directory structure to assets and content trees'
+find ${1} -type d ! -empty -exec mkdir -p ${GITPATH}/assets/{} \; -exec mkdir -p ${GITPATH}/content/{} \;
+# git does not commit empty directories
+echo
+# 2 - Large Assets
+echo 'copy assets larger than 3M as separate commits'
+find ${1} -type f -size +3M -exec cp {} ${GITPATH}/assets/{} \; -exec ${GITPATH}/tools/push2git.sh assets {} 'large asset'\; 	
+echo
+# 3 - Assets
+echo 'copy assets not (html and mdtext) to assets tree'
+find ${1} -type f ! -name "*.html" ! -name "*.htm" ! -name "*.mdtext" ! -size +3M -exec cp -p {} ${GITPATH}/assets/{} \;
+# commit and push
+${GITPATH}/tools/push2git.sh assets ${1} 'assets'
+echo
+# 4 - HTML
+echo 'copy html to content tree'
+find ${1}  -type f \( -name "*.html" -or -name "*.htm" \) ! -size +3M -exec cp -p {} ${GITPATH}/content/{} \;
+# commit and push
+${GITPATH}/tools/push2git.sh content ${1} 'html content'
+echo
+# 5 - Brand
+echo 'Convert brand'
+find ${1} -name "brand.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh brand {} \; -exec ${GITPATH}/tools/push2git.sh assets {} 'brand'\;
+echo
+# 6 - Navigators
+echo 'Convert navigators'
+find ${1} -name "*nav.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh navigator {} \; -exec ${GITPATH}/tools/push2git.sh assets {} 'navigator'\;
+echo
+# 7 - Markdown
+echo 'Convert markdown pages'
+find ${1} -name "*.mdtext" ! -name "brand.mdtext" ! -name "*nav.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh page {} \;
+# commit and push
+${GITPATH}/tools/push2git.sh content ${1} 'Markdown pages'
+echo
+
diff --git a/tools/push2git.sh b/tools/push2git.sh
new file mode 100755
index 0000000..61ba3c9
--- /dev/null
+++ b/tools/push2git.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# tools/push2git.sh ${1} ${2} ${3}
+# ${1} Category 'assets','content'
+# ${2} Path to commit
+# ${3} Description for commit message - 'assets','large asset','html content','Markdown pages','brand','navigator'
+
+if test "$#" != 3; then
+  echo "USAGE: $0 Category Path Description
+  exit 1
+fi
+
+cd ${GITPATH}
+git add ${1}/${2}
+git commit -m 'Migration of ${2} ${3}'
+git push