The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)
Osc Setup
Merlin1991  (Talk | contribs)  m (→Copying packages between OBS instances:  mobs -> cobs)  | 
			|||
| (8 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| − | This page describes how to setup osc  | + | This page describes how to setup osc to build for Mer inside the Mer SDK and a some basic osc usage.  | 
| − | =   | + | = Introduction =  | 
| − | + | osc is a tool to interact with OBS servers. It provides many functions including:  | |
| − | + | * Creating, modifying and deleting the information about projects and packages and downloading/uploading their source code and packaging  | |
| + | * Managing the repositories/targets that projects/packages build against  | ||
| + | * Preparing and running local builds of packages  | ||
| + | * Making and managing requests to modify packages in projects (so called SRs or Submit Requests)  | ||
| − | + | = Preparation =  | |
| − | + | You'll need a [https://bugs.merproject.org merproject.org] account and have the [[Platform_SDK|Mer Platform SDK]] setup.  | |
| − | + | == Getting Access ==  | |
| − | + | Just use your Mer Project username (from the Mer bugzilla)  | |
| − | + | == Setup osc credentials ==  | |
| − |   osc -A https://api.  | + | |
| − | This will ask you to enter your   | + | Once your account is enabled, run osc the first time with  | 
| + |   osc -A https://api.merproject.org ls mer-tools:devel  | ||
| + | This will ask you to enter your merproject.org user account details and will simply return a list of packages in the devel level mer-tools project.    | ||
From now on, you can omit the API URL in the command.  | From now on, you can omit the API URL in the command.  | ||
| − |   osc ls  | + |   osc ls mer-tools:devel  | 
| − | = Using Multiple API URLs =  | + | == Create a home project ==  | 
| + | |||
| + | Visit https://build.merproject.org and select the "create home" option.  | ||
| + | |||
| + | = Setup a Mer build project =  | ||
| + | |||
| + | For any commands below the ACC environment variable should be set to your OBS username. eg:  | ||
| + | |||
| + |   export ACC=lbt  | ||
| + | |||
| + | == Adding repos to your home ==  | ||
| + | |||
| + | You can add repositories on the OBS or edit them locally with this command which will launch an editor for you:  | ||
| + | |||
| + |   osc meta prj home:${ACC} -e  | ||
| + | |||
| + | Use the 'lbt' home project as a guide; it has a target (ie a repository of binaries used to make a build root) for Mer_Core_i486 and looks like this:  | ||
| + | |||
| + |   <project name="home:lbt">  | ||
| + |     <title>lbt's Home Project</title>  | ||
| + |     <description></description>  | ||
| + |     <person userid="lbt" role="maintainer"/>  | ||
| + |     <person userid="lbt" role="bugowner"/>  | ||
| + |     <person userid="bossbot" role="maintainer"/>  | ||
| + |     <repository name="Mer_Core_i486">  | ||
| + |       <path repository="standard" project="Mer:MDS:Core:i586"/>  | ||
| + |       <arch>i586</arch>  | ||
| + |     </repository>  | ||
| + |   </project>  | ||
| + | |||
| + | If you need to build for ARM too then you can add a suitable target just before the </project> :  | ||
| + | |||
| + |   <repository name="Mer_Core_armv7hl">  | ||
| + |     <path repository="Core_armv7hl" project="Mer:MDS:Core:armv7hl"/>  | ||
| + |     <arch>armv8el</arch>  | ||
| + |   </repository>  | ||
| + | |||
| + | See the [[OBS architecture naming]] page for more info.  | ||
| + | |||
| + | == Creating projects ==  | ||
| + | |||
| + | You may create sub-projects using the web user interface (see the 'Subprojects' tab for your home project).  | ||
| + | |||
| + | These are useful for building against different targets; eg a NemoApps project may point at various Nemo build targets.  | ||
| + | |||
| + | == Creating packages ==  | ||
| + | |||
| + | To create a package you could do:  | ||
| + | |||
| + |   osc meta pkg home:${ACC}:tools powertop -F - << EOF  | ||
| + |   <package project="home:${ACC}:tools" name="powertop">  | ||
| + |     <title>PowerTOP</title>  | ||
| + |     <description>  | ||
| + |   PowerTOP is a Linux tool to diagnose issues with power consumption and power management. In addition to being a diagnostic tool, PowerTOP also has an interactive mode where you can experiment with various power management settings for cases where the Linux distribution has not enabled those settings.  | ||
| + | |||
| + |   https://01.org/powertop/  | ||
| + | |||
| + |     </description>  | ||
| + |   </package>  | ||
| + |   EOF  | ||
| + | |||
| + | = Tips and Tricks =  | ||
| + | |||
| + | == Specifying local build targets and cache location ==  | ||
| + | |||
| + | The ~/.oscrc comments describe how these work. Some useful values are:  | ||
| + | |||
| + | * build-root : if you can set this to use an SSD it will make a big difference to local builds  | ||
| + | * packagecachedir : a large cache can be very useful. It's not cleaned automatically.  | ||
| + | |||
| + | == Using Multiple API URLs ==  | ||
If you're using osc with other API URLs, you can edit ~/.oscrc and add each of them and assign them aliases  | If you're using osc with other API URLs, you can edit ~/.oscrc and add each of them and assign them aliases  | ||
| − |   <nowiki>[https://api.  | + |   <nowiki>[https://api.merproject.org/]</nowiki>  | 
| − |   user = your-  | + |   user = your-merproject.org-username  | 
| − |   pass = your-  | + |   pass = your-merproject.org-password  | 
| − |   aliases =   | + |   aliases = cobs  | 
  <nowiki>[https://api.opensuse.org]</nowiki>  |   <nowiki>[https://api.opensuse.org]</nowiki>  | ||
| Line 34: | Line 109: | ||
  pass = password  |   pass = password  | ||
  aliases = opensuse  |   aliases = opensuse  | ||
| + | |||
| + | Note the '''apiurl''' value in that file defines the default OBS instance.  | ||
And to use the alias:  | And to use the alias:  | ||
| − |   osc -A   | + |   osc -A mobs ls  | 
  osc -A opensuse ls  |   osc -A opensuse ls  | ||
| − | = Copying packages between OBS instances =  | + | == Copying packages between OBS instances ==  | 
It is possible (and quite handy :)) to copy packages between different OBS instances:  | It is possible (and quite handy :)) to copy packages between different OBS instances:  | ||
  osc -A source_api copypac -t destination_api source_prj source_pkg destination_prj [destination_pkg]  |   osc -A source_api copypac -t destination_api source_prj source_pkg destination_prj [destination_pkg]  | ||
| Line 46: | Line 123: | ||
With the above mentioned aliases:  | With the above mentioned aliases:  | ||
| − |   osc -A opensuse copypac -t   | + |   osc -A opensuse copypac -t cobs Application:Geo monav home:MartinK:nemo  | 
Just with the API URL:  | Just with the API URL:  | ||
| − |   osc -A https://api.opensuse.org copypac -t https://api.  | + |   osc -A https://api.opensuse.org copypac -t https://api.merproject.org Application:Geo monav home:martink:nemo  | 
| − | NOTE: You   | + | NOTE: You usually need a user account on both OBS instances.  | 
Latest revision as of 09:56, 23 March 2014
This page describes how to setup osc to build for Mer inside the Mer SDK and a some basic osc usage.
Contents | 
[edit] Introduction
osc is a tool to interact with OBS servers. It provides many functions including:
- Creating, modifying and deleting the information about projects and packages and downloading/uploading their source code and packaging
 - Managing the repositories/targets that projects/packages build against
 - Preparing and running local builds of packages
 - Making and managing requests to modify packages in projects (so called SRs or Submit Requests)
 
[edit] Preparation
You'll need a merproject.org account and have the Mer Platform SDK setup.
[edit] Getting Access
Just use your Mer Project username (from the Mer bugzilla)
[edit] Setup osc credentials
Once your account is enabled, run osc the first time with
osc -A https://api.merproject.org ls mer-tools:devel
This will ask you to enter your merproject.org user account details and will simply return a list of packages in the devel level mer-tools project.
From now on, you can omit the API URL in the command.
osc ls mer-tools:devel
[edit] Create a home project
Visit https://build.merproject.org and select the "create home" option.
[edit] Setup a Mer build project
For any commands below the ACC environment variable should be set to your OBS username. eg:
export ACC=lbt
[edit] Adding repos to your home
You can add repositories on the OBS or edit them locally with this command which will launch an editor for you:
 osc meta prj home:${ACC} -e
Use the 'lbt' home project as a guide; it has a target (ie a repository of binaries used to make a build root) for Mer_Core_i486 and looks like this:
 <project name="home:lbt">
   <title>lbt's Home Project</title>
   <description></description>
   <person userid="lbt" role="maintainer"/>
   <person userid="lbt" role="bugowner"/>
   <person userid="bossbot" role="maintainer"/>
   <repository name="Mer_Core_i486">
     <path repository="standard" project="Mer:MDS:Core:i586"/>
     <arch>i586</arch>
   </repository>
 </project>
If you need to build for ARM too then you can add a suitable target just before the </project> :
<repository name="Mer_Core_armv7hl"> <path repository="Core_armv7hl" project="Mer:MDS:Core:armv7hl"/> <arch>armv8el</arch> </repository>
See the OBS architecture naming page for more info.
[edit] Creating projects
You may create sub-projects using the web user interface (see the 'Subprojects' tab for your home project).
These are useful for building against different targets; eg a NemoApps project may point at various Nemo build targets.
[edit] Creating packages
To create a package you could do:
 osc meta pkg home:${ACC}:tools powertop -F - << EOF
 <package project="home:${ACC}:tools" name="powertop">
   <title>PowerTOP</title>
   <description>
 PowerTOP is a Linux tool to diagnose issues with power consumption and power management. In addition to being a diagnostic tool, PowerTOP also has an interactive mode where you can experiment with various power management settings for cases where the Linux distribution has not enabled those settings.
 https://01.org/powertop/
   </description>
 </package>
 EOF
[edit] Tips and Tricks
[edit] Specifying local build targets and cache location
The ~/.oscrc comments describe how these work. Some useful values are:
- build-root : if you can set this to use an SSD it will make a big difference to local builds
 - packagecachedir : a large cache can be very useful. It's not cleaned automatically.
 
[edit] Using Multiple API URLs
If you're using osc with other API URLs, you can edit ~/.oscrc and add each of them and assign them aliases
[https://api.merproject.org/] user = your-merproject.org-username pass = your-merproject.org-password aliases = cobs [https://api.opensuse.org] user = username pass = password aliases = opensuse
Note the apiurl value in that file defines the default OBS instance.
And to use the alias:
osc -A mobs ls osc -A opensuse ls
[edit] Copying packages between OBS instances
It is possible (and quite handy :)) to copy packages between different OBS instances:
osc -A source_api copypac -t destination_api source_prj source_pkg destination_prj [destination_pkg]
Examples:
With the above mentioned aliases:
osc -A opensuse copypac -t cobs Application:Geo monav home:MartinK:nemo
Just with the API URL:
osc -A https://api.opensuse.org copypac -t https://api.merproject.org Application:Geo monav home:martink:nemo
NOTE: You usually need a user account on both OBS instances.