# switching from ports to packages



## tobe (Sep 4, 2009)

Hello,

I'm using ports to install and update softwares on my laptop. From time to time, i'm running into problems and i need to spend a few hours to fix them.

So i'm thinking to switch to packages, because as they're already built, their should be less problems (isn't it?). Also, i don't need the last versions so i can wait if the packages are not available at the same time as the corresponding ports are updated.

So here is my question:

Is there any procedure to switch from ports to packages?

Thanks,
TobÃ©


----------



## avilla@ (Sep 4, 2009)

you don't need to switch anything: the next time you install something, just use packages


----------



## SirDice (Sep 4, 2009)

tobe said:
			
		

> Is there any procedure to switch from ports to packages?



Just stop using ports 

More seriously though, I think packages might give you more hassle. When installing something you're bound to get messages like "package X needs package Y version 34 but version 33 is installed".

I mainly solve the whole ports dependency issues by starting a clean jail and building all the ports I need in there, using portmaster I create my own packages at the same time. Once everything is done I just use "pkg_delete -a" to remove everything and install my own built packages on my workstation. 

The added bonus of this is that I have all the packages I need with my own options set. It also means I can keep a working system while everything is being rebuild. Any issues can be solved without ever touching this working system.

Removing everything and installing the new versions takes about 30 min. so when everything is setup I can quickly upgrade to a new system and be fairly certain it'll work. Just in case I keep the 'old' packages around so I can always go back.


----------



## hydra (Sep 4, 2009)

It's just a method how to get the binaries into your system. With ports you compile the source code to get the binaries, with packages you simply unpack the binaries. So theoretically you can install a single program from the ports and the second from the packages, however the mixing is NOT recommended. My advise: use the ports and limit the packages to only extra huge things like openoffice.


----------



## dennylin93 (Sep 4, 2009)

Just fix the dependencies with ports-mgmt/portmaster or ports-mgmt/portupgrade when installing from packages (if you previously used ports).


----------



## tobe (Sep 4, 2009)

SirDice said:
			
		

> Just stop using ports
> 
> More seriously though, I think packages might give you more hassle. When installing something you're bound to get messages like "package X needs package Y version 34 but version 33 is installed".


Isn't portupgrade -PR supposed to update dependencies as well?


> I mainly solve the whole ports dependency issues by starting a clean jail and building all the ports I need in there, using portmaster I create my own packages at the same time. Once everything is done I just use "pkg_delete -a" to remove everything and install my own built packages on my workstation.


Good idea, this way i can check everything builds fine before installing the packages on my system, i must think about it 


			
				hydra said:
			
		

> It's just a method how to get the binaries into your system. With ports you compile the source code to get the binaries, with packages you simply unpack the binaries.


Thanks for the precisions 


> So theoretically you can install a single program from the ports and the second from the packages, however the mixing is NOT recommended. My advise: use the ports and limit the packages to only extra huge things like openoffice.


One of the problem with mixing is about versions, sometime packages are older than ports. Maybe i can force a downgrade with portugrade.

Thanks everybody!

_Edit:
Oh well, it's time to do some cleanup, this weekend i'll remove all ports and reinstall only the softwares i really need as packages._


----------



## SirDice (Sep 4, 2009)

tobe said:
			
		

> Isn't portupgrade -PR supposed to update dependencies as well?


It should but with -P if portupgrade cannot find a package it will use the port. You could use -PP but this can sometimes fail when certain installed ports don't have packages (usually due to license issues) or the packages aren't available on the mirror you're using.


----------



## phoenix (Sep 4, 2009)

For those who want to use just binary packages, have a look at the pkg_upgrade tool which is part of sysutils/bsdadminscripts.  This tool uses only binary packages for all upgrades, and does not require anything under /usr/ports (you can actually delete that directory and it will still work).

You'll also want to change the PACKAGESITE* environment variables to point to the *packages-X-stable* directory on the package servers (where X is 6, or 7, or 8, depending on the version of FreeBSD you run) so that you get the most up-to-date packages.  See the ports(7) and pkg_add(1) man pages for details.


----------



## tobe (Sep 6, 2009)

Hahaha, if you install bsdadminscripts from packages, you won't have pkg_upgrade installed, because the package is soooo outdated...


----------



## Beastie (Sep 6, 2009)

tobe said:
			
		

> Hahaha, if you install bsdadminscripts from packages, you won't have pkg_upgrade installed, because the package is soooo outdated...


Oh, really? Even from the stable repository?


----------



## tobe (Sep 6, 2009)

Err no, sorry, from ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.1-release/Latest/bsdadminscripts.tbz

_Edit:
Adding
"setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports ... le/Latest/"
in .cshrc did it _


----------

