From 17b062c027cb7950f419b614da677f3568f04484 Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 16 Aug 2004 13:04:28 +0000 Subject: [PATCH] added create_clean_fpcsrc_directory.sh git-svn-id: trunk@5802 - --- .gitattributes | 1 + .../install/create_clean_fpcsrc_directory.sh | 58 +++++++++++++++++++ .../install/create_clean_lazarus_directory.sh | 10 +++- .../install/create_fpc_tgz_from_local_dir.sh | 24 ++------ 4 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 tools/install/create_clean_fpcsrc_directory.sh diff --git a/.gitattributes b/.gitattributes index 33d28ff9aa..135c592641 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1473,6 +1473,7 @@ tools/getallmofiles.sh -text svneol=native#application/x-sh tools/getallpofiles.sh -text svneol=native#application/x-sh tools/install/build_fpc_rpm.sh -text svneol=native#application/x-sh tools/install/build_fpcsrc_rpm.sh -text svneol=native#application/x-sh +tools/install/create_clean_fpcsrc_directory.sh -text svneol=native#application/x-sh tools/install/create_clean_lazarus_directory.sh -text svneol=native#application/x-sh tools/install/create_fpc_deb.sh -text svneol=native#application/x-sh tools/install/create_fpc_export_tgz.sh -text svneol=native#application/x-sh diff --git a/tools/install/create_clean_fpcsrc_directory.sh b/tools/install/create_clean_fpcsrc_directory.sh new file mode 100644 index 0000000000..e3eeced505 --- /dev/null +++ b/tools/install/create_clean_fpcsrc_directory.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +set -x +set -e + +SrcDir=$1 +DestDir=$2 + +SrcDir=$(echo $SrcDir | sed -e 's#//#/#' -e 's#/$##')/ +DestDir=$(echo $DestDir | sed -e 's#//#/#' -e 's#/$##')/ + +if [ "x$SrcDir" = "x" ]; then + echo "Usage: $0 " + exit +fi +if [ "x$DestDir" = "x" ]; then + echo "Usage: $0 " + exit +fi +if [ "x$DestDir" = "x/" ]; then + echo "Usage: $0 " + exit +fi +if [ ! -d $SrcDir/compiler ]; then + echo "The directory does not look like a fpc source directory (lazarus/)" + exit +fi + +echo "copy $SrcDir to $DestDir ..." +if [ `which rsync` ]; then + rsync -va --exclude="CVS" --exclude=".cvsignore" \ + --exclude="*.ppu" --exclude="*.ppw" --exclude="*.ppl" \ + --exclude="*.o" --exclude="*.ow" --exclude="*.rst" \ + --exclude=".#*" --exclude="*.~*" --exclude="*.bak" \ + --exclude="*.orig" --exclude="*.rej" --exclude="*.bak" \ + --exclude=".xvpics" --exclude="*.compiled" --exclude="killme*" \ + --exclude=".gdb_hist*" + $SrcDir $DestDir +else + cp -a $SrcDir $DestDir +fi + +echo "cleaning up (CVS, ppu, o) ..." +cd $DestDir +make distclean +for Ext in ppu ppw ppl o ow rst cvsignore bak orig rej xvpics; do + find . -name "*.$Ext" -exec rm -f {} \; +done +find . -name "*.~*" -exec rm -f {} \; +find . -name "*.#*" -exec rm -f {} \; +# delete all CVS directories +find . -name "CVS" -exec rm -rf {} \; +# delete all executables +find . -perm +a+x -type f -exec rm -f {} \; +cd - + +# end. + diff --git a/tools/install/create_clean_lazarus_directory.sh b/tools/install/create_clean_lazarus_directory.sh index 0a8f018100..da90478284 100644 --- a/tools/install/create_clean_lazarus_directory.sh +++ b/tools/install/create_clean_lazarus_directory.sh @@ -6,8 +6,8 @@ set -e LazSrcDir=$1 LazDestDir=$2 -LazSrcDir=$(echo $LazSrcDir | sed -e 's#//#/#' -e 's#/$##') -LazDestDir=$(echo $LazDestDir | sed -e 's#//#/#' -e 's#/$##') +LazSrcDir=$(echo $LazSrcDir | sed -e 's#//#/#' -e 's#/$##')/ +LazDestDir=$(echo $LazDestDir | sed -e 's#//#/#' -e 's#/$##')/ if [ "x$LazSrcDir" = "x" ]; then echo "Usage: $0 " @@ -34,9 +34,10 @@ if [ `which rsync` ]; then --exclude=".#*" --exclude="*.~*" --exclude="*.bak" \ --exclude="*.orig" --exclude="*.rej" --exclude="*.bak" \ --exclude=".xvpics" --exclude="*.compiled" --exclude="killme*" \ + --exclude=".gdb_hist*" $LazSrcDir $LazDestDir else - echo cp -a $LazSrcDir $LazDestDir + cp -a $LazSrcDir $LazDestDir fi echo "cleaning up (CVS, ppu, o) ..." @@ -49,7 +50,10 @@ for Ext in ppu ppw ppl o ow rst cvsignore bak orig rej xvpics; do done find . -name "*.~*" -exec rm -f {} \; find . -name "*.#*" -exec rm -f {} \; +# delete all CVS directories find . -name "CVS" -exec rm -rf {} \; +# delete all executables +find . -perm +a+x -type f -exec rm -f {} \; rm -rf tools/install/*.tgz rm -rf tools/install/*.*.spec cd - diff --git a/tools/install/create_fpc_tgz_from_local_dir.sh b/tools/install/create_fpc_tgz_from_local_dir.sh index d5284b93bb..96dc07c9d5 100644 --- a/tools/install/create_fpc_tgz_from_local_dir.sh +++ b/tools/install/create_fpc_tgz_from_local_dir.sh @@ -6,6 +6,9 @@ set -x FPCSrcDir=$1 OutputFile=$2 +FPCSrcDir=$(echo $FPCSrcDir | sed -e 's#//#/#' -e 's#/$##')/ +OutputFile=$(echo $OutputFile | sed -e 's#//#/#' -e 's#/$##') + Usage="Usage: $0 " if [ "x$FPCSrcDir" = "x" ]; then @@ -30,26 +33,7 @@ echo "copy $FPCSrcDir to /tmp/fpc ..." cd $TmpBaseDir rm -rf $TmpDir cd - -cp -a $FPCSrcDir $TmpDir - -echo "cleaning up (CVS, ppu, o) ..." -cd $TmpDir -make distclean - -for Ext in ppu ppw ppl o ow rst cvsignore bak; do - find . -name "*.$Ext" -exec rm -f {} \; -done -find . -name "*.~*" -exec rm -f {} \; -rm -f *.tar.gz -if [ -d CVS ]; then - # use xargs to remove directories (otherwise find returns strange things) - find . -name 'CVS' | xargs rm -r -fi -cd - -# clean up docs -cd $TmpDir/docs -make clean -cd - +sh create_clean_fpcsrc_directory.sh $FPCSrcDir $TmpDir # pack echo "creating tgz ..."