Jump to: navigation, search

Difference between revisions of "StarlingX/MultiOS/OpenSUSE"

(How to build packages using OBS)
 
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
=== Scope of the project ===
 
=== 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).
+
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) [https://build.opensuse.org/project/show/Cloud:StarlingX:2.0 Cloud:StarlingX:2.0 OBS]. <br />
 +
 
 +
The StarlingX directory layout is explained in [https://opendev.org/starlingx/specs/src/branch/master/specs/2019.03/approved/multi-os-2004891-directory-layout.rst StarlingX: Define directory layout for MultiOS] specification.  
 
   
 
   
 
=== How to build packages using OBS ===
 
=== How to build packages using OBS ===
 
1. Create OBS account: [https://build.opensuse.org/ openSUSE Build Service].<br />
 
1. Create OBS account: [https://build.opensuse.org/ openSUSE Build Service].<br />
  
2. Install osc OBS cli tool.<br />
+
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 [http://download.opensuse.org/repositories/openSUSE:/Tools/ openSUSE download center] .<br />
 +
 
 +
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. <br />
 +
 
 +
4. Create a new package.
 +
    osc mkpac <your_package_name>
 +
 
 +
5. Add a tarball to <your_package_name>.<br />
 +
 
 +
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.<br />
 +
 
 +
6. Add the spec file and edit it.<br />
 +
 
 +
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. <br />
 +
 
 +
The convention to follow is to use the repository tarball and add the source code location to the openSUSE spec %setup macro. <br />
 +
 
 +
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
 +
    ...
  
3. Then, you can get your project using this command:
+
7. In addition, add a changes file using this command.
     osc checkout home:marcelarosalesj
+
     osc vc
osc will require your credentials the first time you use it.<br />
+
Remember that you should add the %changelog macro to the spec file.
  
4. Create a new package
+
8. Do a local build.
     osc mkpac nfv
+
     osc build -p /tmp/foo -k /tmp/foo --no-verify openSUSE_Leap_15.0 x86_64 <your_package_name>.spec
5. Add the spec file and tarball.<br />
 
  
6. Do a local build.
+
9. The output is descriptive and will tell you about errors, warnings and where it put the resulting RPMs.<br />
    osc build -p /tmp/foo -k /tmp/foo --no-verify openSUSE_Leap_15.0 x86_64 nfv.spec
 
7. The output is descriptive and will tell you about errors, warnings and where it put the resulting RPMs.<br />
 
  
8. You can see the versioned files in osc.
+
10. You can see the status of the files in your working copy using osc.
 
     osc status
 
     osc status
9. You will need to add to the new/changed files.
+
11. You will need to add to the new/changed files.
     osc add nfv.spec
+
     osc add <your_package_name>.spec
     osc add stx-nfv-1.0.tar.xz
+
     osc add <your_package_name>.changes
10. After having a successful build, you now can send the files to your personal project. In this case home:marcelarosalesj.
+
    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
 
     osc commit
11. Once it is on OBS infrastructure, a build is triggered. You can see on your OBS account the status and log of that build.<br />
+
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.<br />
  
12. Finally, you can contribute to StarlingX by submitting your package to Cloud:StarlingX:2.0 project. [https://build.opensuse.org/project/show/Cloud:StarlingX:2.0 StarlingX OBS].  
+
14. Finally, you can contribute to StarlingX by submitting your package to Cloud:StarlingX:2.0 project.  
     osc submitreq home:marcelarosales nfv Cloud:StarlingX:2.0 nfv
+
     osc submitreq home:<your_login> <your_package_name> Cloud:StarlingX:2.0 <your_package_name>
 +
And sending your spec to the project source code.
  
=== References ===
+
=== References ===  
* [https://opendev.org/starlingx/specs/src/branch/master/specs/2019.03/approved/multi-os-2004891-directory-layout.rst StarlingX: Define directory layout for MultiOS]
 
 
* [https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.osc.html osc installing and configuration]
 
* [https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.osc.html osc installing and configuration]
 
* [https://openbuildservice.org/help/manuals/obs-beginners-guide/ OBS beginners guide]
 
* [https://openbuildservice.org/help/manuals/obs-beginners-guide/ OBS beginners guide]
 
* [https://en.opensuse.org/openSUSE:Specfile_guidelines openSUSE:Specfile guidelines]
 
* [https://en.opensuse.org/openSUSE:Specfile_guidelines openSUSE:Specfile guidelines]
 
* [https://en.opensuse.org/openSUSE:Packaging_checks openSUSE:Packaging checks]
 
* [https://en.opensuse.org/openSUSE:Packaging_checks openSUSE:Packaging checks]

Latest revision as of 06:04, 12 June 2019

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.

References