=====================================
Whitelisting or blacklisting packages
=====================================


Sometimes you do not want to replicate all the packages from
Repository into your mirror. The ``anaconda-server-sync-conda``
tool includes whitelist/blacklist functionality to manipulate
your list of mirrored packages in a variety of ways.

A mirror config file can be specified when you run
``anaconda-server-sync-conda`` with the flag
``--mirror-config=FILEPATH`` and replace FILEPATH with the path
to your config file.

NOTE: Configuration files are ``yaml`` files.

To customize your distribution, you have the following options:

* remote_url: Repository mirrors packages from this source URL.

* mirror_dir: Repository stores packages in this directory on
  the machine where the script is executed.

* platforms: Repository mirrors packages for these platforms.

* license_blacklist: Repository omits packages with these
  licenses.

* blacklist: Repository omits these packages.

* whitelist: Repository always mirrors these packages.

TIP: You do not need to set up every option manually. If you only
want to adjust one or two options, that is allowed. Untouched options
remain defined by the default setting.

EXAMPLE: The following example only selects packages that are
available for linux-32 and linux-64 platforms. Win-32 or win-64
packages are not mirrored at all::

    mirror_dir: /opt/anaconda-server/package-storage
    platforms:
      - linux-32
      - linux-64
    license_blacklist: GPL
    whitelist:
      - distribute
      - conda
    blacklist:
      - flask
      - readline

The step-by-step algorithm that is used by cas-mirror to create the
ultimate list of packages to mirror follows this order:

#. Get a full list of packages from ``default_url``.

#. If the platforms option is present, only those packages available
   to the platforms listed here are left on the list.

#. If license_blacklist is present, then all the packages subject
   to any of the licenses mentioned here are removed from the
   list. Currently, GPL licenses are the only license type that
   can be license blacklisted.

#. If blacklist is present, then all member packages explicitly
   mentioned here are removed from the list.

#. If whitelist is present, then those assigned member packages
   are added to the list. The whitelist option overrides
   license_blacklist and blacklist, so that a package listed here
   is mirrored even when under a GPL license or if it appears in
   the blacklist option.

After performing all of the above actions sequentially, the script
produces the ultimate list of packages that are mirrored.
