How to reinstall deleted package?

If I delete a port directory from /usr/ports how can I get the system to recopy it back again. I don't mean how to undelete files from my system I mean a fresh new copy from over the net.

Update:
I got it; portsnap extract
 
I have. The handbook doesn't explaing things clearly. Just the bare minimum of what a command does. That's why I post here. To get the info the handbook doesn't explain. From people who know. I know how to look at the handbook.
 
also ports(7)

Code:
$ cd /usr/ports/category/port
$ make [color="Red"]deinstall[/color] install clean

simple as that
note: you don't need to run deinstall if you haven't installed app yet ;)
 
You may want to run portsnap fetch, portsnap extract, portsnap update (in that order) to make sure your ports are up to date. The fetch command downloads the ports tree, extract extracts it, and update installs the new port tree, so you can go into your port's directory & have the newest version of the port ready to install.
 
Code:
csup -g -L 2 -1 -i ports/x11-toolkits/[bakery] [path/] supfile.ports
might be what you would use a lot. If you save history
across reboots from your shell you could run it
with
Code:
#!csup[tab]
edited probably
 
$ cd /usr/ports/category/port
$ make deinstall install clean

Ya, I already know that but that won't delete the files from /usr/ports/category/port right? It will just reinstall the same files right? I want to delete those files and get a new copy from the ports repository or whatever you call it. Does deinstall delete the files /usr/ports/category/port? I don't think so, I can't try it right now but I think I remember looking after make deinstall and they were still there.

You may want to run portsnap fetch, portsnap extract, portsnap update (in that order) to make sure your ports are up to date.

I'm not really clear what it means to have the ports "up to date". Does that mean I have the actuall newest physical make files on my system (not the application files after it's installed) or a database is up to date with the files that I would need if I chose to install a particular port?

I've run portsnap update after deleting a ports directory and it tells me my ports are up to date when clearly one ports directory is missing because I deleted it. So it seems that it's not checking that the actual files are the most current but that some entries in a database are the latest. I just wanted to get the latest files for a port because if I deinstall one then run make install clean it just installs the same ones back in again right?
 
portsnap updates the ports tree, but it doesn't take deletions done by you into account. It uses a tag to keep track of the current ports tree installation (/var/db/portsnap/tag). If you want a pristine ports tree, run this:

[cmd=]rm /var/db/portsnap/tag && portsnap fetch extract[/cmd]

This will install a complete ports tree.

If you want to make 'surgical updates' to the ports tree, you can use a command like:
[cmd=]csup -g -L 2 -1 -h cvsup2.uk.FreeBSD.org -i ports/category/port(*) /usr/share/examples/cvsup/ports-supfile[/cmd]

(*) e.g. ports/www/apache22

This will restore that single port's directory (Makefile, pkg-descr, pkg-plist, and such).

This is all about maintaining the ports tree, not the installed ports.
 
Ok thanks but there's a few things that are still not quite clear to me.

portsnap updates the ports tree

Yes I've heard this many times but what exactly does it mean? What exactly is the "ports tree"? Is this a database or the actual physical directory structure on the disk with all the port's directory (Makefile, pkg-descr, pkg-plist, and such)? What does it mean for portsnap to "update the ports tree"? Is it copying (Makefile, pkg-descr, pkg-plist, and such) to my disk or modifying a database?

This is all about maintaining the ports tree, not the installed ports.

Then what are "installed ports"? Are these the directory structure on disk (Makefile, pkg-descr, pkg-plist, and such) or the programs after you run make install clean? It's the terminology that's confusing. By "installing a port" do you mean copying directory (Makefile, pkg-descr, pkg-plist, and such) to my disk or running make install clean?
 
The ports tree is /usr/ports, a.k.a. 'the ports skeleton', a.k.a. the collection of files needed to download, compile and install application source code.

The installed ports are the applications built by the source code, using the utilities in the ports tree (and a compiler, of course). Installed ports, their libraries and their config files live under /usr/local/ (bin, sbin, etc, lib, etc.). The meta-data of these applications live under /var/db/ports and /var/db/pkg.

Installing a port means turning source code ('the port') into a binary ('the installed port') using utilities like Makefile (in 'the port directory' under /usr/ports).

The source code itself (a.k.a. the tarball) is not in the ports tree, but the location of the tarball is --> when you run make install clean, the make process knows where to download that tarball and processes it.

Once a tarball is downloaded, it is in its own directory in the ports tree for future reference or reinstallation: /usr/ports/distfiles/.
 
killasmurf86 said:
also ports(7)

Code:
$ cd /usr/ports/category/port
$ make [color="Red"]deinstall[/color] install clean

simple as that
note: you don't need to run deinstall if you haven't installed app yet ;)

Re-read the initial post.

The question was how to recover the directory /usr/ports/category/ and not how to re-install a specific app.
 
The ports tree is /usr/ports, a.k.a. 'the ports skeleton', a.k.a. the collection of files needed to download, compile and install application source code.

The installed ports are the applications built by the source code, using the utilities in the ports tree (and a compiler, of course). Installed ports, their libraries and their config files live under /usr/local/ (bin, sbin, etc, lib, etc.). The meta-data of these applications live under /var/db/ports and /var/db/pkg.

Installing a port means turning source code ('the port') into a binary ('the installed port') using utilities like Makefile (in 'the port directory' under /usr/ports).

The source code itself (a.k.a. the tarball) is not in the ports tree, but the location of the tarball is --> when you run make install clean, the make process knows where to download that tarball and processes it.

Once a tarball is downloaded, it is in its own directory in the ports tree for future reference or reinstallation: /usr/ports/distfiles/.

