Maintain packages that were removed from ports repository

I need to provide php73 to my servers and it was removed from ports.

All other parts of the system should be up to date - so I do not want to lock the system with a specific hash of ports.

The idea I have is to get ports clone and omit hash that removed PHP73 ports - then builds it with poudriere as a separate repo with only php73 packages.
The final hosts would receive two repositories: legacy-php73 and current.

git clone https://git.FreeBSD.org/ports.git /usr/ports
git rebase -i cc378fb60bd6ff39ac810093b5fc83cf330c1d92~


Do you have any ideas of best practices how to manage such a situation?
 
You can build packages on a machine that has them installed: pkg create pkgname does it. You can install such packages on another machine (pkg install /path/to/package).

You can lock packages, so updates won't remove old ones: pkg lock packagename

PHP is quite simple to compile by yourself: Use the source, read the docs and compile it as described; You can get PHP 7.3 without any package.

Using the old ports instead isn't an option, as you would also need the old /usr/ports/Mk/Uses/php.mk

But one thing remains: Why does a PHP application still needs an EOL version? You've had over two years to update your code… (and afaik it was quite simple to switch to 7.4 as there weren't huge changes; 8.1 costed me much more time: ~half day for 1 MB plain PHP code). Using PHP means to me: Subscribe their RSS feed, read the changelogs, and check your code with every new, major release. As PHP mostly is used on servers exposed to the internet you've got to look after them anyway.
 
I don't really know where there is a concise documentation about poudriere and overlay, basically you need to add your overlay as a port tree and then tell poudriere to use it as an overlay. A quick search on github give this repository that provide an example on how to use it (NOTE: you don't need the devel version of poudriere)

 
The idea I have is to get ports clone and omit hash that removed PHP73 ports - then builds it with poudriere as a separate repo with only php73 packages.
The IMHO best method is slightly different:

Create a local branch e.g. git checkout -b local
On that branch, revert the commit you don't want with git revert <hash>
Then in the future, you can fetch main and rebase your local branch onto main.

My personal ports tree is an example for one with a custom local branch: https://github.com/Zirias/zfbsd-ports/commits/local
I use the following commands to update it:
Code:
    cd /usr/local/poudriere/ports/default
    git checkout local
    git fetch origin main:main && git rebase main

But: There's a reason old software is removed, often security concerns. Try to solve whatever keeps you from using a newer PHP ASAP.
 
Thanks. poudriere, I'm mostly OK with, so far.

Now, I probably have a better understanding of the scope of overlays:

poudriere ports -c -U https://github.com/decke/ports.git -p decke-ports -m git -B master

– <https://github.com/freebsd/poudriere/wiki/poudriere-ports.8#options> option -p, and it's an expansive overlay.

(NOTE: you don't need the devel version of poudriere)

As far as I can tell, it's needed for poudriere-bulk(8). Option -O:
Cross-reference: auto-generation issues involving wiki pages such as poudriere-testport.8 · Issue #965 · freebsd/poudriere
 
The process I have followed :
Bash:
# Make sure poudriere-devel is installed as it has -O option
pkg install poudriere-devel -y

#make sure you have options set up for /usr/local/etc/poudriere.d/130amd64-options php73 packages - if you don't copy them from php74 they should work.

#get repository with the last commit before removal of PHP73 from official repo
mkdir php73-lastcommit
git clone https://git.FreeBSD.org/ports.git
git revert a60d5b0d747489751077ce93e8e52b44910f8eba

#create a new repository (github/etc)
mkdir php73
git init

#copy all php73 ports from the above repository to the new one and push.
cat /builders/build-packages.list | grep php73 | xargs cp php73-lastcommit/ports/..{} ph.p73/...
#Copy Mk php.mk definitions
cp  php73-lastcommit/ports/Mk/Uses/php.mk .
git add *
git commit -m 'last PHP73 ever'
git push

#create a new repository in poudriere
poudriere ports -c -p php73 -U git@github.com:*****/php73.git -m git+ssh -v

#build update ports
/usr/local/bin/poudriere ports -u

#remove 'php73' MOVED references (tmp) from main REPO ( temporally for a build only )
mv /usr/local/poudriere/ports/default/MOVED /usr/local/poudriere/ports/default/MOVED.old
cat /usr/local/poudriere/ports/default/MOVED.old | grep -v php73 >/usr/local/poudriere/ports/default/MOVED

#Build packages
/usr/local/bin/poudriere bulk -f /builders/build-packages.list -O php73 -j 130amd64

#Bring back original MOVED. Otherwise you will get git stage error when you will be updating ports.
mv /usr/local/poudriere/ports/default/MOVED.old /usr/local/poudriere/ports/default/MOVED
 
Last edited:
Back
Top