<?xml version="1.0" encoding="UTF-8"?>
<!--
  Default objects for OBS
-->

<grammar ns="http://buildservice.org/api" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

  <!-- this list needs to be kept in sync with list in bs_worker -->
  <define ns="" name="build-arch">
    <choice>
      <value>noarch</value>

      <value>aarch64</value>
      <value>aarch64_ilp32</value>

      <value>armv4l</value>
      <value>armv5l</value>
      <value>armv6l</value>
      <value>armv7l</value>
      <value>armv5el</value> <!-- not existing officially -->
      <value>armv6el</value>
      <value>armv7el</value>
      <value>armv7hl</value>
      <value>armv8el</value>

      <value>hppa</value>

      <value>m68k</value>

      <value>i386</value>
      <value>i486</value>
      <value>i586</value>
      <value>i686</value>
      <value>athlon</value>

      <value>ia64</value>

      <value>k1om</value>

      <value>loongarch64</value>

      <value>mips</value>
      <value>mipsel</value>
      <value>mips32</value>
      <value>mips64</value>
      <value>mips64el</value>

      <value>ppc</value>
      <value>ppc64</value>
      <value>ppc64p7</value>
      <value>ppc64le</value>

      <value>riscv64</value>

      <value>s390</value>
      <value>s390x</value>

      <value>sh4</value>

      <value>sparc</value>
      <value>sparc64</value>
      <value>sparc64v</value>
      <value>sparcv8</value>
      <value>sparcv9</value>
      <value>sparcv9v</value>

      <value>x86_64</value>

      <value>local</value>
    </choice>
  </define>

  <define ns="" name="rebuild-modes">
    <choice>
      <value>transitive</value> <!-- DEFAULT: build on source change and all depending packages including indirect dependencies -->
      <value>direct</value>     <!-- build on source change and direct depending packages -->
      <value>local</value>      <!-- build on source change only -->
    </choice>
  </define>

  <define ns="" name="block-modes">
    <choice>
      <value>all</value>       <!-- DEFAULT: block until all packages we depend on are built -->
      <value>local</value>     <!-- like all, but ignore packages from other repositories -->
      <value>never</value>     <!-- immediately start building the packages -->
    </choice>
  </define>

  <define ns="" name="service-modes">
    <choice>
                                   <!-- DEFAULT: the attribute is not used, service running on server and locally before starting a build -->
      <value>trylocal</value>      <!-- try on local clients and merge result, but run also on server side -->
      <value>localonly</value>     <!-- never run on server side, but on the clients before commit or build -->
      <value>serveronly</value>    <!-- run on server side, but not on the clients by default -->
      <value>buildtime</value>     <!-- run during build time inside build env, pulls in services as build dependencies -->
      <value>manual</value>        <!-- never run, except user explicit starts it locally -->
      <value>disabled</value>      <!-- never run, except user explicit starts it locally (old termonology) -->
    </choice>
  </define>

  <define ns="" name="linkedbuild-modes">
    <choice>
      <value>off</value>       <!-- DEFAULT: do not build packages from project links -->
      <value>localdep</value>  <!-- only build project linked packages if they depend on a local package -->
      <value>alldirect</value> <!-- treat packages from project links like local packages, only direct linked projects -->
      <value>alldirect_or_localdep</value> <!-- treat packages from project links like local packages, only direct linked projects, in addition build also packages from indirect links if they depend on these -->
      <value>all</value>       <!-- treat packages from project links like local packages, includes also indirect linked projects -->
    </choice>
  </define>

  <define ns="" name="release-triggers">
    <choice>
                                   <!-- DEFAULT: not set, no release action possible -->
      <value>manual</value>        <!-- only on manual commands the release gets started -->
 <!-- no yet supported <value>allsucceeded</value> -->  <!-- Release when the repository has finished building and all jobs were successfull -->
      <value>maintenance</value>   <!-- Release just once on maintenance release event. This attribute get removed at the same time -->
      <value>obsgendiff</value>    <!-- Define the release target to generate the diff against -->
    </choice>
  </define>

  <define ns="" name="supportstatus-choices">
    <choice>
      <value>l3</value>
      <value>l2</value>
      <value>l1</value>
      <value>acc</value>
      <value>unsupported</value>
      <value>superseded</value>
    </choice>
  </define>

  <define ns="" name="local-role">
    <choice>
      <value>maintainer</value>
      <value>bugowner</value>
      <value>reviewer</value>
      <value>downloader</value>
      <value>reader</value>
    </choice>
  </define>

  <define ns="" name="global-role">
    <choice>
      <value>Admin</value>
      <value>User</value>
    </choice>
  </define>

  <define ns="" name="person-element">
    <element name="person">
      <attribute name="userid">
        <data type="string" />
      </attribute>
      <attribute name="role">
        <ref name="local-role" />
      </attribute>
      <empty/>
    </element>
  </define>

  <define ns="" name="group-element">
    <element name="group">
      <attribute name="groupid">
        <data type="string" />
      </attribute>
      <attribute name="role">
        <ref name="local-role" />
      </attribute>
      <empty/>
    </element>
  </define>

  <define ns="" name="flag-switch">
    <optional>
      <attribute name="repository">
        <data type="string" />
      </attribute>
    </optional>
    <optional>
      <attribute name="arch">
        <ref name="build-arch" />
      </attribute>
    </optional>
  </define>

  <define ns="" name="flag-element">
    <zeroOrMore>
      <optional>
        <element name="enable">
          <ref name="flag-switch"/>
        </element>
      </optional>
      <optional>
        <element name="disable">
          <ref name="flag-switch"/>
        </element>
      </optional>
    </zeroOrMore>
    <empty/>
  </define>

  <define ns="" name="simple-flag-element">
    <optional>
      <element name="enable">
        <empty/>
      </element>
    </optional>
    <optional>
      <element name="disable">
        <empty/>
      </element>
    </optional>
    <empty/>
  </define>

  <define ns="" name="repository-element">
    <element name="repository">
      <attribute name="name">
        <data type="string" />
      </attribute>
      <optional>
        <attribute name="rebuild">
          <ref name="rebuild-modes" />
        </attribute>
      </optional>
      <optional>
        <attribute name="block">
          <ref name="block-modes" />
        </attribute>
      </optional>
      <optional>
        <attribute name="linkedbuild">
          <ref name="linkedbuild-modes" />
        </attribute>
      </optional>
      <interleave>
        <zeroOrMore>
          <element name="download">
            <!-- Download On Demand section. Can be used to integrate content from
                 external package repositories -->
            <attribute name="arch">
              <!-- Valid for this scheduler architecture only -->
              <data type="string" />
            </attribute>
            <attribute name="url">
              <!--
              Url to a repository. For rpm-md repositories it is just the URL. 
              For Debian it can be an URL to a "flat repo". But usually it is
              a distribution URL following the <baseurl>/<dist>/[components] 
              schema (Note: this is not a working URL).
              -->
              <data type="string" />
            </attribute>
            <attribute name="repotype">
              <choice>
                <value>rpmmd</value>
                <value>susetags</value>
                <value>deb</value>
                <value>arch</value>
                <value>mdk</value>
                <value>registry</value>
                <value>apk</value>
              </choice>
              <!--
              Type of the repository meta data.
              -->
            </attribute>
            <interleave>
              <optional>
                <element name="archfilter">
                  <!--
                  A comma separated list of binary architectures to import.
                  By default all of them are made available.
                  -->
                  <text/>
                </element>
              </optional>
              <optional>
                <element name="master">
                  <!--
                  Verify meta data from this specific host.
                  The SSL certificate is *not* checked via CA on purpose, but requires the fingerprint.
                  -->
                  <attribute name="url">
                    <data type="string" />
                  </attribute>
                  <optional>
                    <attribute name="sslfingerprint">
                      <data type="string" />
                    </attribute>
                  </optional>
                </element>
              </optional>
              <optional>
                <element name="pubkey">
                  <!--
                  gpg pubkeys to verify meta data signatures.
                  -->
                  <text/>
                </element>
              </optional>
            </interleave>
          </element>
        </zeroOrMore>

        <zeroOrMore>
            <element name="releasetarget">
              <attribute name="project">
                <data type="string" />
              </attribute>
              <attribute name="repository">
                <data type="string" />
              </attribute>
              <optional>
                <attribute name="trigger">
                  <ref name="release-triggers" />
                </attribute>
              </optional>
            </element>
        </zeroOrMore>
        <zeroOrMore>
          <element name="hostsystem">
            <attribute name="repository">
              <data type="string" />
            </attribute>
            <attribute name="project">
              <data type="string" />
            </attribute>
          </element>
        </zeroOrMore>
        <zeroOrMore>
            <element name="path">
              <attribute name="repository">
                <data type="string" />
              </attribute>
              <attribute name="project">
                <data type="string" />
              </attribute>
            </element>
        </zeroOrMore>
        <zeroOrMore>
          <element name="arch">
            <ref name="build-arch" />
          </element>
        </zeroOrMore>
      </interleave>
      <empty/>
    </element>
  </define>

  <define ns="" name="issue-tracker-element">
    <element name="issue-tracker">
      <interleave>
        <element name="name">
          <text/>
        </element>
        <element name="label">
          <text/>
        </element>
        <element name="kind">
          <text/>
        </element>
        <element name="description">
          <text/>
        </element>
        <optional>
          <element name="enable-fetch">
            <text/>
          </element>
        </optional>
        <optional>
          <element name="publish-issues">
            <text/>
          </element>
        </optional>
        <optional>
          <element name="issues-updated">
            <text/>
          </element>
        </optional>
        <optional>
          <element name="user">
            <text/>
          </element>
        </optional>
        <optional>
          <element name="password">
            <text/>
          </element>
        </optional>
        <element name="url">
          <text/>
        </element>
        <element name="show-url">
          <text/>
        </element>
        <element name="regex">
          <text/>
        </element>
      </interleave>
    </element>
  </define>

  <!-- worker and dispatcher constraint values -->
  <define ns="" name="build-sandbox">
    <choice>
      <value>chroot</value>
      <value>lxc</value>
      <value>kvm</value>
      <value>xen</value>
      <value>secure</value> <!-- xen or kvm -->
    </choice>
  </define>

  <define ns="" name="size-unit">
    <element name="size">
      <attribute name="unit">
        <choice>
          <value>K</value>
          <value>M</value>
          <value>G</value>
          <value>T</value>
        </choice>
      </attribute>
      <data type="float"/>
    </element>
  </define>

  <!-- OBS rating values, used in patchinfos and requests -->
  <define ns="" name="obs-ratings">
    <choice>
      <value>low</value>       <!-- work on it when nothing else needs to be done -->
      <value>moderate</value>  <!-- default: normal priority -->
      <value>important</value> <!-- prefer this over the others, but finish your current task first -->
      <value>critical</value>  <!-- everything and work only on this -->
    </choice>
  </define>

  <!-- Possible states of a repository -->
  <define ns="" name="repository-code">
    <choice>
      <value>unknown</value>
      <value>broken</value>
      <value>scheduling</value>
      <value>blocked</value>
      <value>building</value>
      <value>finished</value>
      <value>publishing</value>
      <value>published</value>
      <value>unpublished</value>
    </choice>
  </define>

  <!-- Possible states of a package -->
  <define ns="" name="package-code">
    <choice>
      <value>unresolvable</value>
      <value>succeeded</value>
      <value>failed</value>
      <value>broken</value>
      <value>disabled</value>
      <value>excluded</value>
      <value>blocked</value>
      <value>locked</value>
      <value>unknown</value>
      <value>scheduled</value>
      <value>building</value>
      <value>finished</value>
    </choice>
  </define>

  <!-- Possible states  of a package -->
  <define ns="" name="jobstatus-result">
    <choice>
      <value>succeeded</value>
      <value>failed</value>
      <value>unchanged</value>
    </choice>
  </define>

  <define ns="" name="token-kind">
    <choice>
      <value>rss</value>
      <value>rebuild</value>
      <value>release</value>
      <value>runservice</value>
    </choice>
  </define>

</grammar>
