diff --git a/HISTORY.rst b/HISTORY.rst index f46932aa1dccc7c94bccd0ea01c3fe697c76bfaf_SElTVE9SWS5yc3Q=..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_SElTVE9SWS5yc3Q= 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,11 @@ History ======= +2.10 +---- + +Add script to duplicate code on another repository. + 2.9 --- diff --git a/README.rst b/README.rst index f46932aa1dccc7c94bccd0ea01c3fe697c76bfaf_UkVBRE1FLnJzdA==..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_UkVBRE1FLnJzdA== 100644 --- a/README.rst +++ b/README.rst @@ -43,3 +43,16 @@ -------------- zsh script to create a tar.xz file containing all sources. + +update_duplicate_sources +------------------------ + +This script will update a metaproject that only contain the sources of the one it is launched from. + +It expect the configuration file (`setup.cfg`) to have the following keys: + +- `modules`: list of directories and files to include (also used by another script) +- `dependencies`: list of directories and files to include (also used by another script) +- `other_sources`: list of directories and files to include (only used by this script, used for README, ReleaseNotes, script directories, etc.) + +No change are made to the name of the directories/files included. diff --git a/VERSION b/VERSION index f46932aa1dccc7c94bccd0ea01c3fe697c76bfaf_VkVSU0lPTg==..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_VkVSU0lPTg== 100644 --- a/VERSION +++ b/VERSION @@ -1,1 +1,1 @@ -2.9 +2.10 diff --git a/do_tests b/do_tests index f46932aa1dccc7c94bccd0ea01c3fe697c76bfaf_ZG9fdGVzdHM=..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_ZG9fdGVzdHM= 100755 --- a/do_tests +++ b/do_tests @@ -13,7 +13,7 @@ # # - access to pg database # -# Version 2.9 +# Version 2.10 here=$(dirname $0) project_home=$(cd $here && cd .. && echo $PWD) diff --git a/docker_build b/docker_build index f46932aa1dccc7c94bccd0ea01c3fe697c76bfaf_ZG9ja2VyX2J1aWxk..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_ZG9ja2VyX2J1aWxk 100755 --- a/docker_build +++ b/docker_build @@ -3,7 +3,7 @@ # Create docker script -# template version 2.9 +# template version 2.10 # TODO add a way to bypass the value, maybe with a key in the setup.cfg file here=$(dirname $0) diff --git a/run_tests b/run_tests index f46932aa1dccc7c94bccd0ea01c3fe697c76bfaf_cnVuX3Rlc3Rz..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_cnVuX3Rlc3Rz 100755 --- a/run_tests +++ b/run_tests @@ -4,7 +4,7 @@ # This script is used to run tests on a database with demo data installed. # # Either provide the name of the database (first argument) or it will default to <project>_test -# Version 2.9 +# Version 2.10 here=$(dirname $0) project_home=$(cd $here && cd .. && echo $PWD) tested_modules=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print ','.join(c.get('odoo_scripts', 'module_list_tests', '').split())") diff --git a/setup.cfg b/setup.cfg index f46932aa1dccc7c94bccd0ea01c3fe697c76bfaf_c2V0dXAuY2Zn..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_c2V0dXAuY2Zn 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.9 +current_version = 2.10 parse = (?P<major>\d+)\.(?P<minor>\d+) serialize = {major}.{minor} diff --git a/start b/start index f46932aa1dccc7c94bccd0ea01c3fe697c76bfaf_c3RhcnQ=..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_c3RhcnQ= 100755 --- a/start +++ b/start @@ -5,7 +5,7 @@ # # You can set ODOO_DATA_DIR and ODOO_DB_HOST if you want to avoid using the default value ($HOME/var/tmp and localhost) # -# Version 2.9 +# Version 2.10 here=$(dirname $0) project_home=$(cd $here && cd .. && echo $PWD) echo "Starting odoo for development" diff --git a/update_duplicate_sources b/update_duplicate_sources new file mode 100755 index 0000000000000000000000000000000000000000..fe6dfeedb3ba01674dd1ac6803d3900bbcb29b82_dXBkYXRlX2R1cGxpY2F0ZV9zb3VyY2Vz --- /dev/null +++ b/update_duplicate_sources @@ -0,0 +1,74 @@ +#!/bin/zsh +# vim: set shiftwidth=4 softtabstop=4 tabstop=4 expandtab: +# +# This script update another repository that is a copy of the sources +# +# Assertion: +# - the source project already exist on bitbucket and its name is the same as the metaproject+_sources +# - the metaproject is the same type as the sources one + +here=$(dirname $0) +project_home=$(cd $here && cd .. && echo $PWD) +project_name=$(basename $project_home) +python=python + +source_name=${project_name}_sources + +odoo_modules=($($python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print(c.has_section('odoo_scripts') and c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules', '').split()) or '' )")) +dependencies=($($python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print(c.has_section('odoo_scripts') and c.has_option('odoo_scripts', 'dependencies') and ' '.join(c.get('odoo_scripts', 'dependencies', '').split()) or '' )")) +other_sources=($($python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print(c.has_section('odoo_scripts') and c.has_option('odoo_scripts', 'other_sources') and ' '.join(c.get('odoo_scripts', 'other_sources', '').split()) or '' )")) + +# color stuff +autoload colors && colors +for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do + eval $COLOR='$fg_no_bold[${(L)COLOR}]' + eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]' +done +eval RESET='$reset_color' + +pushd $project_home + +if [ -e ".hg" ]; then + branch="$(hg id -b)" + tags=($(hg id -t)) + hg clone ssh://hg@bitbucket.org/xcg/${source_name} + pushd $source_name + hg update $branch + branch_exist=$? + popd + echo "${YELLOW}INFO ${RESET} - branch_exist=$branch_exist" + # Remove any content inside it + rm -rf ${source_name}/* + rsync -rRLtC --exclude=.hgtags --exclude=.hgignore $odoo_modules $dependencies $other_sources $source_name + pushd $source_name + hg addremove + if [[ "x$branch_exist" != "x0" ]]; + then + hg branch $branch + fi + hg commit -m"Update sources" + # Tagging process only works if done locally + if [[ "$tags" != "tip" ]]; then + id_to_tag=$(hg id -i) + for tag in $tags; do + echo "${YELLOW}INFO ${RESET} - Add tag $tag" + hg tag $tag -r $id_to_tag + done + fi + if [[ "x$branch_exist" != "x0" ]]; + then + echo "${YELLOW}INFO ${RESET} - Pushing new branch $branch" + hg push --new-branch + else + echo "${YELLOW}INFO ${RESET} - Pushing branch $branch" + hg push + fi + popd + rm -rf ${source_name} +else + echo "${RED}ERROR${RESET} - Repository VCS unknown/not handled" + popd + exit 1 +fi + +popd