From 3ba17fd0761dd635be8c7cd562d52f4d6b3dcc32 Mon Sep 17 00:00:00 2001 From: thierry Date: Thu, 7 Jun 2007 14:21:03 +0000 Subject: [PATCH] now handles *-tags.mk in build for adopting the new tag - probably needs some rework to have this function available separately from the tagging operation itself --- scripts/import-module.sh | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/scripts/import-module.sh b/scripts/import-module.sh index e506f67..298eb76 100755 --- a/scripts/import-module.sh +++ b/scripts/import-module.sh @@ -108,6 +108,12 @@ function svn_dir_needs_revert () { if [ -n "$output" ] ; then echo y ; else echo n ; fi } +function svn_file_needs_commit () { + dir=$1; shift + output=$(svn status $dir 2>&1) + if [ -n "$output" ] ; then echo y ; else echo n ; fi +} + ############################## # guess spec files and extract from there # search for otherwise expects a single *.spec file @@ -289,9 +295,6 @@ function tag_module () { echo 'Tagging' $module - run_prompt $(dir_needs_creation $tagwork) "Creating $tagwork" \ - mkdir -p $tagwork - run_prompt $(dir_needs_creation $tagtrunk) "Checking out $tagtrunk" \ svn co $svn/$module/trunk $tagtrunk @@ -348,9 +351,33 @@ function tag_module () { run_prompt y "Creating tag $newtag" \ svn copy --message "$module-${version}.${newsubversion}" $svn/$module/trunk $newtag - echo "This command does not handle changes in onelab-tags.mk - yet" - - + # make changes in build/*-tags.mk + tagbuild=$HOME/tags/build/trunk + oldname=$module-${version}.${subversion} + newname=$module-${version}.${newsubversion} + + run_prompt $(dir_needs_creation $tagbuild) "Checking out $tagbuild" \ + svn co $svn/$module/build $tagbuild + + run_prompt y "Updating $tagbuild" \ + svn up $tagbuild + + run_prompt $(svn_dir_needs_revert $tagbuild) "Reverting $tagbuild for safety " \ + svn revert -R $tagbuild + + run "cd $tagbuild" \ + cd $tagbuild + + for tagsmk in *-tags.mk; do + echo "Managing $tagsmk" + sed -i -e "s,$oldname,$newname,g" $tagsmk + if [ $(svn_file_needs_commit $tagsmk) = "y" ] ; then + echo "Changes in $tagsmk" + svn diff $tagsmk + run_prompt y "Adopt $newname in $tagsmk " \ + svn commit -m"Adopting-$newname" $tagsmk + fi + done } case $0 in -- 2.47.0