OpenSwitch Development Tool
===========================

.. image:: https://img.shields.io/pypi/v/opx.svg
    :target: https://pypi.python.org/pypi/opx

.. image:: https://img.shields.io/pypi/l/opx.svg
    :target: https://pypi.python.org/pypi/opx

.. image:: https://img.shields.io/pypi/pyversions/opx.svg
    :target: https://pypi.python.org/pypi/opx

.. image:: https://readthedocs.org/projects/opx/badge/?version=latest
    :target: https://opx.readthedocs.io

Installation
------------

.. code-block:: bash

    $ pip3 install opx

Requirements
~~~~~~~~~~~~

- `Docker <https://docs.docker.com/engine/installation/>`_
- `Git <https://git-scm.com/>`_
- `Repo <https://source.android.com/setup/downloading#installing-repo>`_

Getting Started
---------------

.. code-block:: bash

    # initialize your workspace
    $ opx init

    # build all packages
    $ opx build

    # assemble an installer
    $ opx assemble

    # remove persistent container
    $ opx remove

Supported Build Types
---------------------

- ``git-pbuilder``: if a directory contains a ``debian/control`` file,
  ``git-pbuilder`` will be used.
- ``equivs-control``: if a directory contains a ``control`` file,
  ``equivs-control`` will be used.

New Features (Over `opx-build <https://github.com/open-switch/opx-build>`_)
---------------------------------------------------------------------------

* Opinionated defaults
    * Remembers to pull Docker image regularly so you don't have to
    * Sort packages into pkg/$repo/ after building
    * Push tag automatically when releasing
    * Persistent containers (if inside a workspace)
    * One container allowed per workspace at any time

* Promote a package from unstable to testing

.. code-block:: bash

    $ opx release opx-logging

* Commands are aliased

.. code-block:: bash

    # all run opx build
    $ opx b opx-logging
    $ opx bui opx-logging
    $ opx build opx-logging


Command Line Completion
-----------------------

Run the command corresponding with your shell. Add to your shell startup file for persistent autocomplete.

.. code-block:: bash

    # bash
    $ eval "$(_OPX_COMPLETE=source-bash opx)"

    # zsh
    $ eval "$(_OPX_COMPLETE=source-zsh opx)"

    # fish
    $ eval (env _OPX_COMPLETE=source-fish opx)

Roadmap
-------

* Init option for cloning the source of a release
* Port ``opx_rel_pkgasm`` from python script to module
* Port ``opx_get_packages`` from python script to module
* Port ``opx_bld_basics`` from python script to module

License
-------

OpenSwitch Development Tool is distributed under the terms of the
`MIT License <https://choosealicense.com/licenses/mit>`_.
