+++ /dev/null
-#!/usr/bin/perl\r
-\r
-my $version ;\r
-\r
-my $svnRelPath ;\r
-getRelPath() ;\r
-print "Relative path: $svnRelPath\n" ;\r
-my $upToRoot ;\r
-if ( $svnRelPath =~ /trunk/ ) {\r
- $upToRoot = '..' ;\r
-}\r
-else {\r
- $upToRoot = '..\\..' ;\r
-}\r
-# my $upToRoot = $svnRelPath ;\r
-# $upToRoot =~ s/([^\/]+)/../g ;\r
-# $upToRoot = "../$upToRoot" ;\r
-print "upToRoot: $upToRoot\n" ;\r
-\r
-getVersion() ;\r
-print "Version $version\n" ;\r
-\r
-my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);\r
-$year += 1900 ;\r
-\r
-my $distrPath = "cds-distrib/cds-$version" ;\r
-my $relDistrPath = "$upToRoot/$distrPath" ;\r
-\r
-print "export SVN...\n" ;\r
-exportSVN() ;\r
-\r
-my $nTabsFound = 0 ;\r
-\r
-print "make copyright...\n" ;\r
-makeCopyright() ;\r
-patchFile("$relDistrPath/build/Makefile", 'VERSION=\d+\.\d+\.\d+', "VERSION=$version" ) ;\r
-patchFile("$relDistrPath/doxygen/cds.doxy", 'PROJECT_NUMBER\s*=\s*\d+\.\d+\.\d+', "PROJECT_NUMBER = $version" ) ;\r
-patchFile("$relDistrPath/projects/Win/vc2008/cds.2008.vcproj", 'CDS_USE_VLD', 'xCDS_USE_VLD' ) ;\r
-patchFile("$relDistrPath/projects/Win/vc2008/unit.2008.vcproj", 'CDS_USE_VLD', 'xCDS_USE_VLD' ) ;\r
-patchFile("$relDistrPath/projects/android/jni/Android.mk", 'CDS_LIBRARY_VERSION\s*:=\s*\d+\.\d+\.\d+', \r
- "CDS_LIBRARY_VERSION := $version" );\r
-\r
-print "Tabs found: $nTabsFound\n" ;\r
-\r
-print "make docs...\n" ;\r
-`cd $relDistrPath && make_docs.bat` ;\r
-`rm -f $relDistrPath/make_distrib.pl` ;\r
-`rm -fr $relDistrPath/scripts` ;\r
-`rm -f $relDistrPath/doxygen/doxygen.log` ;\r
-\r
-print "make zip...\n" ;\r
-`rm -f $relDistrPath/../cds-$version.zip` ;\r
-`cd $relDistrPath/.. && 7za a cds-$version.zip cds-$version` ;\r
-\r
-print "Done\n" ;\r
-\r
-exit ;\r
-\r
-sub getVersion()\r
-{\r
- open( my $fh, 'cds/version.h' ) or die "ERROR: Cannot find cds/version.h file";\r
- binmode $fh ;\r
- \r
- while (<$fh>) {\r
- if ( /CDS_VERSION_STRING.+(\d+\.\d+\.\d+)/ ) {\r
- $version = $1 ;\r
- last ;\r
- }\r
- }\r
- close $fh ;\r
- die "ERROR: cannot find version in cds/version.h" unless $version ;\r
-}\r
-\r
-sub getRelPath()\r
-{\r
- my $svn = `svn info` ;\r
- ($svnRelPath) = $svn =~ /Working\sCopy\sRoot\sPath:\s+(.+)/ ;\r
-\r
- # my ($curDir) = $svn =~ /URL:\s+(.+)/ ;\r
- # my ($rootDir) = $svn =~ /Repository\s+Root:\s+(.+)/ ;\r
- # $rootDir =~ s/\+/\\\+/g ;\r
- \r
- # ($svnRelPath) = $curDir =~ /$rootDir\/(.+)/ ;\r
-}\r
-\r
-sub exportSVN()\r
-{\r
- `cd $upToRoot && rm -fr $distrPath && svn export $svnRelPath $distrPath` ;\r
-}\r
-\r
-sub makeCopyright() \r
-{\r
- processDir( "$relDistrPath/cds" ) ;\r
- processDir( "$relDistrPath/src" ) ;\r
- processDir( "$relDistrPath/tests/test-hdr" ) ;\r
- processDir( "$relDistrPath/tests/unit" ) ;\r
- processDir( "$relDistrPath/tests/cppunit" ) ;\r
-}\r
-\r
-sub processDir( $ )\r
-{\r
- my $dirName = shift ;\r
- \r
- opendir(my $dh, $dirName) || die "can't opendir $dirName: $!";\r
- my @files = grep { /^[^\.]/ } readdir($dh);\r
- closedir $dh;\r
- \r
- foreach my $file ( @files ) {\r
- if ( -d "$dirName/$file" ) {\r
- processDir("$dirName/$file") ;\r
- }\r
- elsif ( $file =~ /\.(h|cpp)$/ ) {\r
- processFile( "$dirName/$file" ) ;\r
- }\r
- }\r
-}\r
-\r
-sub processFile( $ ) \r
-{\r
- my $file = shift ;\r
-\r
- \r
- if ( open( my $fh, $file )) {\r
- binmode $fh ;\r
- my $str = '' ;\r
- while (<$fh>) {\r
- if ( /^\/\/\$\$CDS-header\$\$/ ) {\r
- $str .= \r
-"/*\r
- This file is a part of libcds - Concurrent Data Structures library\r
- See http://libcds.sourceforge.net/\r
-\r
- (C) Copyright Maxim Khiszinsky (libcds.sf\@gmail.com) 2006-$year\r
- Distributed under the BSD license (see accompanying file license.txt)\r
-\r
- Version $version\r
-*/\n\n" ;\r
- }\r
- elsif ( /^\/\/\$\$CDS-\/\*\$\$/ ) {\r
- $str .= "/*\n" ;\r
- }\r
- elsif ( /^\/\/\$\$CDS-\*\/\$\$/ ) {\r
- $str .= "*/\n" ;\r
- }\r
- else {\r
- $nTabsFound += $_ =~ s/\t/ /g;\r
- $_ =~ s/\s+$// ;\r
- $_ =~ s/\s+;$/;/;\r
- $str .= $_ ;\r
- $str .= "\n" ;\r
- }\r
- }\r
- close $fh ;\r
- \r
- if ( open( my $fh, ">$file" )) {\r
- binmode $fh ;\r
- print $fh $str ;\r
- close $fh ;\r
- }\r
- }\r
-}\r
-\r
-sub patchFile(@) {\r
- my $file = shift ;\r
- my $seek = shift ;\r
- my $repl = shift ;\r
- \r
- if ( open( my $fh, $file )) {\r
- binmode $fh ;\r
- \r
- my $str = '' ;\r
- $str .= $_ while <$fh> ;\r
- close $fh ;\r
- \r
- $str =~ s/$seek/$repl/g ;\r
- \r
- if ( open( my $fh, ">$file" )) {\r
- binmode $fh ;\r
- print $fh $str ;\r
- close $fh ;\r
- }\r
- }\r
-}\r
-\r
-\r
-\r
-\r
--- /dev/null
+#!/usr/bin/perl\r
+\r
+my $curDir = `cd`;\r
+\r
+my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);\r
+$year += 1900;\r
+\r
+\r
+# Get libcds version\r
+my $Version = get_version();\r
+print "Make libcds-$Version distributive\n";\r
+\r
+my $DistrDir = get_distrib_dir();\r
+print "Distrib dir: $DistrDir\n";\r
+\r
+# Git clone\r
+my $GitBranch = get_git_branch();\r
+my $GitRepo = get_git_repo();\r
+print "Clone git: repo=$GitRepo, branch=$GitBranch\n";\r
+`git clone -b $GitBranch $GitRepo $DistrDir` or die "Error cloning branch $GitBranch to $DistrDir\n";\r
+print "Remove $DistrDir/.git directory\n";\r
+`rm -fr $DistrDir/.git`;\r
+`rm -f $DistrDir/.gitignore $DistrDir/tools/brush_cds.pl $DistrDir/tools/make_distrib.pl $DistrDir/tools/make_distrib.bat`;\r
+\r
+print "make copyright...\n" ;\r
+makeCopyright($DistrDir);\r
+\r
+print "patch files...\n";\r
+patch_file("$DistrDir/build/Makefile", 'VERSION=\d+\.\d+\.\d+', "VERSION=$Version" ) ;\r
+patch_file("$DistrDir/doxygen/cds.doxy", 'PROJECT_NUMBER\s*=\s*\d+\.\d+\.\d+', "PROJECT_NUMBER = $Version" ) ;\r
+patch_file("$DistrDir/projects/android/jni/Android.mk", 'CDS_LIBRARY_VERSION\s*:=\s*\d+\.\d+\.\d+', \r
+ "CDS_LIBRARY_VERSION := $Version" );\r
+\r
+print "Make docs\n";\r
+`cd $DistrDir/tools && make_docs.bat && rm doxygen.log && cd $curDir`;\r
+ \r
+print "make zip...\n" ;\r
+`rm -f $DistrDir/../cds-$Version.zip` ;\r
+`cd $DistrDir/.. && 7za a cds-$Version.zip cds-$Version` ;\r
+\r
+print "Done\n" ;\r
+exit ;\r
+\r
+ \r
+sub get_version()\r
+{\r
+ my $version;\r
+ open( my $fh, 'cds/version.h' ) or die "ERROR: Cannot find ../cds/version.h file";\r
+ binmode $fh ;\r
+ \r
+ while (<$fh>) {\r
+ if ( /CDS_VERSION_STRING.+(\d+\.\d+\.\d+)/ ) {\r
+ $version = $1 ;\r
+ last ;\r
+ }\r
+ }\r
+ close $fh ;\r
+ die "ERROR: cannot find version in ../cds/version.h" unless $version ;\r
+}\r
+\r
+sub get_distrib_dir()\r
+{\r
+ my $dir = "../cds-distrib/cds-$Version";\r
+ `rm -fr $dir` if -d $dir;\r
+ mkdir $dir;\r
+ return $dir;\r
+}\r
+\r
+sub get_git_repo()\r
+{\r
+ return '.';\r
+}\r
+\r
+sub get_git_branch()\r
+{\r
+ my $branchList = `git branch`;\r
+ #print "$branchList\n";\r
+ \r
+ # Search "v$Version-rc" branch\r
+ my ($branch) = $branchList =~ /(v$Version-rc\d*)/g;\r
+ return $branch || 'master';\r
+}\r
+\r
+sub makeCopyright($) \r
+{\r
+ my $distrDir = shift;\r
+ processDir( "$distrDir/cds" ) ;\r
+ processDir( "$distrDir/src" ) ;\r
+ processDir( "$distrDir/tests/test-hdr" ) ;\r
+ processDir( "$distrDir/tests/unit" ) ;\r
+ processDir( "$distrDir/tests/cppunit" ) ;\r
+}\r
+\r
+sub processDir( $ )\r
+{\r
+ my $dirName = shift ;\r
+ \r
+ opendir(my $dh, $dirName) || die "can't opendir $dirName: $!";\r
+ my @files = grep { /^[^\.]/ } readdir($dh);\r
+ closedir $dh;\r
+ \r
+ foreach my $file ( @files ) {\r
+ if ( -d "$dirName/$file" ) {\r
+ processDir("$dirName/$file") ;\r
+ }\r
+ elsif ( $file =~ /\.(h|cpp)$/ ) {\r
+ processFile( "$dirName/$file" ) ;\r
+ }\r
+ }\r
+}\r
+\r
+sub processFile( $ ) \r
+{\r
+ my $file = shift ;\r
+\r
+ \r
+ if ( open( my $fh, $file )) {\r
+ binmode $fh ;\r
+ my $str = '' ;\r
+ while (<$fh>) {\r
+ if ( /^\/\/\$\$CDS-header\$\$/ ) {\r
+ $str .= \r
+"/*\r
+ This file is a part of libcds - Concurrent Data Structures library\r
+ Version: $Version\r
+\r
+ (C) Copyright Maxim Khizhinsky (libcds.dev\@gmail.com) 2006-$year\r
+ Distributed under the BSD license (see accompanying file license.txt)\r
+\r
+ Source code repo: http://github.com/khizmx/libcds/\r
+ Download: http://libcds.sourceforge.net/files/\r
+*/\n" ;\r
+ }\r
+ elsif ( /^\/\/\$\$CDS-\/\*\$\$/ ) {\r
+ $str .= "/*\n" ;\r
+ }\r
+ elsif ( /^\/\/\$\$CDS-\*\/\$\$/ ) {\r
+ $str .= "*/\n" ;\r
+ }\r
+ else {\r
+ $nTabsFound += $_ =~ s/\t/ /g;\r
+ $_ =~ s/\s+$// ;\r
+ $_ =~ s/\s+;$/;/;\r
+ $str .= $_ ;\r
+ $str .= "\n" ;\r
+ }\r
+ }\r
+ close $fh ;\r
+ \r
+ if ( open( my $fh, ">$file" )) {\r
+ binmode $fh ;\r
+ print $fh $str ;\r
+ close $fh ;\r
+ }\r
+ }\r
+}\r
+\r
+sub patch_file(@) {\r
+ my $file = shift ;\r
+ my $seek = shift ;\r
+ my $repl = shift ;\r
+ \r
+ if ( open( my $fh, $file )) {\r
+ binmode $fh ;\r
+ \r
+ my $str = '' ;\r
+ $str .= $_ while <$fh> ;\r
+ close $fh ;\r
+ \r
+ $str =~ s/$seek/$repl/g ;\r
+ \r
+ if ( open( my $fh, ">$file" )) {\r
+ binmode $fh ;\r
+ print $fh $str ;\r
+ close $fh ;\r
+ }\r
+ }\r
+}\r