2013-08-15

openSUSE: packaging workflow

I use the Open Build Service to work on openSUSE packages. There is a useful tutorial HERE.

Important resources:

  1. post-build-checks source code
  2. Spec file guidelines

And here is a summary of 'osc' commands I use the most:

alias oosc='osc -A https://api.opensuse.org'


Assuming you will be using the openSUSE Build Service, you will need to include the -A option on all the commands shown below. If you set up this alias, you can save a lot of typing.

osc api "/source/PRJ/PKG?view=info&parse=1&repository=REPO&arch=ARCH"


View the internal metadata used by OBS when it "expands" the spec file immediately prior to build.

osc ar


Add new files, remove disappeared files -- forces the "repository" version into line with the working directory.

osc bco PRJ PKG


See "osc branch", below.

osc branch -c PRJ PKG


If you are not a project maintainer of PRJ, you can still work on PKG by branching it to your home project. Since you typically will want to checkout immediately after branching, 'bco' is a handy abbreviation.

osc build REPOSITORY ARCH


Build the package locally -- typically I do this to make sure the package builds before committing it to the server, where it will build again. The REPOSITORY and ARCH can be chosen from the list produced by osc repositories

osc cat


After finding a mysterious internal OBS file - like _link or project.diff - in your package, you can use this command to see what's inside it.

osc chroot REPOSITORY ARCH


Builds take place in a chroot environment, and sometimes they fail mysteriously. This command gives you access to that chroot environment so you can debug. In more recent openSUSEs the directory to go to is ~/rpmbuild/BUILD/

osc ci


Commit your changes to the server. Other SVN-like subcommands (like update, status, diff) also work as expected.

osc list


Also known as "osc ls", this command can be used to list the "unexpanded sources" of your package: "osc list -u PRJ PKG". If your package is a linkpac, this will show the actual link file. It will also show the mysterious "project.diff" file if there is one. Once you have seen the file, you can use "osc cat" to see what is inside it!

osc log


Each time you commit to your OBS package, a new revision is added. Each revision has a number (like "36") and a hash (like "c038cef019d7eaf2a825082f8b6e2a71"). The revisions can be listed in the web interface, but the web interface does not tell you the revision number or hash. To see the list of revisions *with* revision numbers and hashes, use "osc log".

osc ls


Synonym for "osc list"

osc meta pkg PRJ PKG -e


If you are project maintainer of PRJ, you can create a package directly using this command, which will throw you into an editor and expect you to set up the package's META file. (Hint, it's easier to create new packages via the OBS web UI.)

osc meta prj PRJ -e


This throws up an editor with the meta data of project PRJ.

osc rebuildpac


Sometimes it's desirable to trigger a rebuild on the OBS server.

osc repositories


Shows repositories configured for a project/package. Synonym: "osc repos"

osc rq list


'rq' is short for request -- and request list $PRJ $PKG lists all open requests ("SRs") for the given project and package. For example, if the package python-execnet was submitted to openSUSE:Factory from the devel:languages:python project, the following command would find the request:

$ oosc rq list devel:languages:python python-execnet
356494  State:review     By:factory-auto When:2016-01-28T12:01:16
        submit:          devel:languages:python/python-execnet@3 ->         openSUSE:Factory
        Review by Group      is accepted:  legal-auto(licensedigger)                         
        Review by Group      is accepted:  factory-auto(factory-auto)                        
        Review by Group      is new:       factory-staging                                   
        Review by Group      is new:       legal-team                                        
        Review by Group      is new:       opensuse-review-team                              
        Review by User       is new:       factory-repo-checker                              
        Comment: Please review build success

osc results


This command shows the current build status. (For example, you just did "osc ci" and would like to see what the server is doing with your commit.
NOTE: adding -v gives more information.

osc search PKG


Search for a package. You can also use http://software.opensuse.org/ and zypper search PKG is also helpful.

osc search --binary PKG


Search for a binary package. If you know the name of a binary package (subpackage) and want to find the corresponding OBS project/package, this magic incantation is what you're looking for!

osc sr


'sr' is short for submitrequest -- this submits your changes to the PROJECT for review and, hopefully, acceptance by the project maintainers. If you're curious who those are, you can run osc maintainer (or osc bugowner)

osc vc


After making your changes, edit the changes file. For each release you need to have an entry. Do not edit the changes file yourself: instead, use this command to maintain the changes file "automagically".

NOTE ON LICENSING


JFYI: http://spdx.org/licenses/ lists all well known licenses and their original source. This becomes extremely handy if you start packaging.

No comments:

Post a Comment