# leaving portupgrade for pkgng



## noodlefling (Apr 14, 2014)

I am really not understanding how to upgrade to the new port (package?) management system.  I am missing something fundamental about the new structure.  I've done a fair amount of reading, and it all makes sense in context, but most articles are not comparative, so I'm missing the boat somewhere.

In the old system I'd do a

```
# portsnap fetch
# portsnap update
# portupgrade <portname>
```
and that would get me an updated port.  I could do an -r and an -R if necessary, but let's keep it simple.

I ass/u/me that now I do the same portsnaps, but then what?

Example:

```
# pkg install tgif
Updating repository catalogue
pkg: No packages matching 'tgif' available in the repositories
# pkg add tgif
pkg: tgif: No such file or directory
pkg: Was 'pkg install tgif' meant?

Failed to install the following 1 package(s): tgif
```

So...what's the trick?  I installed pkg, added WITH_PKGNG=yes to /etc/make.conf, ran `pkg2ng`...a few times actually, but the last time it seemed to be pretty happy.

I can go into the port directory and do a successful `make install`, but will that keep the database happy?

Is what I'm doing supposed to Just Work?  What's the analog for `portupgrade [i]portname[/i]` supposed to be?

Sorry for the cluelessness...


----------



## wblock@ (Apr 14, 2014)

noodlefling said:
			
		

> I am really not understanding how to upgrade to the new port (package?) management system.  I am missing something fundamental about the new structure.  I've done a fair amount of reading, and it all makes sense in context, but most articles are not comparative, so I'm missing the boat somewhere.
> 
> In the old system I'd do a
> 
> ...



The same as before.  pkg is a new package database.  It does not mean you have to use binary packages.



> So...what's the trick?  I installed pkg, added WITH_PKGNG=yes to /etc/make.conf, ran `pkg2ng`...a few times actually, but the last time it seemed to be pretty happy.



`pkg2ng` should only be run once to import the old package database.



> I can go into the port directory and do a successful `make install`, but will that keep the database happy?



Yes.  Try it: `pkg info`.



> Is what I'm doing supposed to Just Work?  What's the analog for `portupgrade [i]portname[/i]` supposed to be?



Installing ports is exactly the same.  Only the package database has changed.


----------



## noodlefling (Apr 14, 2014)

wblock@ said:
			
		

> Installing ports is exactly the same.  Only the package database has changed.



OOOoooooooh.  So all I have to do is install pkg, do a `pkg2ng`, change make.conf and I can keep using portupgrade?

That would be awesome, and leave my mind unblown and happily living in the comfort of the old system.

Why didn't any of the docs I read explain all that to me?

Sorry to bother you all with such a simple question, then.

Carry on, and thanks a million!

EDIT: As an aside, I suppose I do care why what I was trying to do wasn't working...a little bit.


----------



## wblock@ (Apr 14, 2014)

noodlefling said:
			
		

> wblock@ said:
> 
> 
> 
> ...



Yes.



> That would be awesome, and leave my mind unblown and happily living in the comfort of the old system.
> 
> Why didn't any of the docs I read explain all that to me?



That's a good question.  Partly it's because how ports and packages interact has never been made very clear to most users.



> EDIT: As an aside, I suppose I do care why what I was trying to do wasn't working...a little bit.



`pkg install` tries to download a binary package from the remote repository and install it.  For whatever reason, that package was not present in the repository.  `pkg add` tries to add a package from a file, which was not present in the current directory.


----------



## noodlefling (Apr 14, 2014)

wblock@ said:
			
		

> `pkg install` tries to download a binary package from the remote repository and install it.  For whatever reason, that package was not present in the repository.  `pkg add` tries to add a package from a file, which was not present in the current directory.



OK, that does make sense, at least generally speaking.  Both my system and my brain are not tweaked to deal with packages.  I'm used to just doing a `portupgrade` and having whatever is necessary magically pulled down from the ether, but I must have configured that once many moons ago, and then completely forgotten about it.  Presumably if I'd encountered FreeBSD for the first time today and decided to go with packages, I'd get it set up properly once and forget all about it... until the day ports are the New Thing and everyone is encouraged to switch back.

Anyway, thanks again for your insight and patience.  It's always great when something scary turns out to be no big deal.


----------



## SirDice (Apr 16, 2014)

Sometimes the names of a packages don't exactly match up with the port's name. Try doing a `pkg search tgif`, that should search the remote package repository for anything that looks like "tgif".


----------



## noodlefling (Apr 16, 2014)

Hmmm.


```
# pkg info | grep tgif
tgif-4.2.5                     Xlib-based two-dimensional drawing tool and hyper-object browser
# pkg search tgif
ja-tgif-resource-4.2.2
tgif2tex-2.13_4
```

So...in this example, I have the tgif port installed, but a package doesn't exist?  Is that common?


----------



## SirDice (Apr 16, 2014)

noodlefling said:
			
		

> So...in this example, I have the tgif port installed, but a package doesn't exist?  Is that common?


Not common but it does happen. There can be several reasons why there isn't a package. The build server may have build problems or the port (or one of its dependencies) may not be packaged due to licence restrictions. 

You can see all the build errors on the package servers here: http://portsmon.freebsd.org/


----------



## ShelLuser (Apr 24, 2014)

noodlefling said:
			
		

> ```
> # pkg info | grep tgif
> tgif-4.2.5                     Xlib-based two-dimensional drawing tool and hyper-object browser
> # pkg search tgif
> ...


You can even do this easier by using regexps:


```
feliner:/home/peter $ pkg info -x gif
giflib-nox11-4.2.3_2
```
So instead of telling grep to search the output you're basically telling pkg to filter the output for you. Less to type, which could make things easier on you


----------

