As you know, I’ve been working on branches this long holiday weekend. Today, I managed to get the display of a port on a branch to correctly.
Along the way, I discovered a downside to storing raw data in the database. Take for example this output:
freshports.org=# select name, depends_run from ports_active where depends_run is not null limit 1; name | depends_run ---------------+--------------------------------------------------------------- p5-Net-NBName | /usr/local/bin/perl5.20.2:/usr/local/PORTS-head/lang/perl5.20 (1 row)
This is the output of make -V RUN_DEPENDS. You will notice that this repo is not in /usr/ports. In itself, that is OK, except when you change the directory, like I did earlier this month, when I moved everything into /usr/local/repos. After time, this field throughout the database will contain a mixture of the two root directories. This won’t do, because the website needs to strip off the root directory to get at the category/port combination at the end of the file.
Yes, I could just try taking the last of the string, starting at the second to last slash, but that’s not what I want to do. I want to store the raw data, because that’s what make -V gave me. Thus, I will update the data to make sure it is up to date with current directories.
The solution I used was:
update ports set depends_run = replace(depends_run, ':/usr/local/', ':/usr/local/repos/'), depends_lib = replace(depends_lib, ':/usr/local/', ':/usr/local/repos/'), depends_build = replace(depends_build, ':/usr/local/', ':/usr/local/repos/'); update ports set depends_run = replace(depends_run, ':/usr/local/repos/repos/', ':/usr/local/repos/'), depends_lib = replace(depends_lib, ':/usr/local/repos/repos/', ':/usr/local/repos/'), depends_build = replace(depends_build, ':/usr/local/repos/repos/', ':/usr/local/repos/');
That second update was to reverse any updates to already-correct values.
This change was on my development server. I won’t need to do this update on the production server because that repo has not changed locations.
This problem has recurred on the new FreshPort server (x8dtu). Looking at production (supernews), I see the issue is there too.
I’m going to have a closer look at this and fix it.
I this case, I have copied the production database to another server. On that new location, the repos are stored in a different location.
I’m going to see if I can strip the repo names from make -V
I am not sure why the system wants to store
flex:/var/db/repos/PORTS-head/textproc/flex
instead of
flex:textproc/flex
There is a fair bit of code which is dedicated to this goal.