# Converting from portmaster to pkg/poudriere



## freejetz888 (Apr 5, 2017)

I am looking to switch from using portmaster management to pkg/poudriere for management.  I already have poudriere setup on an outside system and I am using it for some machines which I built using the poudriere setup from the beginning.  I would like to begin using the poudriere/pkg setup for my older machines which have been using ports/portmaster from the beginning. All of the machines are running FreeBSD 11.0.

I found this post which seems to go into detail about the necessary steps but I am unsure of the date and I am curious if these steps are still necessary.

https://people.freebsd.org/~wollman/converting-to-pkg-repository.html

Has anyone performed a conversion like this or have any tips/guidance for getting this done?

Any help would be greatly appreciated.


----------



## getopt (Apr 5, 2017)

Basically the linked guide should work ... but
1. Do not expect that you will succeed on the first try
2. Give you time for playing with Poudriere first before starting to deploy to your production systems
3. You will need to setup a local webserver i.e. Nginx in your LAN.
4. You will need to config pkg to use the new repository/s
5. Think about what your systems (not) have in common to make use of what Poudriere calls "sets". 
6. You might want to use Ccache which has to be activated in poudriere.conf

No 1) in the guide only has the purpose to get a list of your installed ports for creating a "bulk" list which Poudriere uses for building the ports. You will need such a list from every system you want to deploy to. You will need to merge these lists and probably split them for use with sets. But this task I would start when Poudriere is installed and tested thoroughly.

Edit after 2nd reading 


freejetz888 said:


> I already have poudriere setup on an outside system and I am using it for some machines which I built using the poudriere setup from the beginning. I would like to begin using the poudriere/pkg setup for my older machines which have been using ports/portmaster from the beginning. All of the machines are running FreeBSD 11.0.


So do you want to use your existing "outside" Poudriere? Then your task is mainly No 1) of the guide and what I wrote under 4.


----------



## rigoletto@ (Apr 6, 2017)

This guide may be helpful at some points.


----------



## freejetz888 (Apr 6, 2017)

getopt said:


> Basically the linked guide should work ... but
> 1. Do not expect that you will succeed on the first try
> 2. Give you time for playing with Poudriere first before starting to deploy to your production systems
> 3. You will need to setup a local webserver i.e. Nginx in your LAN.
> ...




Thanks for the quick reply.  Yes I will be using my existing poudriere and configuring pkg to use that repo.  Going to give the guide a try and see how it goes on a test machine.  My main concern was with dependencies and ensuring a smooth conversion from one to the other.


----------



## rigoletto@ (Apr 6, 2017)

In regards to consistency (however it is not needed), when you have everything built by Poudriere and configured, you can:


save your origins files list
`pkg delete` them all, and `pkg autoremove` (basically remove everything)
delete everything in /var/db/pkg
reinstall the origins files.
It will not touch your configuration files, or anything you customized. Quite safe procedure.


----------



## freejetz888 (Apr 6, 2017)

lebarondemerde said:


> In regards to consistency (however it is not needed), when you have everything built by Poudriere and configured, you can:
> 
> 
> save your origins files list
> ...



Hmm, I may test this out on a test machine but for my sanity I would be hesitant to do this on the production machines.  Though it does seem like a good way to ensure a clean build.


One question I have about the guide I found is when he says:



> Switch your system to pkgng if you haven't already. Unfortunately, this will not result in the right ports being marked as "automatic", so you'll need to do a bit of post-conversion surgery:



Does he mean anything in particular about "Switch your system to pkgng" besides installing pkg?


----------



## rigoletto@ (Apr 6, 2017)

This is for old installations what are still using the old `pkgng` instead of the current `pkg`.


----------



## rigoletto@ (Apr 6, 2017)

Alternatively, when you have all packages built and everything configured, you can run `pkg upgrade -f`, what will force the reinstall of all installed packages, and then `pkg autoremove`.


----------

