CVS-RCS- (ì©lµ{¦¡½Xª©¥»±±¨î¨t²Î) HOW-TO ¤å¥ó §@ªÌ:Al Dev (Alavoor Vasudevan) [1]alavoor@yahoo.com ĶªÌ:Cyril Huang [2]cyril_huang@yahoo.com v7.0, 20 Feb 2000 ½Ķ¤é´Á: 5 April 2000 _________________________________________________________________ ³o¥÷¤å¥ó¬O¤@¥÷ "¹ê»Ú¾Þ§@ªº»¡©ú" ¡A¥H«K©ó¯à¨Ï±z«Ü§Öªº³]©w CVS/RCS ì©l µ{¦¡½X±±¨î¨t²Î¡C³o¥÷¤å¥ó¸Ì¤]¦³¤@¨Ç±N CVS ¤W±`¥Îªº²V¦X©R¥O¥]¦¨¥i³]©wªº shell scripts ¡C³o¨Ç scripts ¬° CVS ´£¨Ñ¤F¤@Ó²³æªº¨Ï¥ÎªÌ¤¶±¡C³o¥÷¤å ¥óªº¤º®e¤£¶È¯à¾A¥Î©ó Linux ¨t²Î¤]¾A¥Î©ó¨ä¥L¹³ Unix ªº¨t²Î¡A¨Ò ¦pSolaris, HPUX, AIX, SCO, Sinix, BSD, SCO µ¥µ¥¡C _________________________________________________________________ 1. ²¤¶ 2. ¨º¤@ºØª©¥»±±¨î¨t²Î¾A¦X§Ú? CVS ©Î RCS 3. ³]©w CVS * 3.1 CVS ªº±M¦³Àô¹ÒÅÜ¼Æ * 3.2 ±q RCS Âà´«¨ì CVS ¨t²Î 4. Shell Scripts * 4.1 sget * 4.2 sedit * 4.3 scommit * 4.4 supdate * 4.5 sunlock * 4.6 slist * 4.7 sinfo * 4.8 slog * 4.9 sdif * 4.10 sadd * 4.11 sdelete * 4.12 sfreeze * 4.13 saddtree 5. CVS ªº¨ä¥L¤å¥ó 6. Emacs ½s¿è¾¹ 7. °ÝÃD¤ÏÀ³¨t²Î (Problem Reporting System) 8. ³o¥÷¤å¥óªº¨ä¥LÀɮ׮榡 9. ª©Åv _________________________________________________________________ 1. ²¤¶ ì©l½X±±¨î¨t²Î¬O¤@Ó¥²¶·¯àºÞ²z¨º¨Ç¦b³nÅép¹ºµo®i®Éì©l½X©Ò°µªº§ïÅÜ¡C³n Åé¶}µoªÌ»Ýn¤@Ó§¹¾ãªºì©l½X§ïÅܾú¥v¬ö¿ý¡A ¥H«K©ó¦bµo¥Í°ÝÃD®É¡A¯à°÷°l ·¹¨ì¥H«eéwªºª©¥»¡C ¬JµMì©lµ{¦¡½X¹ï©ó¥ô¦óªº³nÅép¹º»P¶}µo¡A³£¬Oªá®É ¶¡»Pª÷¿ú¤¤³ÌÃöÁ䪺³¡¤À¡A©Ò¥Hªá®É¶¡ÂǥѨϥÎì©l½X±±¨î¨t²Î¹³ CVS ©M RCS ¨Ó¦w¥þªº«OÅ@(safe-guarding)ì©lµ{¦¡½X¬O«D±`«nªº¡C CVS (Concurrent Version Control System) ¬O¤@Ó¯àÅý«Ü¦hµ{¦¡¶}µoªÌ¦P®É°µ ³nÅé¶}µoªº«D±`±j¤j¤u¨ã¡C¥¦¨Ï¥Î¤FRCS ªºÀɮ׳W©w®æ¦¡¦ý¦h¤F¤@¼h¹³À³¥Îµ{¦¡ ¤¶±ªº¥]¸Ë¡A¬[¦b RCS ªº¤W¼h¡C (Ķµù: RCS ¬O¸û¦Ñªºª©¥»±±¨î¡A¤@Ó¨ü RCS ºÞ¨îªºÀɮ׬ݰ_¨Ó¬O³o¼Ë¤lªº proj1.c,v ¡ACVS ªu¥Î¤F¤@¨Ç RCS ªº³W©w¡C) CVS ¯à°÷¬ö¿ý§AªºÀɮתº¾ú¥v¬ö¿ý( ³q±`¬Oì©lµ{¦¡½X¡A¦ý¬O¨ä¥L«¬ºAªºÀɮ׫h ¤£¤@©w)¡C CVS ¥u¦s¤F¤£¦Pª©¥»¤¤Àɮתº®t²§¡A¦Ó¤£¬O§A©Ò«Ø¥ßªº¨CÓª©¥»¤¤ªº ¨CÓÀɮסC CVS ¤]«O«ù¤F¤@Ó¦ó®É¡A¦ó¤H§ó§ïÀɮסA¬°¤°»ò§ó§ïÀÉ®×µ¥µ¥¤£¦P Æ[ÂIªº¾ú¥v¬ö¿ý¡C CVS ¹ï©ó³nÅ骺µo¦æ©M¦h¤H¦P®É§ó§ï¥Ø«eì©l½XªººÞ²z¬O«D±`ªº¦³À°§U¡C ¥L¨Ã ¤£¥u¬On¹ï³æ¤@¥Ø¿ý¤UªºÀÉ®×´£¨Ñª©¥»±±¨î¡A ¬Û¤Ïªº¡ACVS §ó´£¨Ñ¤F¦h¼h¦³²Õ ´ªº¥Ø¿ýÀɮתºª©¥»±±¨î¡C ¦b³oӥؿý¤U°£¤F§Aªºì©lµ{¦¡½X¥~¡AÁÙ¥]§t¦³¤@ Ó CVS ©Ò«Ø¥ßªº§ïª©±±¨î¥Ø¿ý»PÀɮסC ³o¨Ç¥Ø¿ý»PÀɮ׳̫á³Q¦X¨Ö¦b¤@°_§Î¦¨¤@Ó³nÅ骺µo¦æ¡C CVS ¯à³Q¨Ï¥Î¦b "C", "C++", Java, Perl, HTML ©M¨ä¥LÀɮסC 2. ¨º¤@ºØª©¥»±±¨î¨t²Î¾A¦X§Ú? CVS ©Î RCS CVS ¹ê»Ú¤W¬O¬[¦b RCS ¤§¤Wªº¡A CVS ¥u¬O¤@°ï§ó±j¤j¯à±±¨î¤@Ó¦³§¹¾ãì©lµ{ ¦¡½X¶¥¼h¥Ø¿ýªº¤u¨ã¡C §ÚÌ«D±`±j¯Pªº±ÀÂ˱z¨Ï¥Î CVS¡A¦]¬°±z¯à°÷«Ü¦³¼u©Ê ªº¥Î perl , korn bash shell µ¥ scripts »y¨¥³]©w±z¦Û¤vªº CVS ¨t²Î¡C ½Ð ¬Ý¤@¨Ç korn shell scripts ªº½d¨Ò [3]Shell Scripts ¡C CVS ªºÀuÂI * CVS ¬O«D¶°¤¤¦¡ªººÞ²z¡A¨Ï¥ÎªÌ±qÀx¦sÂd (repository) µn¥X¤@ÓÀɮץؿý ¡A ¨Ã¥B¦³¥L¦Û¤vªº¿W¥ßªºÃ©w¥Ø¿ý¾ð¡C * CVS ¯à°÷¦bµo¦æ¾ãÓp¹ºªºì©l¥Ø¿ý¾ð¤¤"»\¤W¦L°O" ("STAMP")¡C * CVS ¯à°÷¨Ï¤j®a¦P®ÉקïÀɮסC * CVS ¯à°÷¥Î shell scripts ©Î perl ³]©w¦¨ÀÉ®×Âê¦í¦¨³æ¤@¨Ï¥Î©Î¦P®É× §ïÀÉ®×¼Ò¦¡¡C CVS ªº¯ÊÂI * »Ýn¤ñ RCS ¦h¤@ÂIªººÞ²z¡C * «D±`¦¨¼ô½ÆÂøªº¨t²Î¡A¬O¥Ø«eÀ³¥Î¤W¤w¦³ªº³Ì°ª§Þ³N¡C(·PÁºô ¤Ítsaipaw@mars.seed.net.tw¨Ó«H«üÃÒ§Úªº¿ù»~) * ¦³Â×´Iªº©R¥OÁÙ¦³©R¥O¿ï¶µ¡A¦]¦¹¹ï©óªì¾ÇªÌ¨Ó»¡¦³«Ü°~ªº¾Ç²ß¦±½u¡C ² ³æ¨Ï¥Îªº shell scripts ¥i¦b³o¸Ì§ä¨ì [4]Shell Scripts ¡C RCS ªºÀuÂI * RCS «D±`®e©ö³]©w¡C¸û¤Ö¤@¨ÇºÞ²z¤Wªº¤u§@¡C * RCS ¥Î¦b¤@Ó¨CÓ¤H¦b¤@°_¤u§@ªº¶°¤¤°Ï°ì¡C * RCS ¹ï©ó²³æªº¨t²Î«Ü¦³¥Î¡C * «D±`ÄYÂÔªº³æ¤@ÀÉ®×קï¼Ò¦¡ - ¦P¨B»P¦P®É¬O¤£¤¹³\ªº¡C RCS ªº¯Ê¥¢ * ¥Ñ©ó¨Ï¥Î³æ¤@¥Ø¿ý±±¨î»PÀÉ®×Âê¦í¡A¤£¥i¯à¥Ñ«Ü¦hªºµ{¦¡³]pªÌ°µ¦P®Éªº¶} µo¡C¦]¬°³æ¤@¥Ø¿ý¤U«Ü¦h¤H¹ïÀɮתº§ïÅÜ¡A·|³y¦¨ make ªº¨Ï¥Î¿ù»~¡C * ¤£¯à¹ï¾ãÓ³nÅép¹ºÂW¤Wµo¦æ(releases)ªº¦L°O¡C ³o¥÷¤å¥ó¤]¥]§t¤@¨Ç shell scripts ¥H´£¨Ñ²³æªº©R¥O¨Ó§@µn¥X (check-out), µn¿ý (check-in), °e¥æ(commit) Àɮתº°Ê§@¡C ½Ð¬Ý¤@¨Ç shell scripts ªº½d ¨Ò [5]Shell Scripts ¡C ¹ï©ó RCS ¦Ó¨¥¡A½Ð¬Ý Linux CD-ROM ¸Ì±ªºRCS mini-howto¡C _________________________________________________________________ cd /mnt/cdrom/Redhat/RPMS ls -l howto-6.0-*.noarch.rpm rpm -qpl howto-6* | grep -i rcs _________________________________________________________________ ©ÎªÌ¬Ý [6]http://sunsite.unc.edu/LDP/HOWTO/mini/RCS-HOWTO.html 3. ³]©w CVS º¥ý¡A§A»Ýn¦w¸Ë CVS ®M¥ó¡A¦bRedhat Linux ¤W½Ð¥Î _________________________________________________________________ cd /mnt/cdrom/Redhat/RPMS rpm -i rcs*.rpm rpm -i cvs*.rpm To see the list of files installed do - rpm -qpl cvs*.rpm | less _________________________________________________________________ µM«á¥Î j, k, CTRL+f, CTRL+D, CTRL+B, CTRL+U ©Î¤W¤U¥ª¥kÁä, page up/down ÂsÄý¤@¤Uµ²ªG¡C ½Ð¥Î 'man less' ¬d¬Ý less ªº¥Îªk ¦b¨ä¥Lªº unix ¾÷¾¹¤W¡A§A¥i¯à»Ýn¤U¸ü RCS CVS ªº tar.gz ÀɮסA µM«á®Ú¾Ú README, INSTALL Àɪº«ü¥Ü¨Ó¦w¸Ë CVS¡C ½Ð¨ì [7]http://www.cyclic.com ©M [8]http://www.loria.fr/~molli/cvs-index.html 3.1 CVS ªº±M¦³Àô¹ÒÅÜ¼Æ ¤U¦CªºÀô¹ÒÅܼƻÝn¦b /etc/profile Àɤ¤³]©w¡A/etc/profile ¬O¹ï©Ò¦³¨Ï¥Î ªÌ³£¦³®Äªº¤º©wȳ]©wÀÉ¡A ¦pªG¨S¦³³]©w /etc/profile¡A¨º»ò§AÀ³¸Ó¥[³o¨Ç³] ©w¨ì§A¦Û¤vªº³]©wÀÉ /.bash_profile ¤º¡C _________________________________________________________________ export EDITOR=/bin/vi export CVSROOT=/home/cvsroot export CVSREAD=yes _________________________________________________________________ «Ø³y¤@ӥؿý¨Ó¦s§Aì©lµ{¦¡½XªºÀxÂÃÂd (repository) ¨Ã¥Bµ¹¤© unix group »P user Ū¼gªºÅv¤O¡C (Ķµù:³oӥؿý¤U±N·|¦³«Ü¦h§A±N¨Óªºì©l½X¡C) _________________________________________________________________ export CVSROOT=/home/cvsroot mkdir $CVSROOT chmod o-rwx $CVSROOT chmod ug+rwx $CVSROOT _________________________________________________________________ nªì©l¤Æ§Aªº CVS ¡A¨Ã¥B±q²{¦b¶}©l§â§Aªºì©lµ{¦¡½X¥æµ¹ CVS ºÞ²z¡C½Ð°µ - _________________________________________________________________ cvs init (Ķµù¡F³oÓªì©l¤Æªº°Ê§@¦b©ó«Ø³y¤@ÓÀxÂÃÂd¡A¬O¤@ӥؿý$CVSROOT/¡C ¦P®É $CVSROOT/CVSROOT ¤]¦b¦¹®É³Q«Ø³y¡A³oӼҲեؿý¤U±¬O±±¨î§ACVSªºadministrati on files¡A ¸Ì±ªºÀÉ®×°µ¤@¨Çקï«á¡A¥i¥H¨ÏCVS§ó±j¤j¦n¥Î¡C $CVSROOT ¤Uªº¥Ø¿ý¨CÓ³£¬O module ªº·N«ä¡A¤@Ó module ¥i¥H´N¬O¤@Ó±M®×p¹º¡C ¦ý¤]¥i¯à¬O§A§â¤@Óp¹º©î¦¨«Ü¦h module ¡A¤£¦P module ¥æµ¹¤£¦Pªº team ¥hµo®i¡C) # ¤@©wn´«¨ì·Qn CVS ±±¨îªºp¹º¥Ø¿ý¤U³á cd $HOME/my_source_code_dir # §â¾ãӥؿý¯Ç¤JºÞ²z¥Î import ©R¥O cvs import my_source_code_dir V1_0 R1_0 (Ķµù:¨ä¹ê¬O cd ¨ì§Aªºproject¤U«á¡Acvs import ¼Ò²Õ vendor_tag release_tag¡A ¤£¤@©wn¬O¥Ø¿ý¦WºÙ my_source_code_dir¡Avendor_tag, release_tag ¥u¬OÃѧO¥ÎªºªF¦è ¡A ±N¨Ó§A¥i¥H¥Î tag ¨Ó¦s¨ú§Anªº¯S©wª©¥» ³oӰʧ@·|¦b¡@$CVSROOT/¡@¤U¶}Ó" ¼Ò²Õ "ªº¥Ø¿ý¡AµM«á§â my_source_code_dir ¾ãÓ©ñ ¨ì CVS ¤UºÞ²z¡A $HOME/my_source_code_dir ´N¨S¥Î¤F¡Cimport ªº°Ê§@¬O§â¤w¸g¼g¦nªº¤@°ï code Â\¶i¨Ó ¡A ¦pªG±N¨Ó·Q·s¼WÀÉ®×xxxx.c¡A¥²¶·¥ý¼g¦nxxxx.c¡A¦A¥Î cvs add xxxx.c) _________________________________________________________________ 3.2 ±q RCS Âà´«¨ì CVS ¨t²Î nÂà´«¤w¸g¦s¦bªº RCS Àɮרì CVS ¡A½Ð¨Ï¥Î¤U±ªº script ¡C¨Ã½T©w§A±q§Aªº Linux CD-ROM ¦w¸Ë¤F korn shell ®M¥ó pdksh*.rpm¡C ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í _________________________________________________________________ #!/bin/ksh ############################################################# # Program to Migrate the existing source code in RCS to CVS # # Needs the korn shell RPM package pdksh*.rpm from Linux # contrib cdrom ############################################################# # # rcs2cvs - convert source tree from RCS to CVS # # project to convert PROJECT='project' # current RCS root RCSROOT="$HOME/rcs" if cd "$RCSROOT/$PROJECT" then cd "$RCSROOT" else echo >&2 "`basename "$0"`: can't change to RCS directory '$RCSROOT/$PRO JECT'." exit 1 fi # current CVS root CVSROOT="$HOME/cvs" # create new CVS directory for project 'project' if mkdir "$CVSROOT/$PROJECT" then : else echo >&2 "`basename "$0"`: can't create CVS directory '$CVSROOT/$PROJEC T'." exit 2 fi # create CVS project tree from RCS tree find "$PROJECT" -type d -name RCS -print | while read RCS do CVS="`dirname "$RCS"`" (if cd "$RCS" then # if find . -type f -name '*,v' -print | cpio -pdmv "$CVSROOT/$CV S" if find . -type f -print | cpio -pdmv "$CVSROOT/$CVS" then : else echo >&2 "`basename "$0"`: can't convert RCS subdirecto ry '$RCSROOT/$RCS' to CVS subdirectory '$CVSROOT/$CVS'." fi else echo >&2 "`basename "$0"`: can't change to RCS subdirectory '$R CSROOT/$RCS'." fi) done _________________________________________________________________ ²{¦b RCS ¤w¸g³Q§ï¦¨ CVS ¨t²Î¤Uªº 'project'. §A¥i¥H¶}©l¥ÎCVS©R¥O¨Ó¦s¨ú 'project' ³oÓ¼Ò²Õ¤F. 4. Shell Scripts ¤U±ªº scripts ¬O°ò¥» CVS ©R¥Oªº¶°¦X¡A¦Ó¥B¬O Korn shell ªº scripts ¡C §A¥i¥H§â¥LÂন perl ©ÎªÌ bash¡C§A¥i¥H¦Û¤vק令§A·Qnªº¼Ë¤l¡C ³o¨Ç¥u¬O ¹B¥Î°ò¥» CVS ©R¥O¦ý¦³¨Ç¯S®íªºªá¼Ë¥[¦b¸Ì±¡C¨Ò¦p¡A sedit ³oÓ script ´£ ¨Ñ¤FÀÉ®×Âê¦íªº¥\¯à¨Ï±o¨ä¥L¤Hª¾¹D¦³¬Y¤H¥¿¦bקï³oÓÀɮסA ·íµM§A¤]¥i¥H ª½±µ¨Ï¥Î CVS ©R¥O¦Ó¤£¥Î³o¨Ç scripts ¡A³o¨Ç scripts ¥u¬O¦b®i¥Ü CVS ¬O¦h »òªº¦³¼u©Ê¡C §â³o¨Ç scripts ½Æ»s¨ì /usr/local/bin ¤U¡A¨Ã¥B¦¹¥Ø¿ýÀ³¸Ó¦b§Aªº PATH Àô ¹ÒÅܼƤ¤¡C 1. sget [-r revision_number] <file/directory name> n±q CVS Àò±o¤@Ó °ßŪÀɮשξãÓ°ßŪ¥Ø¿ý¡A ½Ð«ö [9]sget 2. sedit [-r revision_number] <filename> nקï¤@Ó¤@Óµ{¦¡½X®É¡A³oÓ scripts ·|°µÀÉ®×Âê¦íªº°Ê§@¡A¦]¦¹¨S¦³§O¤H¥i¥Hµn¥X³oÓÀɮפF¡C·íµM§A ¥i¥H§ïÅܳoÓ script ¦¨§A·Qnªº¥\¯à - ¨Ò¦p¤£Âê¦í¡A¥u¥X²{ĵ§i°T®§¡A ©ÎªÌ¬Û¤Ïªº¡A«D±`ÄYÂÔªºÂêÀɮסC ½Ð«ö [10]sedit 3. scommit [-r revision_number] <filename> n¥æ¥X¬YÓ§Aק諸Àɮשξã ӥؿý¡C §â§Aªº§ïÅܥ浹 CVS¡C ½Ð«ö [11]scommit 4. supdate <filename/directory> nÂǥѱq CVS ±o¨ì³Ì·sªºÀɮרÓupdate ¤@ÓÀɮשξãӥؿý¡C ½Ð«ö [12]supdate 5. sunlock [-r revision_number] <filename> n§â¦]¬°¥Î sedit «áªºÀÉ®× ÂêÃö±¼¡C³o·|ÄÀ©ñÀÉ®×Âê(Release File Lock)¡C ½Ð«ö [13]sunlock 6. slist n¬Ý¥Ø«e¥¿³Q§Aק諸ÀɮצCªí¡C °µ 'ls -l | grep | ...' ©R¥O ¡A ½Ð«ö [14]slist 7. sinfo <filename/directory> n±o¨ì¤@ÓÀɮתº§ïª©¸ê°T¡C ½Ð«ö [15] sinfo 8. slog <filename> n±o¨ì¤@Ó CVS Àɮק睊ªº¾ú¥v¬ö¿ý¡A ½Ð«ö [16]slog 9. sdif <filename> sdif -r rev1 -r rev2 <filename> n±o¨ì§AªºÀÉ®×»P CVS Âd¤l¸ÌªºÀÉ®× ¤£¦Pªº¦a¤è¦bþ¸Ì¡C ½Ð«ö [17]sdif ª`·N: sdif ¥u¦³¤@Ó 'f' ¡A¦]¬°³o¸Ì¤w¸g¦³¤@Ó unix ©R¥O¥s 'sdiff'¡C 10. sadd <filename> n·s¼W¤@ÓÀɮרì CVS Âd¤l¸Ì¡C ½Ð«ö [18]sadd 11. sdelete <filename> n±q CVS Âd¤l¸Ì²M±¼¤@ÓÀɮסC ½Ð«ö [19]sdelete 12. sfreeze <revision name> <directory name> náµ²ì©l½X (freeze codes) ¡A³o¬O±Nnµo¦æ (release) ¾ãÓì©l½X¥Ø¿ý¾ð¡C ½Ð«ö [20] sfreeze 13. saddtree <revision name> <directory name> n·s¼W¤@ӥؿý¾ð¨ì CVS ¡C ½Ð«ö [21]saddtree ¨Ò¦p : _____________________________________________________________ cd $HOME; sfreeze REVISION_1_0 srctree _____________________________________________________________ ³o±N·|áµ²ì©l½X¡A¨Ã¶K¤W¤@Ó¼ÐÅÒ REVISION_1_0 ¡A¦p¦¹¤@¨Ó§A´N¥i¥Hµy «á¥Îª©¥»¦W¦rµn¥X¾ãӥؿý¾ð¡C ****************************************************** 4.1 sget ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program sget # Program to check out the file from CVS read-only cmdname=`basename $0` Usage() { print "\nUsage: $cmdname [-r revision_number/symbolic_tag_name] <file/d irectory name> " print "The options -r are optional " print "For example - " print " $cmdname -r 1.1 foo.cpp" print " $cmdname foo.cpp " print " $cmdname some_directory " print "Extract by symbolic revision tag like - " print " $cmdname -r REVISION_1 some_directory " print " " exit } # Command getopt will not supported in next major release. # Use getopts instead. while getopts r: ii do case $ii in r) FLAG1=$ii; OARG1="$OPTARG";; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 ` #echo FLAG1 = $FLAG1 , OARG1 = $OARG1 if [ $# -lt 1 ]; then Usage fi bkextn=sget_bak hme=` echo $HOME | cut -f1 -d' ' ` if [ "$hme" = "" ]; then print "\nError: \$HOME is not set!!\n" exit fi # Check if file already exists.... if [ -f $1 ]; then user_perms=" " group_perms=" " other_perms=" " user_perms=`ls -l $1 | awk '{print $1 }' | cut -b3-3 ` group_perms=`ls -l $1 | awk '{print $1 }' | cut -b6-6 ` other_perms=`ls -l $1 | awk '{print $1 }' | cut -b9-9 ` if [ "$user_perms" = "w" -o "$group_perms" = "w" \ -o "$other_perms" = "w" ]; then print "\nError: The file is writable. Aborting $cmdname ......" print " You should either backup, scommit or delete the f ile and" print " try $cmdname again\n" exit fi fi cur_dir=`pwd` #echo $cur_dir len=${#hme} len=$(($len + 2)) #echo $len subdir=` echo $cur_dir | cut -b $len-2000 ` #echo $subdir if [ "$subdir" = "" ]; then fdname=$1 else fdname=$subdir"/"$1 fi # Move the file touch $1 2>/dev/null \mv -f $1 $1.$bkextn # Create subshell ( cd $hme #echo $fdname # Use -A option to clear all sticky flags if [ "$FLAG1" = "" ]; then cvs -r checkout -A $fdname else cvs -r checkout -A -$FLAG1 $OARG1 $fdname fi ) #pwd if [ -f $1 ]; then print "\nREAD-ONLY copy of the file $fdname obtained." print "Done $cmdname" #print "\nTip (Usage): $cmdname <file/directory name> \n" fi _________________________________________________________________ 4.2 sedit ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program sedit # Program to check out the file from CVS read/write mode with locking cmdname=`basename $0` Usage() { # print "\nUsage: $cmdname [-r revision_number] [-F] <filename>" # print "The options -r, -F are optional " # print "The option -F is FORCE edit even if file is " # print "locked by another developer" print "\nUsage: $cmdname [-r revision_number] <filename>" print "The options -r are optional " print "For example - " print " $cmdname -r 1.1 foo.cpp" print " $cmdname foo.cpp " # print " $cmdname -F foo.cpp " print " " } # Command getopt will not supported in next major release. # Use getopts instead. #while getopts r:F ii while getopts r: ii do case $ii in r) FLAG1=$ii; OARG1="$OPTARG";; # F) FLAG2=$ii; OARG2="$OPTARG";; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 ` #echo FLAG1 = $FLAG1 , OARG1 = $OARG1 if [ $# -lt 1 ]; then Usage exit fi hme=` echo $HOME | cut -f1 -d' ' ` if [ "$hme" = "" ]; then print "\nError: \$HOME is not set!!\n" exit fi bkextn=sedit_bak cur_dir=`pwd` #echo $cur_dir len=${#hme} len=$(($len + 2)) #echo $len subdir=` echo $cur_dir | cut -b $len-2000 ` #echo $subdir if [ "$subdir" = "" ]; then fdname=$1 else fdname=$subdir"/"$1 fi # If file is already checked out by another developer.... cvs_root=` echo $CVSROOT | cut -f1 -d' ' ` if [ "$cvs_root" = "" ]; then print "\nError: \$CVSROOT is not set!!\n" exit fi cldir=$CVSROOT/$subdir/Locks mkdir $cldir 2>/dev/null rcsfile=$CVSROOT/$subdir/$1,v #echo $rcsfile if [ ! -e $rcsfile ]; then print "\nError: File $1 does not exist in CVS repository!!\n" exit fi # Get the tip revision number of the file.... # Use tmpfile as the arg cannot be set inside the sub-shell tmpfile=$hme/sedit-lock.tmp \rm -f $tmpfile 2>/dev/null if [ "$FLAG1" = "" ]; then ( cd $hme cvs log $fdname | head -6 | grep head: | awk '{print $2}' > $tmpfile ) OARG1=`cat $tmpfile` \rm -f $tmpfile 2>/dev/null fi lockfile=$cldir/$1-$OARG1 #if [ -e $lockfile -a "$FLAG2" = "" ]; then if [ -e $lockfile ]; then print "\nError: File $1 Revision $OARG1 already locked by another devel oper !!" aa=` ls -l $lockfile | awk '{print "Locking developers unix login name is = " $3}' ` print $aa print "That developer should do scommit OR sunlock to release the lock" print " " # print "You can also use -F option to force edit the file even if" # print "the file is locked by another developer. But you must talk to" # print "other developer to work concurrently on this file." # print "For example - this option is useful if you work on a seperate" # print "C++ function in the file which does not interfere with other" # print "developer." # print " " exit fi # Get read-only copy now.... if [ ! -e $1 ]; then ( cd $hme cvs -r checkout $fdname 1>/dev/null ) fi # Check if file already exists.... if [ -f $1 ]; then user_perms=" " group_perms=" " other_perms=" " user_perms=`ls -l $1 | awk '{print $1 }' | cut -b3-3 ` group_perms=`ls -l $1 | awk '{print $1 }' | cut -b6-6 ` other_perms=`ls -l $1 | awk '{print $1 }' | cut -b9-9 ` if [ "$user_perms" = "w" -o "$group_perms" = "w" \ -o "$other_perms" = "w" ]; then print "\nError: The file is writable. Aborting $cmdname ......" print " You must backup, scommit or delete file and" print " try $cmdname again\n" exit fi #print "\nNote: The file $1 is read-only." #print "Hence I am moving it to $1.$bkextn ....\n" \mv -f $1 $1.$bkextn chmod 444 $1.$bkextn elif [ -d $1 ]; then print "\nError: $1 is a directory and NOT a file. Aborting $cmdname ... .\n" exit fi # Create subshell print "\nNow getting the file $1 from CVS repository ...\n" ( cd $hme #echo $fdname # Use -A option to clear the sticky tag and to get # the HEAD revision version if [ "$FLAG1" = "" ]; then cvs -w checkout -A $fdname else cvs -w checkout -A -$FLAG1 $OARG1 $fdname fi ) if [ -e $1 ]; then touch $lockfile fi #pwd print "\nDone $cmdname" #print "\nTip (Usage): $cmdname <filename> \n" _________________________________________________________________ 4.3 scommit ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program scommit # Program to commit the changes and check in the file into CVS cmdname=`basename $0` Usage() { print "\nUsage: $cmdname [-r revision_number] <filename>" print "The options -r are optional " print "For example - " print " $cmdname -r 1.1 foo.cpp" print " $cmdname foo.cpp " print " " } # Command getopt will not supported in next major release. # Use getopts instead. while getopts r: ii do case $ii in r) FLAG1=$ii; OARG1="$OPTARG";; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 ` #echo FLAG1 = $FLAG1 , OARG1 = $OARG1 if [ $# -lt 1 ]; then Usage exit 2 fi if [ -d $1 ]; then Usage exit 2 fi hme=` echo $HOME | cut -f1 -d' ' ` if [ "$hme" = "" ]; then print "\nError: \$HOME is not set!!\n" exit fi # Find sub-directory cur_dir=`pwd` #echo $cur_dir len=${#hme} len=$(($len + 2)) #echo $len subdir=` echo $cur_dir | cut -b $len-2000 ` #echo $subdir if [ "$subdir" = "" ]; then fdname=$1 else fdname=$subdir"/"$1 fi # If file is already checked out by another user.... cvs_root=` echo $CVSROOT | cut -f1 -d' ' ` if [ "$cvs_root" = "" ]; then print "\nError: \$CVSROOT is not set!!\n" exit fi cldir=$CVSROOT/$subdir/Locks mkdir $cldir 2>/dev/null # Get the working revision number of the file.... # Use tmpfile as the arg cannot be set inside the sub-shell tmpfile=$hme/sedit-lock.tmp \rm -f $tmpfile 2>/dev/null if [ "$FLAG1" = "" ]; then ( cd $hme cvs status $fdname 2>/dev/null | grep "Working revision:" | awk '{print $3}' >$tmpfile ) OARG1=`cat $tmpfile` \rm -f $tmpfile 2>/dev/null fi if [ "$OARG1" = "" ]; then print "The file $fdname is NEW, it is not in the CVS repository" else lockfile=$cldir/$1-$OARG1 if [ -e $lockfile ]; then # Check if this revision is owned by you... aa=` ls -l $lockfile | awk '{print $3}' ` userid=`id | cut -d'(' -f2 | cut -d')' -f1 ` if [ "$aa" != "$userid" ]; then print " " print "The file $fdname is NOT locked by you!!" print "It is locked by unix user name $aa and your logi n name is $userid" # print "If you are working concurrently with other devel oper" # print "and you used -F option with sedit." print "You need to wait untill other developer does sco mmit" print "or sunlock" print "Aborting the $cmdname ...." print " " exit 2 fi else if [ -f $CVSROOT/$subdir/$1,v ]; then print "You did not lock the file $fdname with sedit!!" print "Aborting the $cmdname ...." exit 2 else print "\nThe file $fdname does not exist in CVS reposit ory yet!!" print "You should have done sadd on $fdname ...." fi fi fi if [ -d $1 ]; then Usage exit 2 # Do not allow directory commits for now ... #cvs commit else cvs commit $1 exit_status=$? fi if [ $exit_status -eq 0 ]; then print "\nDone $cmdname. $cmdname successful" #print "\nTip (Usage): $cmdname <filename/directory name>\n" fi _________________________________________________________________ 4.4 supdate ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program supdate # Program to update the file from CVS read/write mode cmdname=`basename $0` if [ $# -lt 1 ]; then print "\nUsage: $cmdname <filename>" exit fi # Check if file already exists.... if [ $# -gt 0 -a -f $1 ]; then user_perms=" " group_perms=" " other_perms=" " user_perms=`ls -l $1 | awk '{print $1 }' | cut -b3-3 ` group_perms=`ls -l $1 | awk '{print $1 }' | cut -b6-6 ` other_perms=`ls -l $1 | awk '{print $1 }' | cut -b9-9 ` if [ "$user_perms" = "w" -o "$group_perms" = "w" \ -o "$other_perms" = "w" ]; then while : do print "\n$cmdname will backup your working file " print "$1 to $1.supdate_bak before doing any merges." print "Are you sure you want the merge the changes from " print -n "CVS repository to your working file ? <y/n> [ n]: " read ans if [ "$ans" = "y" -o "$ans" = "Y" ]; then if [ -f $1.supdate_bak ]; then print "\nWarning : File $1.supdate_bak already exists!!" print "Please examine the file $1.supda te_bak and delete it" print "and than re-try this $cmdname " print "Aborting $cmdname ...." exit else cp $1 $1.supdate_bak break fi elif [ "$ans" = "n" -o "$ans" = "N" -o "$ans" = "" -o " $ans" = " " ]; then exit fi done fi fi if [ -d $1 ]; then print "\nDirectory update is disabled as cvs update" print "merges the changes from repository to your working directory" print "So give the filename to update - as shown below: " print " Usage: $cmdname <filename>" exit # cvs update else cvs update $1 fi print "\nDone $cmdname. $cmdname successful" #print "\nTip (Usage): $cmdname <filename/directory name>\n" _________________________________________________________________ 4.5 sunlock ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx. _________________________________________________________________ #!/bin/ksh # CVS program sunlock # Program to unlock the file to release the lock done by sedit cmdname=`basename $0` Usage() { print "\nUsage: $cmdname [-r revision_number] <filename>" print " The options -r is optional " print "For example - " print " $cmdname -r 1.1 foo.cpp" print " $cmdname foo.cpp " print " " } # Command getopt will not supported in next major release. # Use getopts instead. while getopts r: ii do case $ii in r) FLAG1=$ii; OARG1="$OPTARG";; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 ` if [ $# -lt 1 ]; then Usage exit fi hme=` echo $HOME | cut -f1 -d' ' ` if [ "$hme" = "" ]; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd` #echo $cur_dir len=${#hme} len=$(($len + 2)) #echo $len subdir=` echo $cur_dir | cut -b $len-2000 ` #echo $subdir if [ "$subdir" = "" ]; then fdname=$1 else fdname=$subdir"/"$1 fi # If file is already checked out by another user.... cvs_root=` echo $CVSROOT | cut -f1 -d' ' ` if [ "$cvs_root" = "" ]; then print "\nError: \$CVSROOT is not set!!\n" exit fi cldir=$CVSROOT/$subdir/Locks rcsfile=$CVSROOT/$subdir/$1,v #echo $rcsfile if [ ! -e $rcsfile ]; then print "\nError: File $1 does not exist in CVS repository!!\n" exit fi # Get the tip revision number of the file.... # Use tmpfile as the arg cannot be set inside the sub-shell tmpfile=$hme/sedit-lock.tmp \rm -f $tmpfile 2>/dev/null if [ "$FLAG1" = "" ]; then ( cd $hme cvs log $fdname | head -6 | grep head: | awk '{print $2}' > $tmpfile ) OARG1=`cat $tmpfile` \rm -f $tmpfile 2>/dev/null fi lockfile=$cldir/$1-$OARG1 #echo lockfile is : $lockfile if [ ! -e $lockfile ]; then print "\nFile $1 revision $OARG1 is NOT locked by anyone" print " " exit fi ans="" while : do print "\n\n***************************************************" print "WARNING: $cmdname will release lock and enable other" print " developers to edit the file. It is advisable" print " to save your changes with scommit command" print "***************************************************" print -n "\nAre you sure you want to unlock the file <y/n>? [n]: " read ans if [ "$ans" = "" -o "$ans" = " " -o "$ans" = "n" -o "$ans" = "N" ]; the n print "\nAborting $cmdname ...." exit fi if [ "$ans" = "y" -o "$ans" = "Y" ]; then print "\n\n\n\n\n " print "CAUTION: You may lose all the changes made to file!!" print -n "Do you really want to unlock the file <y/n>? [n]: " read ans if [ "$ans" = "y" -o "$ans" = "Y" ]; then break else exit fi else print "\n\nWrong entry. Try again..." sleep 1 fi done if [ -e $lockfile ]; then \rm -f $lockfile print "\nDone $cmdname" else print "\nFile $1 is NOT locked by anyone" print " " fi _________________________________________________________________ 4.6 slist ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program slist # Program to list all edited source files from CVS #cmdname=`basename $0` #echo "no of params : " $# #echo "all args : " $@ recurse_flag="" if [ "$1" = "" ]; then dir=. recurse_flag="" else dir=$@ recurse_flag=" -prune " fi FOUT=slist_temporary_file.out \rm -f $FOUT find $dir $recurse_flag -type f -exec ls -ltr {} \; \ | grep -v "/CVS/" \ | grep ^\-rw \ | grep -v \\.o \ | grep -v \\.log \ | grep -v \\.out \ | grep -v \\.pid \ | awk '{ if ($NF != "tags") print $0 }' \ | awk '{ if ($NF != "a.out") print $0 }' \ | awk '{ if ($NF != "core") print $0 }' \ | awk '{ print $NF }' > $FOUT aa=`cat $FOUT` \rm -f $FOUT for ii in $aa ; do ftype=" " ftype=`file $ii | awk '{print $2 }' ` # find . -type f -exec file {} \; # 1)ELF 2)commands 3)[nt]roff, 4)c 5)English 6)executable # 7)ascii 8)current 9)empty # Binaries are ELF, lib.a are current # if [ "$ftype" = "ascii" -o "$ftype" = "commands" \ -o "$ftype" = "[nt]roff," -o "$ftype" = "c" -o "$ftype" = "data " \ -o "$ftype" = "English" -o "$ftype" = "executable" ]; then pcfile=` echo $ii | cut -d'.' -f1` pcfile=${pcfile}".pc" if [ ! -f $pcfile ]; then ls -l $ii else if [ "$ii" = "$pcfile" ]; then ls -l $ii fi fi fi done; #| grep -v ^\-rwx \ #ls -l | grep ^\-rw | grep -v \\.o #ls -l | grep ^\-rw | grep -v \\.o | awk '{ if ($NF != "tags") print $0 }' #ls -l | grep ^\-rw | grep -v ^\-rwx | grep -v \\.o | awk '{ if ($NF != "tags" ) print $0 }' | awk '{ if ($NF != "core") print $0 }' #print "\nDone $cmdname. $cmdname successful" #print "\nTip (Usage): $cmdname <filename>\n" _________________________________________________________________ 4.7 sinfo ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program sinfo # Program to get the status of files in working directory cmdname=`basename $0` if [ $# -lt 1 ]; then print "\nUsage: $cmdname [file/directory name] " print "For example - " print " $cmdname foo.cpp" print " $cmdname some_directory " print " " exit fi hme=` echo $HOME | cut -f1 -d' ' ` if [ "$hme" = "" ]; then print "\nError: \$HOME is not set!!\n" exit fi tmpfile=$hme/cvs_sinfo.tmp rm -f $tmpfile cur_dir=`pwd` #echo $cur_dir len=${#hme} len=$(($len + 2)) #echo $len subdir=` echo $cur_dir | cut -b $len-2000 ` #echo $subdir if [ "$subdir" = "" ]; then fdname=$1 else fdname=$subdir"/"$1 fi # Create subshell if [ -f $1 ]; then ( cd $hme clear cvs status $fdname ) elif [ -d $1 ]; then ( cd $hme clear echo " " >> $tmpfile echo " ****************************************" >> $tmpfile echo " Overall Status of Directory" >> $tmpfile echo " ****************************************" >> $tmpfile cvs release $fdname 1>>$tmpfile 2>>$tmpfile << EOF Y EOF echo "\n -------------------------------\n" >> $tmpfile aa=`cat $tmpfile | grep ^"M " | awk '{print $2}' ` for ii in $aa do jj="(cd $hme; cvs status $subdir/$ii );" echo $jj | /bin/sh \ | grep -v Sticky | awk '{if (NF != 0) print $0}' \ 1>>$tmpfile 2>>$tmpfile done cat $tmpfile | grep -v ^? | grep -v "Are you sure you want to release" \ | less rm -f $tmpfile ) else print "\nArgument $1 if not a file or directory" exit fi _________________________________________________________________ 4.8 slog ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program slog # Program to list history of the file in CVS cmdname=`basename $0` if [ $# -lt 1 ]; then print "\nUsage: $cmdname <filename> \n" exit fi # Check if file does not exist.... if [ ! -f $1 ]; then print "\nError: $1 is NOT a file. Aborting $cmdname ......" exit fi cvs log $1 | /usr/local/bin/less print "\nDone $cmdname. $cmdname successful" #print "\nTip (Usage): $cmdname <filename>\n" _________________________________________________________________ 4.9 sdif ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program sdif # Program to see difference of the working file with CVS copy cmdname=`basename $0` Usage() { print "\nUsage: $cmdname <filename> " print "$cmdname -r<rev1> -r<rev2> <filename> \n" exit } FLAG1="" FLAG2="" OARG1="" OARG2="" # Command getopt will not supported in next major release. # Use getopts instead. while getopts r:r: ii do case $ii in r) if [ "$FLAG1" = "" ]; then FLAG1=$ii; OARG1="$OPTARG" else FLAG2=$ii; OARG2="$OPTARG" fi ;; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 ` if [ "$FLAG2" = "" ]; then FLAG2=r OARG2=HEAD fi if [ "$FLAG1" = "" ]; then cvs diff -r HEAD $1 | less else cvs diff -$FLAG1 $OARG1 -$FLAG2 $OARG2 $1 | less fi _________________________________________________________________ 4.10 sadd ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # test # CVS program sadd # Program to add the file to CVS cmdname=`basename $0` if [ $# -lt 1 ]; then print "\nUsage: $cmdname <filename/directory> \n" exit fi # Check if file exists .... if [ -f $1 ]; then cvs add $1 exit fi if [ ! -d $1 ]; then print "\nArgument $1 is not a file and not a directory!" print "Usage: $cmdname <filename/directory> \n" exit fi # Argument is a directory name ..... hme=` echo $HOME | cut -f1 -d' ' ` if [ "$hme" = "" ]; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd` len=${#hme} len=$(($len + 2)) subdir=` echo $cur_dir | cut -b $len-2000 ` if [ "$subdir" = "" ]; then if [ -d $CVSROOT/$1 ]; then print "\nDirectory $1 already exists in CVSROOT" exit else # You are adding at root directory $CVSROOT if [ "$2" = "" -o "$3" = "" ]; then print "\nUsage: $cmdname <directory> <vendor tag> <rele ase tag>" print "For example - " print " $cmdname foo_directory V_1_0 R_1_0" exit else ( cd $1; cvs import $1 $2 $3 ) fi fi else # If current directory exists in CVS... if [ -d $CVSROOT/$subdir ]; then if [ -d $CVSROOT/$subdir/$1 ]; then print "\nDirectory $1 already in CVS repository!" else cvs add $1 fi else print "\nSub-directory $subdir does not exist in CVS" print "You need to first add $subdir to CVS" exit fi fi _________________________________________________________________ 4.11 sdelete ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program sdelete # Program to delete the file from CVS cmdname=`basename $0` if [ $# -lt 1 ]; then print "\nUsage: $cmdname <filename> \n" exit fi # Check if file does not exist.... if [ ! -f $1 ]; then # Try to get the file from CVS sget $1 if [ ! -f $1 ]; then print "\nError: $1 does NOT exist in CVS repository. Aborting $ cmdname ......" exit fi fi bkextn=cvs_sdelete_safety_backup \mv -f $1 $1.$bkextn cvs remove $1 print "\nsdelete command removes the file from CVS repository" print "and archives the file in CVS Attic directory. In case" print "you need this file in future than contact your CVS administrator" print " " print "\nDone $cmdname. $cmdname successful" #print "\nTip (Usage): $cmdname <filename>\n" \mv -f $1.$bkextn $1 _________________________________________________________________ 4.12 sfreeze ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx _________________________________________________________________ #!/bin/ksh # CVS program sfreeze # Program to freeze and cut out the release of source tree from CVS cmdname=`basename $0` Usage() { print "\nUsage: $cmdname symbolic_tag <directory name> " print "\nFor example :- " print " cd \$HOME" print " $cmdname REVISION_1 mesa" print "To see the list of revisons do -" print "slog <filename> and see the symbolic name and do -" print "cvs history -T" print "\nTo create a branch off-shoot from main trunk, use" print "the -b and -r options which makes the tag a branch tag. This is" print "useful for creating a patch to previously released software" print "For example :- " print " cd \$HOME" print " cvs rtag -b -r REVISION_1 REVISION_1_1 mesa" print " " # print "\nTag info is located at \$CVSROOT/CVSROOT/taginfo,v" # print "You can do - cd $HOME; sget CVSROOT" # print "to see this file" exit } # Command getopt will not supported in next major release. # Use getopts instead. #while getopts r: ii #do # case $ii in # r) FLAG1=$ii; OARG1="$OPTARG";; # ?) Usage; exit 2;; # esac #done #shift ` expr $OPTIND - 1 ` #echo FLAG1 = $FLAG1 , OARG1 = $OARG1 if [ $# -lt 2 ]; then Usage fi if [ ! -d $2 ]; then print "\nError: Second argument $2 is not a directory!" print " Aborting $cmdname...." print " " exit fi # cvs rtag symbolic_tag <directory name> cvs rtag $1 $2 print "\nDone $cmdname. $cmdname successful" _________________________________________________________________ 4.13 saddtree ª`·N : Korn shell /bin/ksh ¦b§A±qLinux CD-ROM ¦w¸Ë pdksh*.rpm ®É´N·|²£ ¥Í ½Ð§â¥L¦s¦¨¤@¯ë¤å¦rÀɨçïÅܦs¨úÅv chmod a+rx¡C _________________________________________________________________ #!/bin/ksh ################################################################ # Sample Program to checkin a directory tree (let's say SAMP) into CVS # Note that if SAMP directory is not in CVS than you would use sadd # command and - # cd SAMP; cvs import SAMP V_1_0 R_1_0 # After running this program do - # cd $HOME/foo/SAMP # cvs import foo/SAMP V1_0 Rev_1_0 ################################################################ hme=` echo $HOME | cut -f1 -d' ' ` if [ "$hme" = "" ]; then print "\nError: \$HOME is not set!!\n" exit fi sampdir=$hme/foo/SAMP check_out_files() { # Now check out the files tmp2f=$hme/tmp2.baksamp.sh cd $hme \rm -rf foo/SAMP cvs -w checkout foo/SAMP cd $hme/foo find SAMP -type f -print > $tmp2f cd $hme for ii in `cat $tmp2f` do iidir=`dirname $ii` iifile=`basename $ii` if [ "$iifile" = "Root" -o "$iifile" = "Repository" -o "$iifile " = "Entries" ]; then continue fi jjdir=` echo $iidir | cut -d'/' -f2-1000 ` cp $hme/foo/SAMP.tobe/$jjdir/$iifile $hme/foo/$iidir/$iifile echo "cp $hme/foo/SAMP.tobe/$jjdir/$iifile $hme/foo/$iidir/$ii file " cvs add foo/$iidir/$iifile done print print "================================================" print " Now run cvs commit foo/SAMP" print " After commit. Do - " print " cd foo; rm -rf SAMP and " print " get fresh copy, sget SAMP" print " Verify with slog filename.samp to see new revision" print "================================================" print } check_out_files _________________________________________________________________ 5. CVS ªº¨ä¥L¤å¥ó ¦b unix ´£¥Ü²Å¸¹¤U¡A½Ð¥´ - 1. cvs --help 2. cvs --help-options 3. cvs --help-commands 4. cvs -H checkout 5. cvs -H commit 6. man cvs 7. man tkcvs 8. ºô¯¸ [22]http://www.cyclic.com 9. ºô¯¸ [23]http://www.loria.fr/~molli/cvs-index.html 10. (Ķµù:©ÎªÌ¦b unix ´£¥Ü²Å¸¹¤U¥´ info cvs ¤]¥i±o¨ì¤@¼Ëªº°T®§) 11. (Ķµù:³o½g¤]¤£¿ù²³æ©úÁA) [24] http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/cvs/ tkcvs [25]http://www.tkcvs.org ¬O CVS ªº Tcl/Tk GUI ¤¶±¡C³o¸Ì¤]¦³½u¤W ¨D§U¡C * cd $HOME/src/foo.cpp * tkcvs * ¦b foo.cpp ¤WÂI¤@¤U * ¦b 'spectacle Icon' ®ÇÃ䪺 'Revision Log Icon' ÂI¤@¤U¡C * ³o±N·|Åã¥Ü¤@Ó Tree ²Õ´ªº¹Ï¦bµøµ¡¸Ì¡CµM«á¦b¤å¦r '1.3' ¤W¥Î·Æ¹«ªº ¥kÁäÂI¤@¤UÁÙ¦³ '1.1' ·Æ¹«ªº¥ªÁäÂI¤@¤U¡AµM«á¦AÂI¤@¤U "Diff" ¡C³o¼Ë ±N·|Åã¥Ü¨âÓµøµ¡¥X¨Ó!! * ¦b "Next" ¤WÂI¤@¤U±N·|Åã¥Ü§ó¦hª©¥»'1.3' »P '1.1' ªº diffs¡C ½Ð«ö "Center" ±N¤å¦r¹ï»ô¸m¤¤¡C (Ķµù:³oÃäì¤å¦n¹³¦³²æ»~) ³o¸Ì¤]¦³ Windows 95 ¥Îªº CVS ³á¡A¥s WinCVS¡C [26]http://www.wincvs.org WinCVS ¥i¥H¥Î¦b Samba ¨t²Î¤W³á - [27]http://www.samba.org °ò¥»«nªº©R¥O - * cvs checkout <filename > * cvs update <filename> * cvs add <file, ..> * cvs remove <file, ..> * cvs commit <file> * cvs status <filename> * cvs log <filename> * cvs diff -r1.4 -r1.5 <filename> ³o¦æ«ü¥O±N·|¿é¥XÀÉ®× filename 1.4 ª©©M 1.5 ª©ªº®t²§¦bþ¸Ì¡C 6. Emacs ½s¿è¾¹ Emacs ¬O«D±`±j¤jªº½s¿è¾¹¦Ó¥BÁ٤䴩¤F CVS/RCS - ¤×¨ä¬O¹ï©ó§ïª©«áªº¦X¨Ö ©M¤ñ¸û¡C Emacsªº¥Dnºô¯¸¦b [28]http://www.emacs.org. 7. °ÝÃD¤ÏÀ³¨t²Î (Problem Reporting System) ¦ñÀHµÛ CVS ªº¨Ï¥Î¡A§A¥i¯à·|·Qn¥Îp¹º°lÂܨt²Î(Project Tracking system) ©Î°ÝÃD¤ÏÀ³¨t²Î(Problem Reporting System)¡C¨C¤@Ó³nÅép¹º»Ýn°ÝÃD¤ÏÀ³¨t ²Î¨Ó§@ bugs ªº¦^³ø»P°lÂÜ¡A¨Ã¥B§â¬ÛÃöt³d³¡¤À¡A¤À°tµ¹¤£¦Pªºµ{¦¡³]p®v¡C ·Qª¾¹Dp¹º°lÂܨt²Î(Project Tracking system)½Ð¬Ý³oÓºô¯¸ [29] http://www.stonekeep.com¡C 8. ³o¥÷¤å¥óªº¨ä¥LÀɮ׮榡 ³o¥÷¤å¥ó¥Î¤F±Nªñ 10 Ó¤£¦PªºÀɮ׮榡¨Óµo¦æ - DVI, Postscript, Latex, LyX, GNU-info, HTML, RTF(Rich Text Format), Plain-text, Unix man pages and SGML¡C * §A¥i¥H¦b¤U±ªº Web Àò±o³æ¤@ªº HTML, DVI, Postscript or SGML «¬¦¡ªº tar.gz ÀɮסA [30] ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/other-formats/ ©ÎªÌ [31]ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/other-formats/ * Plain text ®æ¦¡ªº¦b: [32] ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO¡A ©ÎªÌ [33] ftp://metalab.unc.edu/pub/Linux/docs/HOWTO * ½Ķ¦¨¨ä¥L°ê®a»y¨¥¹³¬Oªk¤å¡A¼w¤å¡A¦è¯Z¤ú¤å¡A¤¤¤å¡A¤é¤åµ¥µ¥¥i¦b¤U± ºô§}§ä±o¨ì¡C [34]ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO ©ÎªÌ [35]ftp://metalab.unc.edu/pub/Linux/docs/HOWTO ¹ï©ó¥ô¦ó·Q½Ķ³o¥÷ ¤å¥ó¨ì¨ä¥L»y¨¥¬O³£Åwªïªº¡C ³o¥÷¤å¥ó¬O¥Î¤@ºØ¥s "SGML" ªº¤u¨ã¼g¦¨ªº¡C§A¥i¥H±q¤U¦Cºô§}±o¨ì - [36] http://www.xs4all.nl/~cg/sgmltools/ ½sĶì©l½X«á¡A§A´N·|±o¨ì¤U¦C©R¥O¡A ¹³¬O * sgml2html cvs-rcs-howto.sgml (²£¥Í html ÀÉ®×) * sgml2rtf cvs-rcs-howto.sgml (²£¥Í RTF ÀÉ®×) * sgml2latex cvs-rcs-howto.sgml (²£¥Í latex ÀÉ®×) ³o¥÷¤å¥ó¬O¦ì©ó - * [37]http://sunsite.unc.edu/LDP/HOWTO/CVS-RCS-HOWTO.html §A¤]¥i¥H¦b¤U±¬M®gºô¯¸§ä¨ì³o¥÷¤å¥ó - * [38]http://www.caldera.com/LDP/HOWTO/CVS-RCS-HOWTO.html * [39]http://www.WGS.com/LDP/HOWTO/CVS-RCS-HOWTO.html * [40]http://www.cc.gatech.edu/linux/LDP/HOWTO/CVS-RCS-HOWTO.html * [41]http://www.redhat.com/linux-info/ldp/HOWTO/CVS-RCS-HOWTO.html * ¨ä¥L¤ñ¸û¾aªñ§Aªº¬M®gºô¯¸ [42] http://sunsite.unc.edu/LDP/hmirrors.html ¿ï¾Ü¨ä¤¤¤@Óºô¯¸¨Ã¨ì³oÓ ¥Ø¿ý /LDP/HOWTO/CVS-RCS-HOWTO.html ·Q¬Ý dvi ®æ¦¡ªº¤å¥ó¡A½Ð¥Î xdvi ¡CY쥻¨S¦w¸Ë¡A¥i¦b Redhat Linux ¤Uªº tetex-xdvi*.rpm ®M¥ó¤¤§ä±o¨ì¡Cn¤£µM¥i¥H¸g¥Ñ®à±¤WªºControlPanel | Applications | Publishing | TeX menu buttons§ä¨ì¥L¡C ·Q¬Ý dvi ®æ¦¡ªº¤å¥ó¡A½Ð¤U©R¥O - xdvi -geometry 80x90 howto.dvi¡A ¨Ã¥B¥Î·Æ¹«½Õ¾ãµøµ¡¤j¤p¡C½Ð¬Ý xdvi ªº½u¤W¨D§U man xdvi¡C ¨Ï¥Î¤è¦VÁä¡A Page Up, Page Down ¨ÓÀ˵ø¤å¥ó¡C§A¤]¥i¥H¥Î 'f', 'd', 'u', ' c', 'l', 'r', 'p', 'n'¨Ó²¾°Ê¡C nÃö±¼±M®a¼Ò¦¡ menu ½Ð«ö x ¡C §A¥i¥H¥Î³nÅé 'gv' (ghostview) ©Î 'ghostscript' ¨ÓŪ postscript ÀɮסC ¦b Redhat Linux ¤U¡Aghostscript ¦b ghostscript*.rpm ®M¥ó¸Ì¡A gv ¦b gv*.rpm ®M¥ó¸Ì¡A ¦pªG§A¤w¸g¸Ë¤F³oÓÀ³¥Îµ{¦¡¡A¥i¥H³z¹L ControlPanel | Applications | Graphics menu ¸Ì§ä¨ì¡A gv ¬O¤ñ ghostscript §ó¤Íµ½¨Ï¥Î ¡CGhostscript ©M gv ¤]¥i¥H¦b¨ä¥L§@·~¥¥x¦p OS/2, windows 95 ©M NT ¤U¨Ï ¥Î¡C nŪ postscript ¤å¥ó¡A½Ð¤U³oÓ©R¥O - gv howto.ps ¥Î ghostscript ½Ð¥´ - ghostscript howto.ps §A¥i¥H¥Î Netscape Navigator, Microsoft Internet explorer, Redhat Baron Web browser ©Î¨ä¥LÂsÄý¾¹¨ÓŪ HTML ®æ¦¡ªº¤å¥ó¡C §A¥i¥H¥Î¤@Ó latex ªº "X-Windows" ¤¶±³nÅé¥s°µ LyX ªº¡A¨ÓŪ latex ©Î LyX ªº¿é¥X¡C 9. ª©Åv ³o¥÷¤å¥óª©Åv¬° GNU GPL¡A¦ý¬O½Ð¦b©Ò¦³ªº½Æ»s¤¤«O¯dì§@ªÌªº¦W¦r»P¹q¤l¶l¥ó ¦a§}¡C References 1. mailto:alavoor@yahoo.com 2. mailto:cyril_huang@yahoo.com 3. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#Shell Scripts 4. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#Shell Scripts 5. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#Shell Scripts 6. http://sunsite.unc.edu/LDP/HOWTO/mini/RCS-HOWTO.html 7. http://www.cyclic.com/ 8. http://www.loria.fr/~molli/cvs-index.html 9. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#sget 10. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#sedit 11. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#scommit 12. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#supdate 13. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#sunlock 14. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#slist 15. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#sinfo 16. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#slog 17. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#sdif 18. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#sadd 19. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#sdelete 20. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#sfreeze 21. file://localhost/tmp/zh-sgmltools.18019/CVS-RCS-HOWTO.txt.html#saddtree 22. http://www.cyclic.com/ 23. http://www.loria.fr/~molli/cvs-index.html 24. http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/cvs/ 25. http://www.tkcvs.org/ 26. http://www.wincvs.org/ 27. http://www.samba.org/ 28. http://www.emacs.org/ 29. http://www.stonekeep.com/ 30. ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/other-formats/ 31. ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/other-formats/ 32. ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO 33. ftp://metalab.unc.edu/pub/Linux/docs/HOWTO 34. ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO 35. ftp://metalab.unc.edu/pub/Linux/docs/HOWTO 36. http://www.xs4all.nl/~cg/sgmltools/ 37. http://sunsite.unc.edu/LDP/HOWTO/CVS-RCS-HOWTO.html 38. http://www.caldera.com/LDP/HOWTO/CVS-RCS-HOWTO.html 39. http://www.WGS.com/LDP/HOWTO/CVS-RCS-HOWTO.html 40. http://www.cc.gatech.edu/linux/LDP/HOWTO/CVS-RCS-HOWTO.html 41. http://www.redhat.com/linux-info/ldp/HOWTO/CVS-RCS-HOWTO.html 42. http://sunsite.unc.edu/LDP/hmirrors.html