跳转至内容

在线 OsiriX 文档/使用 getosirixCVS.pl

来自 WikiBooks,面向开放世界的开放书籍

< | ^

我编写了一个 perl 脚本(或者更准确地说,从 BibDesk 网站摘取而来)来获取名为 getosirixCVS.pl 的 Osirix 源代码。将此脚本下载到您的计算机上。最简单的方法可能是将其保存到您的开发目录。我的目录是 /Users/jefferis/dev。转到终端并按如下所示运行

gjg5:~/dev jefferis$ perl getosirixCVS.pl

回答问题,如果您使用匿名 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:[email protected]:/cvsroot/osirix login

Password is empty--just hit return when asked for a password
Executing: cvs -z3 -d:pserver:[email protected]:/cvsroot/osirix login
(Logging in to [email protected])
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:[email protected]:/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

如果您使用开发人员访问,则会得到一个类似这样的响应

*******************************
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:[email protected]:/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.
[email protected]'s password:
cvs checkout: Updating osirix
U osirix/AdvancedQuerySubview.h
U osirix/AdvancedQuerySubview.m
...

瞧!

以下是 perl 脚本。另存为 getosirixCVS.pl。如果您有选择,请确保使用 Unix 换行符,否则 perl 会出现错误提示。

#!/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)

华夏公益教科书