[Starlingx-discuss] MultiOS: Tricks for OBS when removing tar file in favour of source from git

Dominig ar Foll (Intel Open Source) dominig.arfoll at fridu.net
Wed Sep 11 09:55:34 UTC 2019


Hello,

as agreed, the move from using tar files as source for OBS in favour of
direct download from git has started.
Please note that when doing so, not only the _service must be created
but often the spec file needs some changes.
Please see some explanations bellow.

The _service file need to look like this

<services>
  <service name="obs_scm">
    <param name="scm">git</param>
    <param name="url">https://opendev.org/starlingx/utilities</param>
    <param name="version">1.0</param>
    <param name="subdir">utilities/worker-utils/worker-utils</param>
    <param name="filename">worker-utils</param>
    <param name="changesgenerate">disable</param>
  </service>
  <service mode="buildtime" name="tar" />
  <service mode="buildtime" name="recompress">
    <param name="compression">gz</param>
    <param name="file">*.tar</param>
  </service>
  <service name="set_version" mode="disabled"/>
</services>

where 
<param name="url"> points toward the git repo hosting the file
<param name="version"> is the suffix that you want to be added to your
rpm package name (I guess 2.0 would now be more appropriate)
<param name="subdir"> is the the directory in which your project is
located on the git tree
<param name="filename"> the base name of the file that you will create
for building, best to keep it the same as the package name (see Name: in
spec file)
The rest can remain unchanged for most packages.

In the spec files the points to look at are :

Name: worker-utils
   This will be the name of the package and the content of the macro %{name}
   best to keep it the same as <param name="filename"> in _service
Version: 1.0
   This will setup the %{version} variable,
   best to get it aligned with <param name="version"> in _service
Release: %{tis_patch_ver}%{?_tis_dist}
   This is specific to startlingX and MUST be defined in your project
config in OBS (done for you if you create a branch)
    osc meta prjconf
       Macros:
       %tis_patch_ver   1
       :Macros
License: Apache-2.0
       This mandatory and must be using the correct OpenSUSE compliant typo.
Source0: %{name}-%{version}.tar.gz
       This is name of the source file created by osb_scm service.
       If Name: and Version: are well setup in line _service, it will
work out of the box.

%setup
   if you have well defined the <param name="filename"> in _service
content and the macro Name: and Version in spec file,
   You do not need any extra option.

Building locally using osc build will show you errors and warnings.
The OBS is a bit more tolerant than the local build but one that we will
had rpmlint that will not be the case any more.
So better to correct all errors and relevant warnings.

Enjoy your day.

-- 
Dominig ar Foll
Senior Software Architect
Intel Open Source Technology Centre




More information about the Starlingx-discuss mailing list