***This page is still unfinished***

# Maintaining packages in your own repository
It is important to maintain your repository when updates occur or if you want to add/remove packages. This page explains how to. 
Note that after changing any files in your repository that you'll have to update them upstream. E.g. uploading the correct files.

## Adding packages

To add a package we first have to copy over the `.xbps` files to the repository directory. After that we can add them to the repository's `*-repodata`. You can add them by using:
```
$ xbps-rindex -a /path/to/repository/directory/*.xbps
```
We also have to sign the package with the key we generated whilst we set up the repository. This can be done by using:
```
$ xbps-rindex --privkey private.pem --sign-pkg /path/to/repository/directory/*.xbps
```

## Updating packages
If you have a new version of a package and want to add it to the repository there are a few steps that need to be done.

First add the new package to the `repodata`.

```
$ xbps-rindex -a /path/to/repository/directory/*.xbps
```

And then remove the obsolete packages.

```
$ xbps-rindex -r /path/to/repository/directory/
```

Don't forget to sign the added packages

```
$ xbps-rindex --privkey private.pem --sign-pkg /path/to/repository/directory/*.xbps
```

## Removing packages

To remove a package you'll first have to remove the files from the repository and it's signature:

```
$ rm /path/to/repository/directory/<foo>*
```

After that you'll have to evoke `xbps-rindex` to clean up the repodata:

```
$ xbps-rindex -c /path/to/repository/directory/
```