Changeset 238 for trunk/dasscm
- Timestamp:
- Oct 9, 2008, 12:05:11 AM (16 years ago)
- Location:
- trunk/dasscm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dasscm/dasscm
r237 r238 26 26 my $permissions_file = "/etc/permissions.d/dasscm.permission_backup"; 27 27 28 # documentation file (for usage) 29 my $doc_file = "/usr/share/doc/packages/dasscm/dasscm_howto.txt"; 30 28 31 # configuration file 29 32 my $config_file = "/etc/dasscm.conf"; … … 33 36 my $DASSCM_SVN_REPOSITORY; 34 37 38 # current directory at program start 39 my $StartDirectory = cwd(); 40 35 41 my $SVN = "svn "; 36 42 my $svnOptions = ""; 37 43 my $svnCheckoutCredentials = ""; 38 44 my $svnPasswordCredentials = ""; 39 my $ DIFF= "diff --exclude .svn ";45 my $diff = "diff --exclude .svn "; 40 46 41 47 # command line options get stored in options hash … … 69 75 print " permissions\n"; 70 76 print "\n"; 71 print "prep eration:\n", " if dasscm is already configured,\n",77 print "preparation:\n", " if dasscm is already configured,\n", 72 78 " use 'dasscm login' and then eg. 'add'.\n", 73 79 " The environment variables\n", " DASSCM_REPO\n", " DASSCM_PROD\n", … … 75 81 " are evaluated, but set automatically by 'dasscm login'.\n", "\n", 76 82 " If dasscm is not yet configured, read", 77 " /usr/share/doc/packages/dasscm/dasscm_howto.txt\n";83 " $doc_file\n"; 78 84 } 79 85 … … 95 101 } 96 102 103 104 # 105 # reading config file and return key/value pairs as hash 106 # 97 107 sub get_config 98 108 { … … 115 125 } 116 126 if ( $_ =~ /=/g ) { 117 # #splitting in 2 fields at maximum127 # splitting in 2 fields at maximum 118 128 my ( $option, $value ) = split( /=/, $_, 2 ); 119 129 $option =~ s/^\s+//g; … … 212 222 sub check_parameter(@) 213 223 { 214 if( not @_ ) { 215 fatalerror( "no files specified. See 'dasscm --help'" ); 216 } 217 } 218 224 } 225 226 227 # 228 # generate from (relative) filename 229 # all required file and directory names: 230 # $basename, $dirname_prod, $dirname_repo, 231 # $filename_prod, $filename_repo 232 # 219 233 sub get_filenames(@) 220 234 { 221 235 my $filename_prod = $_[0]; 222 236 223 # remove leading './' from relative directories 224 #$filename_prod =~ s/^\.\///; 225 237 # make filename absolut 226 238 if ( !( $filename_prod =~ m/^\// ) ) { 227 239 $filename_prod = cwd() . "/" . $filename_prod; … … 231 243 fatalerror( $filename_prod . " is not accessable" ); 232 244 } 233 # elsif( -l $filename_prod ) {234 # my $dest = readlink($filename_prod);235 # # TODO:236 # # default: disallow, but offer cmd switch to activate237 # # (or check, if file is already checked in and has been a link before)238 # warning( "'$filename_prod' is a link to '$dest'.", "Please check, if '$dest' should be stored in repository instead" );239 # if( ! -f $dest ) {240 # fatalerror( "link target '$dest' is not a regular file. Giving up" );241 # }242 # } elsif( ! -f $filename_prod ) {243 # #fatalerror( $filename_prod . " is not a regular file" );244 # }245 245 246 246 # TODO: dirname buggy: eg. "/etc/" is reduced to "/", 247 247 # "/etc" is used as filename 248 248 my $dirname_prod = dirname($filename_prod); 249 my $oldpath = cwd(); 249 250 # uses chdir to determine real directory in a unique way 250 251 chdir $dirname_prod or die $!; 251 252 $dirname_prod = cwd(); 252 chdir $oldpath; 253 chdir $StartDirectory; 254 253 255 my $basename = basename($filename_prod); 254 256 … … 362 364 print "checking credentials ... "; 363 365 366 if( ! $username ) { 367 fatalerror( "no username given" ); 368 } 369 370 if( ! $password ) { 371 fatalerror( "no password given" ); 372 } 373 364 374 # Options for "svn info" are not supported by subversion 1.0.0 (SLES9), 365 375 # therefore switching to "svn status" … … 376 386 377 387 if ( $rc_update != 0 ) { 378 print @result;379 die;388 print "\n", @result; 389 fatalerror(); 380 390 } 381 391 … … 390 400 print @result; 391 401 if ( $rc_update != 0 ) { 392 die;402 fatalerror(); 393 403 } 394 404 } … … 410 420 if ( $rc != 0 ) { 411 421 print @result; 412 die;422 fatalerror; 413 423 } 414 424 chomp(@result); … … 417 427 418 428 429 # 430 # from an array of files/dirs, 431 # generates list of files 432 # sorted by type 433 # 419 434 sub get_files( @ ) 420 435 { … … 496 511 print "\n"; 497 512 498 svn_check_credentials( $input_username , $input_password );513 svn_check_credentials( $input_username || $DASSCM_USERNAME, $input_password ); 499 514 500 515 # … … 571 586 } 572 587 588 # TODO: are permissions also copied? 573 589 copy( $filename_prod, $filename_repo ) or error "failed to copy $filename_prod to repository: $!"; 574 590 575 591 if ( $command eq "add" ) { 576 592 577 my $oldpath = cwd();578 593 # already checked in? 579 chdir ($DASSCM_REPO);594 chdir $DASSCM_REPO; 580 595 581 596 # also add the path to filename. … … 593 608 print join( "\n", @out ); 594 609 } 595 chdir ($oldpath);610 chdir $StartDirectory; 596 611 } 597 612 } … … 633 648 print "\n"; 634 649 } 650 651 # TODO: confirm 635 652 636 653 # copy files one by one to local repository … … 700 717 } 701 718 702 ( my $rc_diff, my @diff ) = 703 run_command( $DIFF . " $filename_repo $filename_prod"); 704 print @diff; 719 ( my $rc_diff, my @diff_result ) = 720 run_command( $diff . " $filename_repo $filename_prod"); 721 722 print @diff_result; 705 723 } 706 724 -
trunk/dasscm/dasscm.conf
r223 r238 27 27 # server settings dass-it 28 28 # 29 DASSCM_SVN_REPOSITORY_BASE=https:// dass-it.de/svn/dasscm/29 DASSCM_SVN_REPOSITORY_BASE=https://svn.dass-it.net/svn/dasscm/ 30 30 DASSCM_CHECKOUT_USERNAME=dasscm 31 31 DASSCM_CHECKOUT_PASSWORD=dcmdst … … 35 35 # server settings LVermGeo 36 36 # 37 ##DASSCM_SVN_REPOSITORY_BASE=https://svn.dass-it.net/svn/lvermgeo/technical/config/server 38 #DASSCM_SVN_REPOSITORY_BASE=https://dass-it.de/svn/lvermgeo/technical/config/server 37 #DASSCM_SVN_REPOSITORY_BASE=https://svn.dass-it.net/svn/lvermgeo/technical/config/server 39 38 #DASSCM_CHECKOUT_USERNAME=lvermgeo 40 39 #DASSCM_CHECKOUT_PASSWORD= … … 44 43 # server settings Debeka 45 44 # 46 #DASSCM_SVN_REPOSITORY_BASE=https:// dass-it.de/svn/smartclient/branches/Debeka/SC-03_01_add_NAH_Branch_Debeka/config/45 #DASSCM_SVN_REPOSITORY_BASE=https://svn.dass-it.net/svn/smartclient/branches/Debeka/SC-03_01_add_NAH_Branch_Debeka/config/ 47 46 #DASSCM_CHECKOUT_USERNAME=debekadasscm 48 47 #DASSCM_CHECKOUT_PASSWORD=
Note:
See TracChangeset
for help on using the changeset viewer.