# Syncing up the ports tree on a fresh install



## Oldrancher (Apr 24, 2016)

Last week I did a fresh install of 10.3 release, using the dvd image, which installs /usr/ports and /usr/ports.  I want to use `svn` to keep these up to date.

My question is how to get it established to `svn` that the existing trees are a fresh install from the release .iso dvd.  Is this a simple matter of running`svn checkou` and `svn update`?


----------



## tingo (Apr 24, 2016)

If you already have a ports tree in /usr/ports, only the `svn update` is needed. Like so:
`# cd /usr/ports`
`# svn up`
HTH


----------



## kpa (Apr 24, 2016)

That's not going to work because the ports tree extracted from the tarball lacks the SVN metadata (which gives SVN the crucial information of what state the checked out copy is in). Also, SVN is not in the base system as svn but svnlite. What you should do is move away the ports tree that can't be updated with SVN and fetch a completely new one.


```
mv /usr/ports /usr/ports.old
svnlite co https://svn.freebsd.org/ports/head /usr/ports
```


----------



## chrbr (Apr 24, 2016)

Dear Oldrancher,
the only drawback is that svnlite(1) or devel/subversion do not update /usr/ports/INDEX-10 which is used by many tools for the package managemant. But this can be either generated by `make index` in /usr/ports. For it takes a lot of time it is simpler just to fetch it by `make fetchindex` in /usr/ports.

I write this just because it took me some time to find that out .


----------



## Oldrancher (Apr 24, 2016)

At this point I'm completely confused.  Yes, I know that I can recreate a fresh /usr/ports tree by renaming the current tree and using subversion to checkout a fresh copy.
I have installed subversion on the system using `pkg`.  I have run `svn checkout` and `svn update` and have a /usr/ports/INDEX-10 file as a result. Question is whether doing that cobbled up the ports at all.


----------



## wblock@ (Apr 25, 2016)

No, it's fine.  None of that affects the package database, which keeps track of ports that are installed.


----------



## ANOKNUSA (Apr 25, 2016)

And might I add, since the ports tree is easy to fetch from a remote server, and useless if you're not online anyway, you can exclude it from your backup scheme if you wish. Those thousands of small files eat up a lot of time during a backup.


----------



## chrbr (Apr 25, 2016)

wblock@ said:


> No, it's fine. None of that affects the package database, which keeps track of ports that are installed.


Dear wblock@, I am following https://svn.freebsd.org/ports/head/ which has no INDEX-10. At least I think so. The information of the portstree is

```
# svnlite info
Path: .
Working Copy Root Path: /usr/local/poudriere/ports/local
URL: https://svn.freebsd.org/ports/head
Relative URL: ^/head
Repository Root: https://svn.freebsd.org/ports
Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
Revision: 414024
Node Kind: directory
Schedule: normal
Last Changed Author: olivierd
Last Changed Rev: 414024
Last Changed Date: 2016-04-25 19:01:41 +0200 (Mo, 25 Apr 2016)
```
and

```
# svnlite status
?       INDEX-10
```
Is there anything I can do to get the index file, too?  As far as I remember I found the method using `make fetchindex` somewhere in the forum.


----------



## zirias@ (Apr 25, 2016)

I have a ports tree without index, and didn't find any issues. Is this really used by anything other than `make search` and those pretty-print targets?


kpa said:


> What you should do is move away the ports tree that can't be updated with SVN and fetch a completely new one.


And why not just delete it? This would just be a backup of an old state, which you could get any time again using the `-r` flag of subversion, so I don't see much sense in keeping it.


----------



## chrbr (Apr 25, 2016)

Zirias said:


> I have a ports tree without index, and didn't find any issues. Is this really used by anything other than  make search and those pretty-print targets?


I think it is required for example `pkg version` or `psearch`. At least `psearch` is really nice. Is there a method without the index file to see which the installed packages are up to date and which are to be updated? Of course before build?


----------



## kpa (Apr 25, 2016)

Zirias said:


> I have a ports tree without index, and didn't find any issues. Is this really used by anything other than `make search` and those pretty-print targets?
> 
> And why not just delete it? This would just be a backup of an old state, which you could get any time again using the `-r` flag of subversion, so I don't see much sense in keeping it.



It's faster to rename than wait for the complete deletion, you can delete the old one then when the system is lightly loaded.


----------



## wblock@ (Apr 26, 2016)

chrbr said:


> I am following https://svn.freebsd.org/ports/head/ which has no INDEX-10.


That's correct, -CURRENT is FreeBSD-11, so it has INDEX-11.

I use `portmaster -L --index-only`, which fetches the index file if it is not present.

Actually, I use that from a script.  There is a sample in the article: Upgrading FreeBSD Ports


----------



## zirias@ (Apr 26, 2016)

wblock@ said:


> That's correct, -CURRENT is FreeBSD-11, so it has INDEX-11.


Actually the URL refers to the head branch of ports. I found no documentation this had anything to do with -CURRENT?


----------



## wblock@ (Apr 26, 2016)

Rereading... okay, yes, the index file is not part of the repo because it changes all the time.  The number is the major version number of FreeBSD that is running.


----------



## SirDice (Apr 26, 2016)

After getting/updating the tree with svn(1)/svnlite(1):

```
cd /usr/ports
make index
```

This will create the necessary INDEX-* files based on the versions you actually have in your tree.


----------

