Last last night, after renaming some buildlists, which were actually setnames, for poudriere, I realized that files in /usr/local/etc/poudriere.d also needed to be renamed.
In this post:
- poudriere 3.3.7
- nginx 1.20.1_2,2
- Both running on FreeBSD 13.0-RELEASE-p4
These are my renamed files:
[dan@pkg01:/usr/local/etc/poudriere.d]: $ ls *primary* primary-make.conf primary-poudriere.conf primaryi386-make.conf primaryi386-poudriere.conf
The output of svn status illustrates the changes I made:
[dan@pkg01:/usr/local/etc/poudriere.d]: $ svn st D master-list-i386-make.conf > moved to primaryi386-make.conf D master-list-i386-poudriere.conf > moved to primaryi386-poudriere.confa D master-list-make.conf > moved to primary-make.conf D master-list-poudriere.conf > moved to primary-poudriere.conf M ports/default/timestamp M ports/dvl-git/mnt M ports/testing/timestamp A + primary-make.conf > moved from master-list-make.conf A + primary-poudriere.conf > moved from master-list-poudriere.conf A + primaryi386-make.conf > moved from master-list-i386-make.conf A + primaryi386-poudriere.confa > moved from master-list-i386-poudriere.conf
Next, I’ll do the Nginx aliases.
Nginx Aliases
These are the old directories for which I want aliases:
drwxr-xr-x 3 root wheel 11 May 23 21:33 13i386-default-master-list-i38686 [dan@pkg01:/usr/local/poudriere/data/packages]: $ ls -ld *master-list* | egrep -e '122|13' drwxr-xr-x 3 root wheel 13 Aug 28 04:18 122amd64-default-master-list drwxr-xr-x 4 root wheel 14 Aug 11 08:36 122amd64-dvl-master-list drwxr-xr-x 3 root wheel 13 Aug 28 04:22 122i386-default-master-list-i386 drwxr-xr-x 3 root wheel 13 Aug 28 04:22 13amd64-default-master-list drwxr-xr-x 3 root wheel 13 Aug 8 16:13 13amd64-dvl-master-list drwxr-xr-x 4 root wheel 5 Aug 27 16:55 13i386-default-master-list drwxr-xr-x 3 root wheel 13 Aug 28 04:26 13i386-default-master-list-i386 drwxr-xr-x 3 root wheel 11 May 23 21:33 13i386-default-master-list-i38686
These are what they will be aliased to:
[dan@pkg01:/usr/local/poudriere/data/packages]: $ ls -ld *primary* drwxr-xr-x 3 root wheel 13 Aug 29 05:20 122amd64-default-primary drwxr-xr-x 3 root wheel 13 Aug 29 06:37 122i386-default-primaryi386 drwxr-xr-x 3 root wheel 13 Aug 29 08:38 13amd64-default-primary drwxr-xr-x 3 root wheel 13 Aug 29 10:14 13i386-default-primaryi386
Not everything will be aliased:
- 13i386-default-master-list-i38686 is a typo – I put one too many 86’s in the build name
- Anything containing dvl is me running testport
The configuration file at /usr/local/etc/nginx/nginx.conf already contains:
location /packages { root /usr/local/poudriere/data; autoindex on; index index.html index.htm; }
Let’s start with this host for testing:
[dan@empty:~] $ pkg -vv | grep url url : "pkg+http://fedex.int.unixathome.org/packages/13amd64-default-master-list/",
For testing, I first created this file:
[dan@pkg01:/usr/local/poudriere/data/packages]: $ sudo touch 13amd64-default-master-list/THINGS
Then browsed to the above mentioned URL and saw the empty file THINGS listed there. OK, this proves I’m looking at the old data.
Next, I added an alias, which failed. I’ll explain why later.
location /packages/13amd64-default-master-list { alias /packages/13amd64-default-primary; }
That gives a 404:
2001:470:8abf:[redacted] - - [29/Aug/2021:16:35:03 +0000] "GET /packages/13amd64-default-master-list/ HTTP/1.1" 404 153 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15"
Why? The target of the alias should be a directory, not a URL. Let’s try this instead:
Let’s try this instead:
location /packages/13amd64-default-master-list { alias /usr/local/poudriere/data/packages/13amd64-default-primary; }
That is an improvement, but gives a Forbidden.
Let’s try this, just like /packages above.
location /packages/13amd64-default-master-list { alias /usr/local/poudriere/data/packages/13amd64-default-primary; autoindex on; index index.html index.htm; }
That works, and as shown by the screen shot, there is no THINGS file, so I know I’m in the right place.
NOTE: I’ll go back and delete that file later.
Rewrite may be better
I think rewrite is better than alias for this situation.
Let’s try it:
Based on the documentation, I’ll try this:
# master-list became primary - to help poudriere with hyphens in set # names - see https://dan.langille.org/2021/08/28/poudriere-warning-using-in-a-setname-is-not-recommended-as-it-causes-ambiguities-with-parsing-the-build-name-of-122amd64-default-master-list/ rewrite ^(/packages/.*)master-list/(.*)$ $1primary/$2 last; rewrite ^(/packages/.*)master-list-i386/(.*)$ $1primaryi386/$2 last;
That is much cleaner and replaces the entire location directive I was using.
Further testing
For more testing, I created WRONG files in the old directories:
[dan@pkg01:/usr/local/poudriere/data/packages]: $ sudo touch 122amd64-default-master-list/WRONG [dan@pkg01:/usr/local/poudriere/data/packages]: $ sudo touch 122i386-default-master-list-i386/WRONG [dan@pkg01:/usr/local/poudriere/data/packages]: $ sudo touch 13amd64-default-master-list/WRONG [dan@pkg01:/usr/local/poudriere/data/packages]: $ sudo touch 13i386-default-master-list/WRONG [dan@pkg01:/usr/local/poudriere/data/packages]: $ sudo touch 13i386-default-master-list-i386/WRONG
NOTE: 13i386-default-master-list is wrong by definition. It should never be built. It should always be: 13i386-default-master-list-i386 with the trailing -i386. That is my naming convention.
There is nothing in there but my file:
[dan@pkg01:/usr/local/poudriere/data/packages]: $ ls -l 13i386-default-master-list total 1 -rw-r--r-- 1 root wheel 0 Aug 29 16:50 WRONG [dan@pkg01:/usr/local/poudriere/data/packages]: $ ls -dl 13i386-default-master-list drwxr-xr-x 4 root wheel 6 Aug 29 16:50 13i386-default-master-list [dan@pkg01:/usr/local/poudriere/data/packages]: $
I suspect a failed build, halted when I realized my error. I’m removing it:
[dan@pkg01:/usr/local/poudriere/data/packages]: $ sudo rm -rf 13i386-default-master-list [dan@pkg01:/usr/local/poudriere/data/packages]: $
When I commented out those rewrite statements, restarted nginx and browsed to all those URLs, I saw WRONG listed.
Conclusion: the rewrite work. I’m keeping them.
EDIT: 2021-09-04 – still working well. Success.