Aug 072012
 

Every port has one primary category. This is the directory under which the port can be found. For example. the primary category for sysutils/bacula-server is sysutils. The primary category is always a physical directory on disk within the ports tree.

A port can reside within more than one category. For example, net/pear-Net_SMTP has two secondary categories: mail pear

The categories are specified in the CATEGORIES variable in the Makefile:

$ grep CATEGORIES Makefile
CATEGORIES=     net mail www pear
$ make -V CATEGORIES
net mail www pear
$

The primary category must always be included in CATEGORIES. During repo copies (i.e. svn mv), this change can be overlooked. To detect this situation and bring it to the attention of the commiter, I have created the following sanity check:


$ cvs di port.pm
Index: port.pm
===================================================================
RCS file: /home/repositories/freshports-1/scripts/port.pm,v
retrieving revision 1.65
diff -r1.65 port.pm
772a773,793
>       # verify that CATEGORIES contains the primary category
>       # make sure that $this->{categories} contains $this->{category}
>       my $CATEGORIES = "www mail editors";
>       my $category = "editor";
>
>       my @categories = split(/ /, $this->{categories});
>
>       my $primaryCategoryFound = 0;
>       for (@categories) {
>          my ($category) = $_;
>             if ($this->{category} eq $category)
>             {
>               $primaryCategoryFound = 1;
>             last;
>             }
>       }
>
>       if (!$primaryCategoryFound) {
>         $ErrorMsg = "The CATEGORIES value ('" . $this->{categories} . "') does not contain the primary category ('" . $this->{category} . "')";
>       }
>

I’ll let that run in dev for a while before promoting it.

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