Friday, May 14, 2010

Portdowngrade – Downgrade to Previous Version of FreeBSD’s Ports

Portdowngrade – Downgrade to Previous Version of FreeBSD’s Ports

After you upgrade or update the FreeBSD’s ports, you may found out that there is some buys with the lastest version of a package. For example, after I ran CVSup on all ports collection on my FreeBSD server
, it updated my subversion to svn version 1.3.0-rc2. The problem is, when I tried to restart Apache server, there is error that saying mod_dav_svn.so is missing.

Tried to re-compile the SVN server is of no help, as it simply won’t want to compile mod_dav_svn.so source, due to a bug in the Makefile which simply won’t recognize WITH_MOD_DAV_SVN=yes setting. So to go back to the original (or previous) version of subversion (or any other package or ports), use portdowngrade.

Without portdowngrade, a lot of works need to be done: Investigates the port changes in the cvs repository through FreeBSD’s the web interface, the insepcts all commit comments to find out which file versions are a older working release, and after downloads and copies these file to the correct location in the ports tree, then only the port can be downgraded by the usual FreeBSD port mechanism.

portdowngrade helps to downgrade FreeBSD ports by analyzing the history of commits to the port and presenting the user the list of changes. By selecting one, the port can be set back to a previous version easily. In other words, portdowngrade automatizes all these steps, from inspecting the cvs repository to showing all commit comments up to checking out a specific release and copying it into the ports tree. With just a few key presses a lot of work is saved.

Install Portdowngrade

To install sysutils/portdowngrade, use the following commands:

cd /usr/ports/sysutils/portdowngrade
make install clean

If you want to define DEFAULT_CVS_SERVER, use the following command (it’s recommended to define the server):

make DEFAULT_CVS_SERVER=\”:server_string:/home/ncvs\” install

Replace server_string with pserver:anoncvs@anoncvs.at.FreeBSD.org, one of the FreeBSD anoncvs server.

You may use any other available anoncvs servers which listed at Anonymous CVS.

Using portdowngrade

To run portdowngrade, issue the following command:

usr/local/sbin/portdowngrade portname (portname my be prefixed by category/ and postfixed by $)

or simply (if it’s within the path):

portdowngrade portname (portname my be prefixed by category/ and postfixed by $)

If you didn’t specify which CVS server to use when installation, you may specify it via command line by using “- s cvs-server or –server cvs-server option. For example, -s:pserver:anoncvs@anoncvs.FreeBSD.org:/home/ncvs

Other options available include -l or –logfile filename to specify logfile which collects debug information, -t or –maxTime time to specify maximum time difference (in seconds) to treat cvs commits with the same comment as belonging together (default: 10 seconds), -o or –login to execute a “cvs login” before all other cvs commands (if ~/.cvspass file that stores the password exists, this option is no longer required).

Then (of after login if applicable), portdowngrade will performs 6 steps (only after 6 steps will there be changes to the system):

Step 1: Checking out port from CVS repository

Step 2: Reading the port history from the CVS repository

Step 3: Analyzing the port history from the CVS repository

Step 4: Load port version numbers and present results (If more than 1 pages, use space to go to next page, p for previous page, d for details, and enter to leave the port history display. After that, select the version you wish to downgrade to or 0 change nothing).

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

Step 6: Modifying the port (Type yes to downgrade the port, or no to abort).

Note: portdowngrade only changes the port, not the installed software
!

After 6 steps, the selected port has been set to the selected older version. Continue by install the port. If you have portupgrade installed, use the following command to see the changes in the ports database:

portsdb -Uu

To ‘downgrade’ the installed port, issue command:

portupgrade -f portname

Note: If you run cvsup, the port will be changed back to the latest version!

No comments: