Jump to: navigation, search


< StarlingX‎ | MultiOS
Revision as of 06:04, 12 June 2019 by Felipe 57 (talk | contribs) (How to build packages using OBS)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

StarlingX packaging for openSUSE

Scope of the project

To support StarlingX on openSUSE OS the first step is to package the Flock services into an RPM. Currently StarlingX MultiOS team is using openSUSE Build Service, which is a public instance of the Open Build Service (OBS) Cloud:StarlingX:2.0 OBS.

The StarlingX directory layout is explained in StarlingX: Define directory layout for MultiOS specification.

How to build packages using OBS

1. Create OBS account: openSUSE Build Service.

2. Install osc OBS cli tool from the command line :

 for ubuntu:
 $ sudo apt-get install osc

or download the osc OBS cli tool package for your OS directly from the openSUSE download center .

3. Then, you can get your project working copy using this command:

   osc checkout home:<your_login>

osc will require your credentials the first time you use it. If you are behind a proxy, make sure that $http_proxy variables are declared and https://api.opensuse.org/ is reachable from the terminal.

4. Create a new package.

   osc mkpac <your_package_name>

5. Add a tarball to <your_package_name>.

To get the Flock tarballs you can use directly the opendev URL. For example, to get the Fault Flock you can do this.

   cd <your_package_name>
   curl -L -o stx-fault-1.0.tar.gz http://opendev.org/starlingx/fault/archive/master.tar.gz

You would need to change "fault" for the StarlingX Flock repository that has the project you want to package.

6. Add the spec file and edit it.

A StarlingX Flock repository has many projects, each of them has a directory for its source code and directories for the supported Operating Systems. You could use the current CentOS spec file as the basis for the openSUSE spec file, and modify it when appropriate.

The convention to follow is to use the repository tarball and add the source code location to the openSUSE spec %setup macro.

For example, Fault repository has the fm-common project. So, in your OBS working copy package you should have a stx-fault-1.0.tar.gz tarball and a fm-common.spec file. The fm-common.spec is going to have this information:

   Source0: stx-fault-1.0.tar.gz
   %setup -n fm-common/sources

7. In addition, add a changes file using this command.

   osc vc

Remember that you should add the %changelog macro to the spec file.

8. Do a local build.

   osc build -p /tmp/foo -k /tmp/foo --no-verify openSUSE_Leap_15.0 x86_64 <your_package_name>.spec

9. The output is descriptive and will tell you about errors, warnings and where it put the resulting RPMs.

10. You can see the status of the files in your working copy using osc.

   osc status

11. You will need to add to the new/changed files.

   osc add <your_package_name>.spec
   osc add <your_package_name>.changes
   osc add <your_package_name>-<version>.tar.xz

12. After having a successful build, you now can send the files to your personal project. In this case home:<your_login>.

   osc commit

13. Once it is on OBS infrastructure, a build is triggered. You can see on your OBS account the status and log of that build.

14. Finally, you can contribute to StarlingX by submitting your package to Cloud:StarlingX:2.0 project.

   osc submitreq home:<your_login> <your_package_name> Cloud:StarlingX:2.0 <your_package_name>

And sending your spec to the project source code.