portdowngrade - A Simple Way To Get Back to
Previous Versions of FreeBSD Ports.
Hosted by: SourceForge Logo


       portdowngrade [-o] [-s cvs-server] [-l logfile] [-t time] port-name


       Upgrading the installed software on FreeBSD is quite easy: Use cvsup(1)
       to copy the head revision of the ports tree from a cvs repository  into
       your  local ports tree and install the upgraded port f.e. by using por-
       tupgrade(1).  But how can you go back to an older relase if the	latest
       version	turns  out to be not flawless? As ports do not carry port spe-
       cific version labes in the CVS repository, cvs(1) has to be used  manu-
       ally  to  inspect all commits into the ports cvs tree. portdowngrade(1)
       simplifies this work.  It analyzes the history of commits to  the  port
       and presents the user a list of changes. By selecting one, the port can
       be set back to a previous version easily.  See  chapter	INTERNALS  for
       more  details.  Afterwards  portupgrade(1)  can be used to install this
       previous version.


	      the name of the port. Might be "portname" or "category/portname"
	      and  my  optionally  be terminated with a "$" indicating that no
	      trailing characters are allowed. So mozilla includes (among oth-
	      ers) www/mozilla, www/mozilla-devel and x11-fonts/mozilla-fonts.
	      mozilla$ includes only www/mozilla (from the 3 mentioned above),
	      while www/mozilla includes www/mozilla and www/mozilla-devel.

       -s cvs-server

       --server cvs-server
	      CVS  server  root directory. If not set, the CVSROOT environment
	      variable is used. Example:


       -l logfile

       --logfile logfile
	      logfile to collect debug information

       -t time

       --maxTime time
	      maximum time difference (in seconds) to treat cvs  commits  with
	      the same comment as belonging together. Default: 10 seconds


	      execute a "cvs login" before all other cvs commands. Afterwards,
	      the password for the choosen cvs server should have been	stored
	      in  the ~/.cvspass file, if it exists, so that this option is no
	      longer required.
       or  a  "$". If portname contains one of them, everything before the "/"
       and after the "$" is removed to get the pure port name. Then

	   make search name=purename | grep ^Path: | grep portname

       is executed in the ports directory. In both cases all result lines  are
       used. If more than one is received, the user has to choose one.

       Afterwards portdowngrade performs six steps

       Step 0: Preparation

	   If the option -o was set, a

	   cvs -d cvs-server login

	   is executed. This will prompt the user for the
	   cvs password.

       Step 1: Checking out port from CVS repository

	   In this step a temporary directory is create and

	   cvs -Qf co -d port ports/portname

	   is executed within this directory. This copies the HEAD
	   revision of the port into the temporary directory.
	   If the -s option is given, this and all cvs commands
	   below get the additional option d cvs-server.

       Step 2: Reading the port history from the CVS repository

	   In this step

	   cvs -Qf log > tempfile

	   is executed within the temporary directory. This returns a
	   logfile with all commit actions taken on the port.

       Step 3: Analyzing the port history from the CVS repository

	   In this step the ports commit history returned from step 2 is
	   analyzed. Each entry is scanned for the line "Working file: " to
	   get the filename and for "date: " after a dashed line to get the
	   commit date and time. All lines after the date are stored as
	   the commits comment.

	   Afterwards all found log entries are ordered by the commit date.
	   If two log entries
	     - have the same commit time or
	     - have the same comment which is larger than 256 characters or

	   commit event. This Makefile is scanned for the strings "PORTVERSION="
	   and, if this was not found, "DISTNAME=". The text following is the
	   version which was committed in the corresponding commit. This
	   information, together with the data collected in step 3, are
	   presented to the user in a list, which is growing slowly
	   (aproximately one line per returned Makefile version). The user can
	   watch the list growing or interupt by pressing one of the following
	   keys. Within this Step, the user can interactively press one of the
	   following keys:
	     - <Space>: display the next page,
	     - p: display the previous page,
	     - d: show details (the full comment) of a specific commit and
	     - <enter>: choose a commit event and leave the presentation.
	   If enter is pressed the user has to enter a commit number (all
	   events are numbered). Entering nothing returns to the presentation.
	   Entering 0 terminates portdowngrade. A vaild number leads to

       Step 5: Checking out choosen date of the port from the CVS repository

	   In this step a new temporary directory is created and

	   cvs -Qf co -fd synch -D "date GMT" ports/portname

	   is executed within this directory, where date is the date
	   of commit event choosen by the user. This copies corresponding
	   revision into the temporary directory.

       Step 6: Modifying the port

	   Up to now just temporary files are touched which will be deleted if
	   portdowngrade(1) terminates. In this step the port is deleted and the
	   reqested files are copied into the ports directory. Now the port is
	   set back to the requested older state.

	   portupgrade -f portname

	   will install it, if portupgrade(1) is installed. Note, that the next


	   will set the port back to its head revision!


       You  are  questioning  my  code? You are questioning my honor! (Klingon


       Heiner Eichmann <h.eichmann@gmx.de>


       cvs(1), cvsup(1), portupgrade(1)

Man(1) output converted with man2html