.. _Copr:

Steps to deploy in Copr
=======================

Release to Copr
---------------

The current Copr server link is: `pnt-devops/pdc <https://copr.devel.redhat.com/coprs/pnt-devops/pdc/#pdc-devops/pdc>`_. when you open the link, there are some list headers, include:`Overview`, `package`, `Builds`, `Monitor`, `Setting`.

Permission to Copr
``````````````````

First of all; please make sure you have the access to deploy the  package in Copr; If you don't have the right; you can contact sochotni(sochotni@redhat.com) to get the permission.

With the SRPM package to build
``````````````````````````````

Open the `Builds <https://copr.devel.redhat.com/coprs/pnt-devops/pdc/#Builds>`_ button, there are many ways to build the Copr, include:


- `From URLs <https://copr.devel.redhat.com/coprs/pnt-devops/pdc/add_build//#From URLs>`_.


   This way is to provide an external URL link to the package you want to build, which URL link point to SRPM Files.


- `Upload SRPM <https://copr.devel.redhat.com/coprs/pnt-devops/pdc/add_build_upload//#Upload SRPM>`_.


    This way is just to upload a SRPM package directly into Copr to build it.


- `Git and Tito <https://copr.devel.redhat.com/coprs/pnt-devops/pdc/add_build_tito//#Git and Tito>`_.


    This way need to provide a URL of a Git repository,You can optionally specify a directory within that repository and Git branch. You can also choose to build from the last commit instead of the last release.


- `Mock SCM <https://copr.devel.redhat.com/coprs/pnt-devops/pdc/add_build_mock//#Mock SCM>`_


    This way need to provide a URL of a Git or SVN repository and path to the SPEC file within the repository.

This document share the **From URLs** and **Upload SRPM** methods.


#. The **From URLs** method. Open `From URLs <https://copr.devel.redhat.com/coprs/pnt-devops/pdc/add_build//#From URLs>`_.

   When the release have been deployed in Brew; you can get the URL value which point to the SRPM source.
   When input the URL value and click the **Build** button, the Copr server will import the package and build it.

    For example::

      input: 'pdc-client'
      #Get the URL of the latest version.
      The SRPM URL is: `<download.devel.redhat.com/brewroot/work/tasks/2503/10572503/pdc-client-0.9.0-1.el7eng.src.rpm>`


#. The **Upload SRPM** method. Open `Upload SRPM <https://copr.devel.redhat.com/coprs/pnt-devops/pdc/add_build_upload//#Upload SRPM>`_.

   This method is to upload the local SRPM package to Copr, you just to check the path which absolutely path to the SRPM package.
   When you build the SRPM package via the rpmbuild command;

    ::

      $ rpmbuild -ba  ~/rpmbuild/SPECS/[spec_name]

You can find the SRPM package path: `~/rpmbuild/SRPMS/*`.

After you find the SRPM file, and click the **Build** button. The Copr server will build it autom
