# Is there an automatic way to tell which programs are built from ports



## gariac (May 29, 2017)

I'm trying to do a 10.3 to 11.0 upgrade. (It didn't work, so I did a restore, but that is the subject for another post after my second attempt.) In the process of doing the upgrade, the notes indicate that you should recompile programs that you installed from ports (i.e. source). 

Three questions here:
1) Is there some automatic way to find which programs were installed from ports. I suspect their is because the upgrade ought to be smart enough not to "upgrade" from the standard package if the old OS used a port. I know I built postfix, dovecot2, and a few others, but I would hate to miss one.

2) Is a simple "make" good enough, or should a make clean be done, followed by make, deinstall, reinstall.

3) Unfortunately I didn't save the line (message), but when you build from ports after upgrading to a new rev of the OS, there is a message along the lines of a major upgrade has been detected and you should do an upgrade using pkg first. This was not mentioned in the upgrade notes.


----------



## mickey (May 29, 2017)

After a major version upgrade all ports should be reinstalled, be it from ports and/or packages. Binary packages for 11.0 were probably compiled on 11.0 whereas packages for 10.3 were not.

From portmaster(8):

```
Using portmaster to do a complete reinstallation of all ports:
           1. portmaster --list-origins > ~/installed-port-list
           2. Update the ports tree
           3. portmaster -ty --clean-distfiles
           4. portmaster -Faf
           5. pkg delete -afy
           6. rm -rf /usr/local/lib/compat/pkg
           7. Back up any files in /usr/local you wish to save,
              such as configuration files in /usr/local/etc
           8. Manually check /usr/local and /var/db/pkg
              to make sure that they are really empty
           9. Install ports-mgmt/pkg and then ports-mgmt/portmaster.
              Remove both from ~/installed-port-list.
           10. portmaster --no-confirm `cat ~/installed-port-list`

     You probably want to use the -D option for the installation and then run
     --clean-distfiles [-y] again when you are done.  You might also want to
     consider using the --force-config option when installing the new ports.

     Alternatively you could use portmaster -a -f -D to do an ``in place''
     update of your ports.  If that process is interrupted for any reason you
     can use portmaster -a -f -D -R to avoid rebuilding ports already rebuilt
     on previous runs.  However the first method (delete everything and
     reinstall) is preferred.
```


----------



## gariac (May 29, 2017)

Well that is a very complete answer. I just did "portmaster --list-origins" and it is far more than I recall installing from source. Is it the case that some programs I installed from source caused other programs to be installed from source as a side effect of sorts? If so, how would I get a list of just the "root" source programs? Or does it make more sense to do your alternate suggestion of "portmaster -a -f -D" and go autopilot. I would back up the conf files anyway on my local machine. That is, FreeBSD is on a VPS.


----------



## Eric A. Borisch (May 29, 2017)

To show only the items you have asked to install (yes, even those built from ports.) Change the 0 to a 1 to see those installed as dependencies.

pkg(8):
`pkg query -e '%a = 0' %o`


----------



## mickey (May 29, 2017)

gariac said:


> I just did "portmaster --list-origins" and it is far more than I recall installing from source. Is it the case that some programs I installed from source caused other programs to be installed from source as a side effect of sorts?


That is entirely possible. If a port that you compile from source requires other dependencies that are not already installed from a package, it will likely install those dependencies from source ports also.


gariac said:


> If so, how would I get a list of just the "root" source programs? Or does it make more sense to do your alternate suggestion of "portmaster -a -f -D" and go autopilot. I would back up the conf files anyway on my local machine. That is, FreeBSD is on a VPS.


TBH I'm not sure if it's even possible to get a list of only those ports that you originally installed from source ports. But then again, I'm not exactly an expert when it comes to binary packages, as I almost exclusively build from ports. I think the _alternate approach_ of using `portmaster -a -f -D` to do an in-place update of all ports was what I have used when I upgraded my two machines from 10.3 to 11.0. Beware though, that this is kind of a quick-n-dirty approach. In any case it cannot hurt to save a list of ports that are installed on the system using `portmaster --list-origins > ~/installed-port-list` before you begin.


----------



## SirDice (May 29, 2017)

gariac said:


> Is there some automatic way to find which programs were installed from ports.


No, for the simple reason that there is no difference. Ports build packages and its this package that eventually gets installed. So in essence _everything_ is installed as a package, even the stuff you build from ports.


----------



## tingo (May 29, 2017)

However, pkg-query(8) can tell you from which repository a package is installed. IIRC, it will say "unknown" or something to that effect for packages installed from ports.


----------



## gariac (Jun 3, 2017)

Given that I am using a VPS, I decided to set up a new VPS with FreeBSD 11 installed. I want to switch to letsencrypt versus self-signed certs, plus a few other things, so I deciding starting fresh is the way to go since this won't disable the VPS I'm currently using for mail and web. 

Regarding ports versus packages, I still think they are different beasts IF you don't use the default configurations. The only time I use a port IS when I don't want the defaults. Starting with a new VPS, I'm logging what I install/change in a location not on the VPS (of course). When I update the VPS, I will have a record of what I did.


----------



## dave (Feb 15, 2019)

SirDice said:


> No, for the simple reason that there is no difference. Ports build packages and its this package that eventually gets installed. So in essence _everything_ is installed as a package, even the stuff you build from ports.



From a practical standpoint, I would argue that this isn't really true.  For instance, I may wish to run an application from ports, either because it is not included in the packages, or because I want to run the newest version available.  Under such circumstances, I may wish to install all the dependencies using packages, but install the software in question from ports.  There is no self-descriptive or elegant way to do this.

As a workaround, What I do is use `pkg lock` to lock the packages I explicitly install from ports.  They will thus be excluded from pkg updates, and can be built again from ports from time to time.


----------



## Eric A. Borisch (Feb 17, 2019)

Check out synth and it ability to use pre-compiled packages when possible, while still building those with custom options (into custom packages) from ports.


----------



## ShelLuser (Feb 17, 2019)

I hope everyone realizes we're responding to a thread which is almost 2 years old? 

Anyway, it surprises me to see that the real issue never got addressed: don't mix ports and packages because that can cause some nasty problems over time. For the simple reason that ports will 'adapt' their dependencies to your system whereas binary packages obviously will not. And that can have some very weird results during upgrades or installations.

So in the end there's no need to check for any differences because you shouldn't be mixing them in the first place!


----------



## Eric A. Borisch (Feb 17, 2019)

Unless you would like to save time by not compiling ports that are stock, but build some (and their downstream tree) custom for options you need. Which is what synth does for you, and it works well.

Edit: grammar


----------

