bug with Fetch, Patch, and Extract dependencies

Today I noticed a bug with the recently added Fetch, Patch, and Extract dependencies. The are correctly displayed on the port page, but not on the dependent port page.

The problem

If you look at sysutils/libchk, you will see lang/ruby20 listed under Extract dependencies. However, at lang/ruby20, there is no mention of Patch, Fetch, or Extract under This port is required by. These three entries are missing from all pages.

On the FreshPorts dev server, I have fixed the problem.

If you look at dev for lang/ruby19, you will see the entries for sysutils/libchk under both Extract and for Patch.

The causes

The problem is caused by two issues:

  1. not loading the port_dependencies table with values for Fetch, Patch, and Extract
  2. not displaying the Fetch, Patch, and Extract dependencies on the web page

In the next section, I’ll show you the patches for the above problems.

loading port_dependencies

The loading of the port_dependencies table occurs during the commit processing. As each commit arrives at the FreshPorts server, the working copy of the ports tree is updated via subversion, and the various values are extracted via make -V.

In this case, the problem was one of inconsistent field names, which led to incorrect code.

You will notice that while I have corrected the field names, they are still inconsistent with other fields. When I first added the Build, Run, and Library depends, I put the depends_ prefix on each field. I like that approach, but the field names are not the same as in the ports tree, where they are known as BUILD_DEPENDS, RUN_DEPENDS, and LIB_DEPENDS, respectively.

When I added the new fields, I used the same name in FreshPorts as used in the ports tree. However, when it came to the following section of code, I fell back to my old ways.

The following patch fixes that.

$ svn di
Index: port.pm
===================================================================
--- port.pm	(revision 4699)
+++ port.pm	(working copy)
@@ -1118,9 +1118,9 @@
   $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{depends_build}   ), 'B' ); # build
   $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{depends_run}     ), 'R' ); # runtime
   $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{depends_lib}     ), 'L' ); # library
-  $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{depends_fetch}   ), 'F' ); # fetch
-  $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{depends_extract} ), 'E' ); # extract
-  $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{depends_patch}   ), 'P' ); # patch
+  $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{fetch_depends}   ), 'F' ); # fetch
+  $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{extract_depends} ), 'E' ); # extract
+  $this->update_depends_helper( $CommitBranch, $this->depends_stripper( $this->{patch_depends}   ), 'P' ); # patch
 }
 
 sub depends_type_long {

Displaying dependencies

The next bug was an act of omission. I neglected to tell the front end that there we new types of values to display. The patch for this bug is:

$ svn di 
Index: port-display.php
===================================================================
--- port-display.php	(revision 4700)
+++ port-display.php	(working copy)
@@ -490,8 +490,9 @@
 				$HTML .= freshports_depends_links($this->db, $port->extract_depends);
 				$HTML .= "\n</ol>\n";
 			}
+			
+			# XXX when adding new depends above, be sure to update the array in ShowDependencies()
 
-			$HTML .= $this->ShowDependencies( $port );
			$HTML .= $this->ShowDependencies( $port );
 		}
 
@@ -599,7 +601,7 @@
     $HTML = '';
 
     $PortDependencies = new PortDependencies( $this->db );
-    $Types = array( 'B' => 'Build', 'L' => 'Libraries', 'R' => 'Run' );
+    $Types = array( 'B' => 'Build', 'E' => 'Extract', 'F' => 'Fetch', 'L' => 'Libraries', 'P' => 'Patch', 'R' => 'Run' );
     foreach ( $Types as $type => $title )
     {
       $NumRows = $PortDependencies->FetchInitialise( $port->id, $type );

That comment at the top is to remind me the next time I add depend links of a new type, there is an array below which needs updating. The first code segment outputs the dependencies for the port you are viewing. The second code segments outputs the This port is required by section of each port page.

Dev now being updated

As I type this, the set-patch-extract-fetch-depends-uses.pl script is running. That should finish by about 0100 UTC on 4 January.

I will post to Twitter when that update is completed.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

1 thought on “bug with Fetch, Patch, and Extract dependencies”

Leave a Comment

Scroll to Top