Online OsiriX Documentation/Using getosirixCVS.pl

From Wikibooks, open books for an open world
< Online OsiriX Documentation
Jump to navigation Jump to search

< | ^

I have written (or more accurately pinched from the bibdesk website) a perl script to get the osirix source code called getosirixCVS.pl. Download this onto your machine. it is probably easiest to save it in your development directory. Mine is /Users/jefferis/dev. Go to the Terminal and run as follows:

gjg5:~/dev jefferis$ perl getosirixCVS.pl

Answer the questions and you will get a response that looks like this if you are using anonymous cvs

*******************************
Welcome to osirix development.
This script will get the stuff you need from cvs to build osirix.
Developers should set SF_USERNAME to use ssh access
Are you a developer using ssh access (y/n)? "n"
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/osirix login

Password is empty--just hit return when asked for a password
Executing: cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/osirix login
(Logging in to anonymous@cvs.sourceforge.net)
CVS password:  "Press return"
Do you want a specific tag? (empty for none or enter tag(eg TRY_RTF_041503)  "Press return"
Executing: cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/osirix co  osirix
cvs checkout: Updating osirix
U osirix/AdvancedQuerySubview.h
U osirix/AdvancedQuerySubview.m
U osirix/Analyze.h
... 
U osirix/pixelmed/DICOMPersonNameAttribute.xcode/lpysher.pbxuser 
U osirix/pixelmed/DICOMPersonNameAttribute.xcode/project.pbxproj

****************************
getosirixCVS done.You will have to expand zip files as follows: 
find osirix -iname "*.zip" -execdir unzip {} ";"
After that open osirix/OsiriX.pbproj/ and commence the build.
1) compile DCM.framework target FIRST. This will create the OsiriX.framework for OsiriXBurner application
2) compile 'OsirixBurner.xcode' file
3) compile all the PreferencePanes projects located in the 'Preference Panes' folder
4) compile 'Osirix.pbproj' file with OsiriX target

or like this if you are using Developer access:

*******************************
Welcome to osirix development.
This script will get the stuff you need from cvs to build osirix. 
Developers should set SF_USERNAME to use ssh access 
Are you a developer using ssh access (y/n)? y
What is your sourceforge username (setenv SF_USERNAME for a default)?  jefferis
Do you want a specific tag? (empty for none or enter tag(eg TRY_RTF_041503) "Press return for HEAD"
Executing: cvs -z3 -d:ext:jefferis@cvs.sourceforge.net:/cvsroot/osirix co  osirix
The authenticity of host 'cvs.sourceforge.net (66.35.250.207)' can't be established. 
DSA key fingerprint is 02:ab:7c:aa:49:ed:0b:a8:50:13:10:c2:3e:92:0f:42.
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added 'cvs.sourceforge.net,66.35.250.207' (DSA) to the list of known hosts.
jefferis@cvs.sourceforge.net's password:
cvs checkout: Updating osirix
U osirix/AdvancedQuerySubview.h
U osirix/AdvancedQuerySubview.m
...

And voila!

Here is the perl script. Save as getosirixCVS.pl. If you have the choice, make sure that you use Unix line terminations otherwise perl will complain.:

#!/usr/bin/perl -w
#
# This script was written for fetching the BibDesk CVS tree
# I basically just did a search and replace for osirix
# Greg Jefferis 21 May 2004

print "\n*******************************\n";
print "Welcome to osirix development.\n";
print "This script will get the stuff you need from cvs to build osirix.\n";
print "Developers should set SF_USERNAME to use ssh access\n";

$SFNAME=getSFName();

if ($SFNAME ne "") {
	prepdev();
} else {
	prepanon();
} 
$bibtag=gettag();

getsources();

print "\n****************************\n";                     
print "getosirixCVS done.";
print "You will have to expand zip files as follows:\n";
print "find osirix -iname \"*.zip\" -execdir unzip {} \";\"\n";
print "After that open osirix/OsiriX.pbproj/ and commence the build.\n";
print << "EOF";
1) compile DCM.framework target FIRST. This will create the OsiriX.framework for OsiriXBurner application
2) compile 'OsirixBurner.xcode' file
3) compile all the PreferencePanes projects located in the 'Preference Panes' folder
4) compile 'Osirix.pbproj' file with OsiriX target
EOF

sub getSFName {
  if (defined $ENV{'SF_USERNAME'} ) { 
	return $ENV{'SF_USERNAME'};
  } else {
	  print "Are you a developer using ssh access (y/n)? ";
	  $DEV = <STDIN>;
	  if ( $DEV =~ /^n/ ) {
	  return "";
	  } else {
		 print "What is your sourceforge username (setenv SF_USERNAME for a default)?  ";
		 $SFNAME = <STDIN>;
	 chomp($SFNAME);
		 return $SFNAME;
	  }
  }
}


# Set the BIB tag
sub gettag {
 if (defined $ENV{'SF_BIB_TAG'} ) {
   $bibtag = $ENV{'SF_BIB_TAG'};
 } else {
   print "Do you want a specific tag? (empty for none or enter tag(eg TRY_RTF_041503) ";
   $bibtag = <STDIN>;
 }
 chomp($bibtag);
 if ($bibtag eq "") {
   return $bibtag;
 } else {
   return "-r $bibtag";
 }
}

sub prepanon {
  $CVS_METHOD = "pserver";
  $SFNAME = "anonymous";
  $LOGIN = "cvs -z3 -d:$CVS_METHOD:$SFNAME\@cvs.sourceforge.net:/cvsroot/osirix login";
  print "$LOGIN\n";
  print "\nPassword is empty--just hit return when asked for a password\n";
  tryGet($LOGIN);
}

sub prepdev {
  $ENV{'CVS_RSH'} = 'ssh';
  $CVS_METHOD = "ext";
}

sub getsources {
   $GETMAIN = "cvs -z3 -d:$CVS_METHOD:$SFNAME\@cvs.sourceforge.net:/cvsroot/osirix co $bibtag osirix";
   tryGet($GETMAIN);

   # not relevant for osirix
   #$GETVENDOR = "cvs -z3 -d:$CVS_METHOD:$SFNAME\@cvs.sourceforge.net:/cvsroot/osirix co osirix_vendorsrc";
   #tryGet($GETVENDOR);

}

sub tryGet {
  $toGet = shift;

  print "Executing: $toGet\n";
	   
  if ( (system $toGet) != 0) { #return of 0 indicates success
	 print "cvs failed.  Check messages above. Should I try again? (y/n)?";
	 undef $tryAgain;
	 $tryAgain = <STDIN>;
	   
	 if ($tryAgain =~  /^y/) {
	   getsources();
	 } else {
	  print "cvs failed.  Please read messages above and";
	  print " try again in a few moments\n";
	  exit;
	 }
  } 
}

--Jefferis 02:17, 15 Jan 2005 (UTC)