# Adding or removing sections from the repository

## A note about removing sections

Information about which repository sections -- distributions, components and
architectures -- that your repository serves is stored seperately from the
packages themselves.

So for example, if your repository has a "nightly" component and you remove
it, all of the package metadata for the packages that were in the nightly
component is still present in SimpleDB, and all of the package files associated
with that metadata are still present in S3.  The only actual change is that
the packages that were part of the "nightly" component will no longer show
up in the output of `repoman-cli query` commands (unless you use the `--query-hidden`
flag), and the packages will no longer be included in the Packages and Sources
files in your repository generated by `repoman-cli publish`.

If you want or need to garbage-collect packages that have been orphaned by
the removal of all of the repository sections they were previously associated
with, this is something you will have to do manually.  Especially note that
anyone who can manually browse the S3 bucket portion of your reposistory will
be able to find the old package versions under the `pool/` prefix.

## Adding and removing distributions

```
$ repoman-cli repo add-distribution sid
2017-06-27 08:17:37,999 - apt_repoman.cli - WARNING - Adding distribution(s): sid
Type "c" to confirm --> c
2017-06-27 08:17:40,151 - apt_repoman.repodb - INFO - Adding distributions: ['sid']
2017-06-27 08:17:42,981 - apt_repoman.cli - INFO - Current repo configuration:
2017-06-27 08:17:42,982 - apt_repoman.cli - INFO - 	Simpledb domain: com.example.apt
2017-06-27 08:17:42,982 - apt_repoman.cli - INFO - 	S3 bucket: s3://repoman-demobucket
2017-06-27 08:17:42,982 - apt_repoman.cli - INFO - 	SNS Notification topic: ---None configured---
2017-06-27 08:17:42,982 - apt_repoman.cli - INFO - 	Distributions: ['jessie', 'sid', 'xenial']
2017-06-27 08:17:42,982 - apt_repoman.cli - INFO - 	Components: ['main', 'nightly']
2017-06-27 08:17:42,982 - apt_repoman.cli - INFO - 	Architectures: ['amd64', 'i386', 'all', 'source']
2017-06-27 08:17:42,982 - apt_repoman.cli - INFO - 	Origin: repoman
2017-06-27 08:17:42,982 - apt_repoman.cli - INFO - 	Label: repoman

$ repoman-cli repo rm-distribution sid
2017-06-27 08:18:06,131 - apt_repoman.cli - WARNING - Deleting distribution(s): sid
Type "c" to confirm --> c
2017-06-27 08:18:07,669 - apt_repoman.repodb - INFO - Deleting distributions: ['sid']
2017-06-27 08:18:13,035 - apt_repoman.cli - WARNING - Deleting a distribution from a repository does
    not actually delete the package files from S3 or the items from simpledb, it just stops
    including those distributions in query results, cp/rm commands and the publishing process:
    you will need to clean up the orphaned resources manually if you care.
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - Current repo configuration:
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - 	Simpledb domain: com.example.apt
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - 	S3 bucket: s3://repoman-demobucket
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - 	SNS Notification topic: ---None configured---
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - 	Distributions: ['jessie', 'xenial']
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - 	Components: ['main', 'nightly']
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - 	Architectures: ['amd64', 'i386', 'all', 'source']
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - 	Origin: repoman
2017-06-27 08:18:13,036 - apt_repoman.cli - INFO - 	Label: repoman
```

## Adding and removing components

