# How can you re-copy a port to your system?



## BSDRich (Jul 1, 2009)

Suppose I want to get a fresh copy of a port. For example if I rename a port directory in the ports tree or completely delete one how can I get the system to re-download that directory again? I tried pkgdb -fu nothing, then portsnap update told me it was already up to date, then portupgrade -arR but still the directory didn't get copied over. Also tried portsnap fetch update.


----------



## graudeejs (Jul 1, 2009)

in your case i would use csup utility.

But, i suggest you delete all ports tree and use portsnap fetch extract, and then portsnap fetch update (next time, to update ports tree)

portsnap is much, much faster when updating ports, than csup.

normally you don't need to move, rename files/directories in ports tree.

so:
1) *rm -R /usr/ports/**
2) *portsnap fetch extract*

and when in a day, week, month you want to update ports run:
*portsnap fetch update*


portsnap fetch extract will be slow, because it needs to fetch entire ports tree for first time.
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-portsnap.html

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html


----------



## danger@ (Jul 1, 2009)

If you are already using portsnap(8), then you can use something like `# portsnap extract lang/php5`.


----------



## BSDRich (Jul 1, 2009)

"in your case i would use csup utility."

Why?

"But, i suggest you delete all ports tree and use portsnap fetch extract," 

Why, I don't want to replace the whole tree just one port.

"...and then portsnap fetch update (next time, to update ports tree)"

That's what I did, it's not working.

"portsnap is much, much faster when updating ports, than csup."

That's what I'm using it.

"normally you don't need to move, rename files/directories in ports tree."

Ya I know, I looked at a Makefile with vi and not sure if I screwed it up so want to get the original files all back. 

"portsnap fetch extract will be slow, because it needs to fetch entire ports tree for first time."

Ya, that's why I don't want to redo the whole thing just one port.

How?

So I repeat, how do I replace one port, not the whole tree?


----------



## DutchDaemon (Jul 1, 2009)

Did you read the post above yours?


----------



## BSDRich (Jul 2, 2009)

I renamed /usr/ports/x11-wm/awesome to /usr/ports/x11-wm/awesom then typed portsnap extract /usr/ports/x11-wm/awesome and it just went back to the command line and didn't do anything. Shouldn't it see that the directory awesome doesn't exist and copy it back over?


----------



## DutchDaemon (Jul 2, 2009)

Try [cmd=]portsnap extract x11-wm/awesome [/cmd] instead.


```
# portsnap extract x11-wm/awesome
/usr/ports/x11-wm/awesome/
/usr/ports/x11-wm/awesome2/
```


----------



## BSDRich (Jul 3, 2009)

Thank you, that worked. But why doesn't it work when you give the whole path? So you just give it the next directory up only? I looked at man page and couldn't see that mentioned anywhere.


----------



## DutchDaemon (Jul 3, 2009)

The ports tree is 'hardcoded' to /usr/ports, so the path is omitted from the portsnap tarball. It would be nice if that 'wrong' portsnap command would give some diagnostic output ('port not found', or something similar), but it just fails silently. By the way, the same logic goes for portmaster (a port can be installed using [cmd=]portmaster x11-wm/awesome[/cmd]).


----------