That's what I thought. Then why did you say;

This is all about maintaining the ports tree, not the installed ports.

I never said anything about installed ports, did I? I thought you meant by "installing a port" you were talking about copying the missing directory to the ports tree. That was my original question. That's why I'm confused. My other question is still unanswered;

What does it mean for portsnap to "update the ports tree"? Is it copying (Makefile, pkg-descr, pkg-plist, and such) to my disk or modifying a database?

Like I said previously, when I deleted the port directory and ran portsnap update it didn't "update" the tree with the missing directory. I know you said it doesn't keep track of my deletes. Then what does "portsnap update" do? And don't tell me it updates the ports tree. It's still not clear what "update the ports tree" means. Does this mean getting the latest make files into the ports tree directories?


The question was how to recover the directory /usr/ports/category/ and not how to re-install a specific app.

Yes. My opera installation kept looking for libjpeg.so.9 so I thought of deleting the directory /usr/ports/www/opera and getting the latest copy to see if the new make files would ask for libjpeg.so.10 instead. Obviously if the directory isn't there I can't run make deinstall. I'm still trying to understand why portsnap update didn't copy in the makefiles that would have looked for libjpeg.so.10 before I deleted the directory. I guess that's what portsnap upgrade did. Upgrade, update, too similar, too confusing, I'm going to re-read the handbook.
 
portsnap only updates ports that have newer version, that then the one currently in ports tree.... This way you keep download traffic to minimum (incremental patches.... something like that)

To restore deleted directories in ports tree run:
Code:
$ portsnap extract www/opera
for example
replace www/opera with port that you need
 
SeaHag said:
I never said anything about installed ports, did I? I thought you meant by "installing a port" you were talking about copying the missing directory to the ports tree.

I was trying to differentiate between the concepts of 'ports', 'ports tree', 'installed ports', 'port directories', etc. Installing a port is actually compiling it and placing the result in the operating system -- I guess I placed emphasis on that because I got sidetracked by comments from others about deinstalling and installing ports, not port directories.

Unfortunately, almost everyone who has been installing ports for a long time (me included) will start blurring the lines between these concepts, and depending on the context, a question like 'are your ports up to date' may refer to the ports tree or to the installed ports. But in concept, 'a port' is the combination of the source code and the files required to build and install it on a certain platform ('porting' is the process of making the source code and associated files ready for that platform). These required files are in the ports tree, in their respective port directories.
 
@SeaHag sorry about causing the confusion. Have killa & Dutch cleaned up my mess? Let me break down what I was saying... and maybe recap a little. I've learned some stuff from this thread as well. So as I understand it, and taken from the manual Using the Ports Collection, using portsnap to update ports goes a little something like this... (and somebody please correct me if I'm wrong)

Code:
$ portsnap fetch
This downloads a complete, compressed snapshot of the ports collection into /var/db/portsnap. Do this before running either of the 2 commands below. (portsnap execute or portsnap update)

Code:
$ portsnap extract
This will extract the snapshot you downloaded using portsnap fetch into the /usr/ports directory. You should run this the first time you're getting the ports.

Code:
$ portsnap update
After you have your ports tree populated by using the portsnap extract command, run this whenever you want/need to update your ports tree.

Code:
$ portsnap fetch extract
fetch and extract in one command. (if you do not have the ports tree installed)

Code:
$ portsnap fetch update
fetch and update in one command. (update after you have the ports tree installed)

Say you're running firefox 2.x, and you have the ports collection on your computer, but it hasn't been updated for a while, and you want the newest version of firefox, you will run this command first to get the updated port for firefox. I would assume that what this really does is gets the newest makefile, pkg-descr, pkg-plist, distinfo files for the ports that have been updated. since the last time you ran this command or the portsnap extract command.

Sorry about my misinformation about needing to run all 3 commands all the time. You could do that (if you wanted), but it would probably take a while & be a pain.

Possible solutions to your problem:
killasmurf86 said:
To restore deleted directories in ports tree run:
Code:

Code:
$ portsnap extract www/opera

for example
replace www/opera with port that you need

This appears to be one solution for what you're looking for.

DutchDaemon's first post looks to be another solution (or 2)...
DutchDaemon said:
...If you want a pristine ports tree, run this:

rm /var/db/portsnap/tag && portsnap fetch extract

This will install a complete ports tree.

If you want to make 'surgical updates' to the ports tree, you can use a command like:
csup -g -L 2 -1 -h cvsup2.uk.FreeBSD.org -i ports/category/port(*) /usr/share/examples/cvsup/ports-supfile

(*) e.g. ports/www/apache22

This will restore that single port's directory (Makefile, pkg-descr, pkg-plist, and such)...

Sorry for my long-windedness (is that even a word?), I thought this post might be helpful in pulling all the information in the thread together.

Edit: updated as per killasmurf86's correction
 
@ desnudopenguino <<
Before you run $ portsnap update you need to run $ portsnap fetch

so for the first time, you run $ portsnap fetch extract, and then keep updating with $ portsnap fetch update
 
Then what does "portsnap update" do? And don't tell me it updates the ports tree.

Code:
$ portsnap update
After you have your ports tree populated by using the portsnap extract command, run this whenever you want/need to update your ports tree.

What does "update your ports tree" mean? I think it means copy over all the latest build files into each port directory.
 
Before you run $ portsnap update you need to run
$ portsnap fetch

so for the first time, you run $ portsnap fetch extract, and then keep updating with
$ portsnap fetch update

Ah, that's probably why portsnap update tells me my ports are up to date. Because I didn't fetch the latest snapshot.
 
Back
Top