Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 1996 17:57:33 +0200
From:      "Julian H. Stacey" <jhs@freebsd.org>
To:        A JOSEPH KOSHY <koshy@india.hp.com>
Cc:        phk@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: ctm & disc full 
Message-ID:  <199609271557.RAA20468@vector.jhs.no_domain>
In-Reply-To: Your message of "Wed, 25 Sep 1996 09:26:48 %2B0500." <199609250426.AA112135608@fakir.india.hp.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Hi, Reference:
> From: A JOSEPH KOSHY <koshy@india.hp.com> 
> 
> There are a couple of new options in -current CTM that may help you:
> 
> -B filename	backups whatever would be modified to `filename' before
> 		applying any patches.
> 
> -l 		shows what would be touched
> 
> -e regex	specify `include' and `exclude' regexes which you can
> -x regex	use to touch parts of the source tree

Ah, Thanks Joseph, -B wasn't in my /usr/sbin tree from 1 Sep,
so I've recompiled & installed the new stuff.

> Something like the following would be helpful
> 
> 	cd your-source-directory
> 
> 	for i in somewhere/ctm-files*.gz; do
> 
> 		ctm -B $i.back -v -v $i		# apply CTM patch
> 
> 		if [ $? = 0 ]; then # all ok
> 			rm -f $i.back
> 		else
> 			echo "ctm patch $i failed."
> 			exit 1
> 		fi
> 
> 	done
> 

Hey that sounds good !

> So if you do encounter problems you could 
> 
> Run:
> 	ctm -l ctm-file.gz > list-of-files-that-change
> 
> Then:
> 	ctm -e exp -x exp -e exp ... ctm-file.gz
> 
> to selectively update what got missed out.
> 
> OR:
> 	restore from the backup file and re-apply the Ctm patch.
> 
> Hope this helps,
> Koshy

Right, I'm modifying my shell script now to do this,
Thanks Koshy

But I need that -B available to ctm_rmail & it's not there
... so I've added it, patch attached.
(also available as
	http://www.freebsd.org/~jhs/src/bsd/fixes/FreeBSD/src/generic/\
		usr.sbin/ctm/ctm_rmail/ctm_rmail.c.backup.diff
)
-------------
This allows 
	ctm_rmail -B backup_dir
to pass the
	-B backup_dir 
down to
	ctm -B backup_dir
I didn't bother to test it, i've simply compiled & installed it
on my (jhs@freebsd.org) system 960927.

*** old/src/usr.sbin/ctm/ctm_rmail/ctm_rmail.c	Fri Sep 27 18:19:04 1996
--- new/src/usr.sbin/ctm/ctm_rmail/ctm_rmail.c	Fri Sep 27 18:51:17 1996
***************
*** 28,33 ****
--- 28,34 ----
  char *piece_dir = NULL;		/* Where to store pieces of deltas. */
  char *delta_dir = NULL;		/* Where to store completed deltas. */
  char *base_dir = NULL;		/* The tree to apply deltas to. */
+ char *backup_dir = NULL;	/* The tree to make backups in. */
  int delete_after = 0;		/* Delete deltas after ctm applies them. */
  int apply_verbose = 0;		/* Run with '-v' */
  int set_time = 0;		/* Set the time of the files that is changed. */
***************
*** 62,68 ****
  
      err_prog_name(argv[0]);
  
!     OPTIONS("[-Dfuv] [-p piecedir] [-d deltadir] [-b basedir] [-l log] [file ...]")
  	FLAG('D', delete_after)
  	FLAG('f', fork_ctm)
  	FLAG('u', set_time)
--- 63,69 ----
  
      err_prog_name(argv[0]);
  
!     OPTIONS("[-Dfuv] [-p piecedir] [-d deltadir] [-b basedir] [-B backup_dir] [-l log] [file ...]")
  	FLAG('D', delete_after)
  	FLAG('f', fork_ctm)
  	FLAG('u', set_time)
***************
*** 71,76 ****
--- 72,78 ----
  	STRING('d', delta_dir)
  	STRING('b', base_dir)
  	STRING('l', log_file)
+ 	STRING('B', backup_dir)
      ENDOPTS
  
      if (delta_dir == NULL)
***************
*** 198,206 ****
  	if (stat(fname, &sb) < 0)
  	    break;
  
! 	sprintf(buf, "(cd %s && ctm %s%s%s%s) 2>&1", base_dir,
  				set_time ? "-u " : "",
! 				apply_verbose ? "-v " : "", here, fname);
  	if ((ctm = popen(buf, "r")) == NULL)
  	    {
  	    err("ctm failed to apply %s", delta);
--- 200,211 ----
  	if (stat(fname, &sb) < 0)
  	    break;
  
! 	sprintf(buf, "(cd %s && ctm %s%s%s%s%s%s) 2>&1", base_dir,
  				set_time ? "-u " : "",
! 				apply_verbose ? "-v " : "", 
! 				(backup_dir == NULL) ? "" : "-B ",
! 				(backup_dir == NULL) ? "" : backup_dir,
! 				here, fname);
  	if ((ctm = popen(buf, "r")) == NULL)
  	    {
  	    err("ctm failed to apply %s", delta);
*** old/src/usr.sbin/ctm/ctm_rmail/ctm_rmail.1	Fri Sep 27 19:11:06 1996
--- new/src/usr.sbin/ctm/ctm_rmail/ctm_rmail.1	Sat Aug 31 11:49:56 1996
***************
*** 26,32 ****
  .Op Fl p Ar piecedir
  .Op Fl d Ar deltadir
  .Op Fl b Ar basedir
- .Op Fl B Ar backup_dir
  .Op Ar
  .Sh DESCRIPTION
  In conjuction with the
--- 26,31 ----
***************
*** 119,128 ****
  (or if
  .Li .ctm_status
  does not exist).
- .It Fl B Ar backup_dir
- Specify a backup directory for use by
- .Nm ctm
- .Fl B
  .It Fl D
  Delete deltas after successful application by
  .Xr ctm .
--- 118,123 ----
-------------

Maybe someone will want to test the patch or commit it later ?

Julian
--
Julian H. Stacey	jhs@freebsd.org  	http://www.freebsd.org/~jhs/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609271557.RAA20468>