Skip to content
Snippets Groups Projects
Commit fe6dfeed authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

Add script to duplicate code on another repository

parent f46932aa
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
History History
======= =======
2.10
----
Add script to duplicate code on another repository.
2.9 2.9
--- ---
......
...@@ -43,3 +43,16 @@ ...@@ -43,3 +43,16 @@
-------------- --------------
zsh script to create a tar.xz file containing all sources. 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.
2.9 2.10
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# #
# - access to pg database # - access to pg database
# #
# Version 2.9 # Version 2.10
here=$(dirname $0) here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD) project_home=$(cd $here && cd .. && echo $PWD)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Create docker script # 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 # TODO add a way to bypass the value, maybe with a key in the setup.cfg file
here=$(dirname $0) here=$(dirname $0)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# This script is used to run tests on a database with demo data installed. # 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 # 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) here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD) 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())") 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())")
......
[bumpversion] [bumpversion]
current_version = 2.9 current_version = 2.10
parse = (?P<major>\d+)\.(?P<minor>\d+) parse = (?P<major>\d+)\.(?P<minor>\d+)
serialize = serialize =
{major}.{minor} {major}.{minor}
......
...@@ -5,7 +5,7 @@ ...@@ -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) # 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) here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD) project_home=$(cd $here && cd .. && echo $PWD)
echo "Starting odoo for development" echo "Starting odoo for development"
......
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment