master / slave relationships

As reported by sem@, there is a problem with the display of master/slave relationships within FreshPorts. The relationship is stored in the ports table, with the master_port attribute being a pointer to the master port. This text field typically has values such as this:   SELECT DISTINCT(master_port)     FROM ports_active where master_port <> '' AND  master_port not like '/usr/home/dan/%' ORDER BY master_port    LIMIT 10;
(10 rows)

The query to find any slave ports of a given port is:

SELECT id          AS slave_port_id,
       name        AS slave_port_name,
       category_id AS slave_category_id,
       category    AS slave_category_name
  FROM ports_active
 WHERE master_port = 'sysutils/bacula-server'
ORDER BY slave_category_name, slave_port_name

Which, on my development server at home, for sysutils/bacula-server gives:

 slave_port_id | slave_port_name | slave_category_id | slave_category_name
         13986 | bacula-client   |                20 | sysutils
(1 row)

The problem is: bacula-server is not listing bacula-client as a slave port. For that matter, in production, bacula-client isn’t listing bacula-server as its master port either. Strange. Very strange. It must be something very simple that has gone wrong here. This has worked in the past.

FreshPorts determines the MASTERPORT through make -V magic. Something like this:

[dan@ngaio:~/ports/sysutils/bacula-client] $ make -V MASTERPORT \
PORTSDIR=~/ports LOCALBASE=/nonexistentlocal X11BASE=/nonexistentx
[dan@ngaio:~/ports/sysutils/bacula-client] $

This magic is accomplished with this patch:

$ less ~/bin/
--- 10 Jun 2004 07:30:19 -0000      1.491
+++ 22 Jun 2004 13:48:33 -0000
@@ -913,6 +913,16 @@


+# Try to determine if we are a slave port.  These variables are used by
+# FreshPorts and portsmon, but not yet by the ports framework itself.
+.if ${MASTERDIR} != ${.CURDIR}
+IS_SLAVE_PORT?=        yes
+MASTERPORT?=   ${MASTERDIR:C/[^\/]+\/\.\.\///:C/[^\/]+\/\.\.\///:C/^.*\/([^\/]+\/[^\/]+)$/\1/}
+IS_SLAVE_PORT?=        no
 # If they exist, include, then architecture/operating
 # system specific Makefiles, then local Makefile.local.

So something, somewhere has allowed this information to be wrong. A few days ago, I did notice that my cvsup crontab was going wrong and was not correctly patching the file after the upgrade. Perhaps that was it.

Running a few commits manually shows that is the problem. An unpatched Mk/*.

I’ll work on getting that fixed and then run a script to check for a master port for each port.

Website Pin Facebook Twitter Myspace Friendfeed Technorati Digg Google StumbleUpon Premium Responsive

2 thoughts on “master / slave relationships”

  1. I recently learned that ports/Mk/ contains code for MASTER_PORT, very similar to MASTERPORT in the patch above. This is great for FreshPorts. It simplifies things. I no longer have to keep track of files to patch. I no longer have to patch the files on the fly as commits occur. And I no longer have to patch after a cvsup of the working ports tree.

    I have changed the code on my development box last night. It looks good so far. It will eventually go into production.

Leave a Comment

Scroll to Top