```
$ repoman-cli repo add-component release
2017-06-27 08:18:50,962 - apt_repoman.cli - WARNING - Adding component(s): release
Type "c" to confirm --> c
2017-06-27 08:18:51,746 - apt_repoman.repodb - INFO - Adding components: ['release']
2017-06-27 08:18:54,186 - apt_repoman.cli - INFO - Current repo configuration:
2017-06-27 08:18:54,186 - apt_repoman.cli - INFO - 	Simpledb domain: com.example.apt
2017-06-27 08:18:54,186 - apt_repoman.cli - INFO - 	S3 bucket: s3://repoman-demobucket
2017-06-27 08:18:54,186 - apt_repoman.cli - INFO - 	SNS Notification topic: ---None configured---
2017-06-27 08:18:54,187 - apt_repoman.cli - INFO - 	Distributions: ['jessie', 'xenial']
2017-06-27 08:18:54,187 - apt_repoman.cli - INFO - 	Components: ['main', 'nightly', 'release']
2017-06-27 08:18:54,187 - apt_repoman.cli - INFO - 	Architectures: ['amd64', 'i386', 'all', 'source']
2017-06-27 08:18:54,187 - apt_repoman.cli - INFO - 	Origin: repoman
2017-06-27 08:18:54,187 - apt_repoman.cli - INFO - 	Label: repoman

$ repoman-cli repo rm-component release
2017-06-27 08:19:10,635 - apt_repoman.cli - WARNING - Deleting component(s): release
Type "c" to confirm --> c
2017-06-27 08:19:12,042 - apt_repoman.repodb - INFO - Deleting components: ['release']
2017-06-27 08:19:17,465 - apt_repoman.cli - WARNING - Deleting a component from a repository does
    not actually delete the package files from S3 or the items from simpledb, it just stops
    including those components in query results, cp/rm commands and the publishing process:
    you will need to clean up the orphaned resources manually if you care.
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - Current repo configuration:
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - 	Simpledb domain: com.example.apt
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - 	S3 bucket: s3://repoman-demobucket
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - 	SNS Notification topic: ---None configured---
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - 	Distributions: ['jessie', 'xenial']
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - 	Components: ['main', 'nightly']
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - 	Architectures: ['amd64', 'i386', 'all', 'source']
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - 	Origin: repoman
2017-06-27 08:19:17,465 - apt_repoman.cli - INFO - 	Label: repoman
```

## Adding and removing architectures

```
$ repoman-cli repo add-architecture arm64
2017-06-27 08:20:25,064 - apt_repoman.cli - WARNING - Adding architecture(s): arm64

Type "c" to confirm --> c
2017-06-27 08:20:25,776 - apt_repoman.repodb - INFO - Adding architectures: ['arm64']
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - Current repo configuration:
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - 	Simpledb domain: com.example.apt
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - 	S3 bucket: s3://repoman-demobucket
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - 	SNS Notification topic: ---None configured---
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - 	Distributions: ['jessie', 'xenial']
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - 	Components: ['main', 'nightly']
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - 	Architectures: ['all', 'amd64', 'arm64', 'i386', 'source']
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - 	Origin: repoman
2017-06-27 08:20:28,559 - apt_repoman.cli - INFO - 	Label: repoman

$ repoman-cli repo rm-architecture arm64
2017-06-27 08:20:46,288 - apt_repoman.cli - WARNING - Deleting architecture(s): arm64

Type "c" to confirm --> c
2017-06-27 08:20:48,839 - apt_repoman.repodb - INFO - Deleting architectures: ['arm64']
2017-06-27 08:20:54,222 - apt_repoman.cli - WARNING - Deleting a architecture from a repository does
    not actually delete the package files from S3 or the items from simpledb, it just stops
    including those architectures in query results, cp/rm commands and the publishing process:
    you will need to clean up the orphaned resources manually if you care.
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - Current repo configuration:
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - 	Simpledb domain: com.example.apt
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - 	S3 bucket: s3://repoman-demobucket
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - 	SNS Notification topic: ---None configured---
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - 	Distributions: ['jessie', 'xenial']
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - 	Components: ['main', 'nightly']
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - 	Architectures: ['all', 'amd64', 'i386', 'source']
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - 	Origin: repoman
2017-06-27 08:20:54,223 - apt_repoman.cli - INFO - 	Label: repoman
```

*NOTE:* you cannot add or remove the "source" or "all" architectures: they always exist.
