# Personally Installed Ports



## Steve_Laurie (Jan 13, 2011)

Hi all,

I've read the man page and there doesn't seem to be a switch for it but is there a way to get a list of only the ports that I've chosen to install (omitting all of the dependent packages)?

TIA


----------



## graudeejs (Jan 13, 2011)

Install ports-mgmt/pkg_cutleaves and run `$ pkg_cutleaves -l`


----------



## ckester (Jan 14, 2011)

Well, it's probably true that every leaf port is one the user chose to install.   But isn't it also possible that he chose to install something that another port he installed later depends upon?

I guess it all hinges on what you want this list for.  If it's simply to be able to re-install your choices if necessary, then it won't matter if the non-leaf ports aren't listed.  They'll get installed when you install the relevant leaves.

Once you have the list of leaf ports, see killasmurf86's howto on creating a metaport that installs them all in one swoop.


----------



## ckester (Jan 14, 2011)

BTW, to convert the output of pkg_cutleaves to category/portname form, you can use this pipeline:

`$ pkg_cutleaves -l | while read p; do pkg_info -q -o $p; done`

With a little more work and another stage in the pipeline, you can use this to automatically generate the lines in a metaport like killasmurf86's:

`$ pkg_cutleaves -l | while read p; do pkg_info -q -o $p; done \
| awk 'FS="/" {print "RUN_DEPENDS+= "$2":${PORTSDIR}/"$1"/"$2}'` 

_
OK, maybe you can't completely autogen the metaport.  In some cases, you're still going to have to hand edit the name of the file Make should look for in deciding whether a port needs to be installed.  But hey, this gets you 90% of the way to your goal.  

HINT: to find the lines that need hand-editing, construct a similar pipeline using the 'which' command to check whether there's an executable on the path with the same name as portname.
_


----------



## JokerBoy (Jan 14, 2011)

or if you are using portmaster:
[CMD=""]portmaster --list-origins | sort[/CMD]


----------



## ckester (Jan 14, 2011)

JokerBoy said:
			
		

> or if you are using portmaster:
> [CMD=""]portmaster --list-origins | sort[/CMD]



Yep.  Piping the output of this portmaster command into the final awk stage of my pipeline produces the same result.

I only started with pkg_cutleaves because that's where killasmurf86 left it.  I'm a big fan of portmaster, however.


----------



## Steve_Laurie (Jan 14, 2011)

Thank you all for your responses. They work well enough. I get a few dependencies in there that I didn't install but mostly, it's good!

The reason why I wanted this is because I'm doing a lot of testing setting up a server and I want a list of stuff I need to install to get it working again exactly the way it is now. I know I'd eventually figure out what was missing and install it, but I wouldn't remember which versions I had installed.


----------



## graudeejs (Jan 14, 2011)

Steve_Laurie said:
			
		

> Thank you all for your responses. They work well enough. I get a few dependencies in there that I didn't install but mostly, it's good!
> 
> The reason why I wanted this is because I'm doing a lot of testing setting up a server and I want a list of stuff I need to install to get it working again exactly the way it is now. I know I'd eventually figure out what was missing and install it, but I wouldn't remember which versions I had installed.



They are build time dependabilities.
They are needed to build port, once you build port, they are not needed any more (by port)
That's why you see them.


----------



## DutchDaemon (Jan 15, 2011)

You can prevent build dependencies from cluttering your system by using portmaster with this flag:


```
--delete-build-only
         delete ports that are build-only dependencies after a successful run,
         only if installed this run
```

or by putting this in your portmaster.rc file:


```
PM_DEL_BUILD_ONLY=pm_dbo
```
.

You can also opt to use packages for build-only dependencies.


----------



## dougb@ (Jan 16, 2011)

Steve_Laurie said:
			
		

> Thank you all for your responses. They work well enough. I get a few dependencies in there that I didn't install but mostly, it's good!
> 
> The reason why I wanted this is because I'm doing a lot of testing setting up a server and I want a list of stuff I need to install to get it working again exactly the way it is now. I know I'd eventually figure out what was missing and install it, but I wouldn't remember which versions I had installed.



You may also want to look at the 'portmaster -s' feature, which will notify you about ports that were previously installed as dependencies of other ports, but are no longer depended on; and offer to delete them for you. 

Someone else already pointed out the --list-origins feature, which is specifically designed to handle the situation you're describing. 


hth,

Doug


----------

