openSUSE:OBS Light Obstag
- 1 Motivation
- 2 Download
- 3 obstag
- 4 obs2obscopy
- 5 Examples
- 6 obsextractgroups
When creating project, its important to be able to build on a know status of each constituents. It is also important to be able to copy only what as changed when syncing up with a newer version. obstag and obs2obscopy commands add support for this requirement to any OBS. obscreategroups complement these two utilities for the image creation.
- The latest version can be downloaded from our GIT tree here
- Packaged versions are available in the OBS Light project repository here. The tools are included in the obslight package.
OBS does not provide a tagging concept but offers a concept of version control with a revision which is associated to each package of a project. The revision of a package is expressed by a sequence number (representing the number of commits done on that package) and a MD5 checksum which provides direct access to a specific version of a package.
Note that the revision number is local to each OBS instance while the MD5 is transportable from one OBS instance to an other.
obstag utility creates a tag file for a given project. That tag file can be used later to copy that specific version of the project into another target project.
Warning: when obstag is used on a remote OBS via a link on a local OBS, obstag will create a package list but without any version tag information. With such a reduced information, obs2obscopy will always copy the latest version of the packages.
Launching obstag without any parameter or --help will display the on line help. There is no man page.
$ obstag --help HELP Function : Tag a project in an OBS (remote obs are managed via a linked project) It will create a tag file which constains the MD5 to represent the package revision The Tag file can be used as direct input for obs2obsCopy Usage: /usr/local/bin/obstag obs-alias project-name md5_file-name Example: /usr/local/bin/obstag http://myObs.mynetwork:444 meego.com:MeeGo:1.2:oss my_revision_tag.md5 meego.com can be a local projet which is a link to a remote OBS public API Public API do NOT provide log info and in that case revision info will be empty obs2obscopy will then copy the current release Version 3.0 Licence GLPv2
OBS does not provide by default a method to copy a full project. obs2obscopy provides that facility using an obstag file as input.
The name obs2obscopy can be confusing because the command works in a single OBS instance (referenced by its alias). Copy from one OBS to another is done by the creation of a link project. This method as been selected because it provides a quicker copying process (but the command name has remained unchanged). Starting from version 3, you can do the copy directly from a public API, it is not mandatory to create a link project.
All the packages which are listed in the tag file will be copied. Any line starting with a # will be ignored (comment-out facility). Only the MD5 is used to identify a package version, other information present in the tag file are for information only.
As a package will only be copied if it does not already exist on the target OBS, the command obs2obscopy can be rerun as many times as required to get the copy done without error (network errors are not uncommon) or to upgrade a project.
A report is printed at the end of the copy which will tell you if errors have occurred. The name of the log file is printed as well.
$ obs2obscopy --help HELP Function : Copy a project from an OBS to an OBS, using as input a package list with the desired MD5 to represent the package revision. If target package is already at the correct revision, its copy is ignored. Running the script several times is possible until zero errors is achieved. A log file named <MD5_FILE>.log is created for every run. Usage: obs2obscopy obs-alias source_prj target_prj md5_file or obs2obscopy obs-alias source_prj other-obs-alias target_prj md5_file md5_file is created by the script obstag Example1: Local copy obs2obscopy http://myObs.mynetwork:444 MyMeeGo:1.2:oss myTest:MeeGo:1.2:oss my_revision_tag.md5 Example2: Remote copy (by link) obs2obscopy http://myObs.mynetwork:444 meego.com:MeeGo:1.2:oss myobs:MeeGo:1.2:oss my_revision_tag.md5 where meego.com is a local project which is a link to a remote OBS public API Example3: Remote copy obs2obscopy http://api.pub.meego.com/public Project:MINT:Testing http://myObs.mynetwork:444 myTest:MINT:Testing my_revision_tag.md5 Return code: 0 success 1 some packages not copied 2 wrong number of arguments 3 problem reading MD5 file or writing log file 4 network error 5 interrupted by user Version 3.1 License GLPv2
A final report is printed at the end of each copy. Packages in error can be created by a lock on that package at the time of copy or a network error (in that case rerunning the command will wipe the problem out) or the deletion of a package in the source project (then the error will never go and commenting out the line in the the tag file is your best option).
Final reports Total packages requested = 1385 Packages existing on target = 1375 Packages needed copying = 10 Packages copied = 8 Packages in error = 2
- The md5 comparison of packages which are links to other packages does not work, so the copy will be done without taking into account the md5, and packages already present on target will be overwritten, even if they are the same. If you don't want obs2obscopy to overwrite them, edit the tag file produced by obstag and remove the md5 (first field) of the packages in question.
Copying a local project
obstag MyObsAlias MyProjectToCopy MyProjectToCopyAsToday.md5 obs2obscopy MyObsAlias MyProjectToCopy MyProjectTarget MyProjectToCopyAsToday.md5
Delivering an initial copy of a project to a customer
On the provider side
obstag SourceObsAlias MyProjectToDeliver ProjectToDeliverV-x.x.md5
- mail to customer
- pointer to the public or private API of the source OBS (if private then Login and Password must be provided)
On the Customer side
- create a link project to the provider OBS API
- if nonexistent create the receiving project (e.g. TheProject)
obs2obscopy CustomerObsAlias ProviderProjectLink:MyProjectToDeliver TheProject ProjectToDeliverV-x.x.md5
Upgrading a copy of a project to a customer
Simply use the same process as for the initial delivery. obs2obscopy will only copy the packages which are not already presented on the target
Removing some packages from the copy
If for any motive some packages should not be copied, a simple # at the beginning of any line will comment out that line.
Creating a remote target project is very simple.
- Create an empty project on your OBS (e.g. LinkToMeego.com)
- Edit the meta data of the project
- osc meta -e prj LinkToMeego.com
<project name="LinkToMeego.com"> <title>build.MeeGo.com</title> <description>This project allows access to all resources on build.meego.com instance.</description> <remoteurl>https://api.meego.com/public</remoteurl> <person role="maintainer" userid="Admin"/> <person role="bugowner" userid="Admin"/> </project>
- if the target OBS is not a public API, the you need to change the login and passwd. MeeGo.com API is public and does not require a password but some other publishers (e.g. Genivi Alliance) require a login and password to use their API
obsextractgroups as it name tells, simply extract packages groups from a published repo and provides them as files ready for used by MIC as an include file in a .ks via the macro %include. It can read packages groups from local or remote repositories. A full URL allows to specify the source of the group information. The groups are extracted in files in a format which is compatible with the macro %include of a kick start file (.ks) as used by MIC.
/obsextractgroups.py --help HELP obsextractgroups Function : Parse the group.xml file (even it's a .gz file), in a Meego's repos, and save the lists of rpm for each group into files, with the name of the group for name. Usage: obsextractgroups [option] URL-to-published-repo [target-dir-includes-files] [option]: -s silent mode -d debug mode, copy the group.xml in the target-dir-includes-files. -v verbose mode. URL-to-published-repo: must be a valid repository target-dir-includes-files: is optional, by default the value is the current directory Example1: Remote ./obsextractgroups.py -v -d http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/ ./result/ Example2: Remote (note: here the port is 82) ./obsextractgroups.py http://220.127.116.11:82/home%3a/ronan%3a/MeeGo%3a/1.2/ Example3: Local ./obsextractgroups.py -s ./repos/ version:0.1 License:+GLPv2
A final report is printed at the end of the copy.
Number of Groups: 47 Group name Numbers of packages Basic Hardware Support 1 MeeGo SDK Base 17 MeeGo Tablet Applications 17 MeeGo Handset Desktop 35 MeeGo Compliance 78 Virtual Machine Support 4 Minimal MeeGo X Window System 7 MeeGo Handset Applications 19 MeeGo TV 16 MeeGo Core 121 ... ...