Jun 182016
 

This afternoon, Bert JW Regeer wished that FreshPorts “would show information from the quarterly branches too…”.

I knew I had done some work on this and that there was a way to display branch information. I check the source code and found the ?branch= parameter, but there was nothing in the database for this branch.

I discovered several missing items. I apologize that this list will not refer to something you can check. It is mostly for my own notes when i come back to this later.

To try getting one commit into the try, I did this:

cd /usr/FreshPorts/ports-jail/usr/local</li>
sudo mkdir PORTS-2016Q2
sudo chown dan PORTS-2016Q2
cd PORTS-2016Q2
svn co svn://svn.freebsd.org/ports/branches/2016Q2 .

That took some time…

I grabbed a raw email from https://docs.freebsd.org/mail/current/svn-ports-branches.html and used it for testing. It seems that branches.pm needs to contain a hash of all branches we are using. Once I added 2016Q2 to that file, the commit was processed and loaded up.

That allows http://www.freshports.org/?branch=2016Q2 to display something.

Short term

In the short term, this needs to be done:

  1. svn co of each branch of the ports tree (now underway)
  2. Get copy of all emails sent to the svn-ports-branches email list (i.e. https://docs.freebsd.org/mail/archive/svn-ports-branches.html
  3. Remove requirement for each quarterly branch to be listed in branches.pm
  4. Automate the process of checking out each quarterly branch
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

  5 Responses to “Quarterly branches are available”

  1. It seems I can remove the hash from scripts/branches.pm without affecting the code.

  2. Items 1-3 of the above are either moot or completed in my dev environment.

  3. I’ve hit a problem:

    freshports.org=# select name, category, id, element_id, element_pathname(element_id) from ports_active where id in (40945, 41516, 35630);
           name        | category  |  id   | element_id |                  element_pathname                  
    -------------------+-----------+-------+------------+----------------------------------------------------
     mariadb100-client | databases | 41516 |     738175 | /ports/branches/2016Q2/databases/mariadb100-client
     mariadb100-server | databases | 40945 |     735845 | /ports/branches/2016Q2/databases/mariadb100-server
     mariadb100-client | databases | 35630 |     612540 | /ports/head/databases/mariadb100-client
    (3 rows)
    
    freshports.org=# 
    

    The problem arise when the code tries to execute PortsDependenciesAdd( ‘databases/mariadb100-client’, ‘security/openssl’, ‘R’ ). The code picks the branch on head for that, because the table does not cater for branches.

    freshports.org=# \d port_dependencies
             Table "public.port_dependencies"
             Column         |     Type     | Modifiers 
    ------------------------+--------------+-----------
     port_id                | integer      | not null
     port_id_dependent_upon | integer      | not null
     dependency_type        | character(1) | not null
    Indexes:
        "port_dependencies_pkey" PRIMARY KEY, btree (port_id, port_id_dependent_upon, dependency_type)
    Foreign-key constraints:
        "port_dependencies_port_id_dependent_upon_fkey" FOREIGN KEY (port_id_dependent_upon) REFERENCES ports(id) ON UPDATE CASCADE ON DELETE CASCADE
        "port_dependencies_port_id_fkey" FOREIGN KEY (port_id) REFERENCES ports(id) ON UPDATE CASCADE ON DELETE CASCADE
    
    freshports.org=# 
    
  4. But wait, the table does cater for branches, via element_id. Look at this:

    CREATE OR REPLACE FUNCTION GetPort(text) RETURNS int4 AS $$
       DECLARE
          category_port ALIAS for $1;  
          pathname         text;
          port_element_id  int4;
          port_id          int4;
          l_branch         text;
       BEGIN
    --      l_branch := freshports_branch_get();
          SELECT freshports_branch_get()
            INTO l_branch;
    
          RAISE NOTICE ' branch is %', l_branch;
    
          IF l_branch = 'head' THEN   
              pathname := '/ports/head/'                        || category_port;
          ELSE
              pathname := '/ports/branches/' || l_branch || '/' || category_port;
          END IF;
    
          RAISE NOTICE ' GetPort pathname is=%', pathname;
    
          port_element_id := Pathname_ID(pathname);
          IF port_element_id IS NOT NULL THEN
             SELECT id
               INTO port_id
               FROM ports
              WHERE element_id = port_element_id;
          END IF;
    
          RETURN port_id;
       END;
    $$ LANGUAGE 'plpgsql';