1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 22:56:15 +01:00
The Command Line Interface to work with an Open Build Service
Go to file
Jürgen Weigert 83b1b5ca59 All in one go.
0.121.jw02
 - made rresults an alias for results. python decorators are a strange concept...
 - asserting that ~/.oscrc remains mode 0600
 - no more plain text passwords in ~/.oscrc, we store now as bz2+base64
 - added verbosity control -v -q. To be used in guess_proj_pack()
 - added 'll' and 'ls -l' as shorthand to 'list -v'
 - started to change to explicit dual license GPLv2 or GPLv3 to conform to Novell policy.
 - added revision parameter to show_upstream_srcmd5(), so that it can be used in do_cat later.
 - allowed both integer and srcmd5 revisions in meta_get_filelist()
 - added 'lL', 'LL': allowed -e and -v together in do_list(). Was an internal error before.
 - added cat -e, to cat a file through a link.
   'cat -e -r 3' expands through the third revision of the _link.
 - added subcmd bco as alias for branch -c
 - added default project to branch subcommand. .oscrc:branch_project = OpenSUSE:Factory
 - added primitive experimental support for .oscrc:checkout_no_colon = 1
 - suggest using svn when .svn found.
 - alias submitpac submitrequest
 - osc bco now continues to checkout after branch target exists error.
 - added .oscrc:plaintext_passwd=1 for backwards compatibility
 - moved core.py:exclude_stuff to .oscrc:exclude_glob and expand it to catch *.orig etc.
 - allowed req as alias for request.
 - bugfix get_request_list: use 'or' with multiple states, not 'and'.
 - added osc req list -s all; a shorthand for enumerating all states
 - osc req list no longer confuses creator with approver.
 - osc req list -D nnn limit to requests nnn days old.
 - osc req list now also shows requests from the the given package, not only to.
 - improved help texts with repairlink to point to osc resolved.
 - improved passx code when creating oscrc.
 - osc sr -l is now a shortcut for 'osc req list -M -a -t submit -D 0'
2009-08-20 19:28:05 +00:00
dist Add prjresults and results to completion 2009-07-10 11:32:17 +00:00
fuse fuseosc: do not throw exception when no connectivity available 2008-09-20 16:06:06 +00:00
osc All in one go. 2009-08-20 19:28:05 +00:00
AUTHORS All in one go. 2009-08-20 19:28:05 +00:00
NEWS All in one go. 2009-08-20 19:28:05 +00:00
osc_expand_link.pl typo. 2008-03-26 19:24:05 +00:00
osc_hotshot.py - rewrite configuration handling 2006-10-10 14:04:34 +00:00
osc-wrapper.py - use the default enconding if LANG is not set 2009-07-12 18:31:50 +00:00
osc.ico optional support for py2exe 2009-05-14 15:49:54 +00:00
osc.png optional support for py2exe 2009-05-14 15:49:54 +00:00
README osc can now store credentials in Gnome keyring if it is available (bnc#460540) 2009-05-11 07:46:01 +00:00
setup.py more fixes for Windows port 2009-05-15 11:40:50 +00:00
tests.py fix testsuite for changed osc info output 2008-04-02 14:08:23 +00:00
TODO All in one go. 2009-08-20 19:28:05 +00:00

osc -- opensuse-commander with svn like handling


Please send patches to poeml@suse.de, or work directly on
https://forgesvn1.novell.com/svn/opensuse/trunk/buildservice/src/clientlib/python/osc/


INSTALLATION:

RPM packages are here (yum repository):
http://download.opensuse.org/repositories/openSUSE:/Tools/

To install from svn, do
	python setup.py build
	python setup.py install
	# create a symlink 'osc' in your path pointing to osc.py.
	ln -s osc-wrapper.py /usr/bin/osc

Alternatively, you can directly use osc-wrapper.py from the source dir
(which is easier if you develop on osc).


The program needs the cElementTree python module installed. On SUSE, the
respective package is called python-elementtree (before 10.2: python-xml). 
For local building, you will need python-urlgrabber in addition. Those are
standard package on SUSE Linux since a while. If your version is too old, you
can find python-elementtree and python-urlgrabber here:
http://download.opensuse.org/repositories/devel:/languages:/python/



CONFIGURATION:

When you use it for the first time, it will ask you for your username and
password, and store it in ~/.oscrc.


CONFIGURATION MIGRATION (only affects versions >= 0.114):

Version 0.114 got some cleanups for the configfile handling and therefore some
options are now deprecated, namely:
* apisrv
* scheme

One new option was added:
* apiurl = <protocol>://<somehost> # use this as the default apiurl. If this
option isn't specified the default (https://api.opensuse.org) is used.

So far osc still has some backward compatibility for these options but it might
get removed in the future that's why it issues a deprecation warning in case
one of those options is still in use.

The new configuration scheme looks like the following:
 # entry for an apiurl
 [<protocol>://<apiurl>]
 user = <username>
 password = <password>
 ...

'''Before starting the migration please save your ~/.oscrc file!'''

If the migration doesn't work for whatever reason feel free to send me an email
or ask on the opensuse-buildservice mailinglist or in the #opensuse-buildservice
irc channel.

=== Migration case I (apisrv only) ===
The apisrv option is used to specify the default apihost. If apisrv isn't
specified at all the default ("api.opensuse.org") is used.
The current [general] section looks like this:
 [general]
 ...
 apisrv = <somehost>
 # or
 apisrv = <protocol>://<somehost>

apisrv got superseded by the new apiurl option which looks like this:
 [general]
 ...
 apiurl = <protocol>://<somehost>

If apisrv has no "<protocol>" https is used. Make sure all apiurl sections have
the new format which is described above. Afterwards apisrv can be removed.

=== Migration case II (scheme only) ===
The current [general] section looks like this:
 [general]
 ...
 scheme = <protocol>

This means every apiurl section which don't have the new format which is
described above for instance
 [<somehost>]
 user = <username>
 password = <password>
 ...

has to be converted to
 [<protocol>://<somehost>]
 user = <username>
 password = <password>
 ...

Afterwards the scheme option can be removed from the [general] section (it
might be the case that some sections already have the correct format).

=== Migration case III (apisrv and scheme) ===
The current [general] section looks like this:
 [general]
 ...
 apisrv = <somehost>
 scheme = <protocol>

Both options can be removed if all apiurl sections have the new format which is
described above. So basically just adjust all apiurl sections (it might be the
case that some sections already have the correct format).


KEYRING USAGE

Osc now can store passwords in Gnome keyring instead of ~/.oscrc. To use it,
you need python-gnomekeyring and keyring daemon running.

If you want to switch to using Gnome keyring you need to delete apiurl section
from ~/.oscrc and you will be asked for credentials again, which will be then
stored in Gnome keyring.


USAGE EXAMPLES:
(online at http://en.opensuse.org/Build_Service/CLI )

To list existing content on the server
 osc ls 				# list projects
 osc ls Apache 			# list packages in a project 
 osc ls Apache subversion 	# list files of package of a project

Check out content
 osc co Apache 			# entire project
 osc co Apache subversion	# a package
 osc co Apache subversion foo	# single file

Update a working copy
 osc up
 osc up [pac_dir]		# update a single package by its path
 osc up * 			# from within a project dir, update all packages
 osc up  			# from within a project dir, update all packages
				   AND check out all newly added packages

If an update can't be merged automatically, a file is in 'C' (conflict)
state, and conflicts are marked with special <<<<<<< and >>>>>>> lines. 
After manually resolving the problem, use
 osc resolved foo

Upload change content
 osc ci				# current dir
 osc ci <dir>
 osc ci file1 file2 ...

Show the status (which files have been changed locally)
 osc st
 osc st <directory>
 osc st file1 file2 ...

Mark files to be added or removed on the next 'checkin'
 osc add file1 file2 ...
 osc rm file1 file2 ...

Adds all new files in local copy and removes all disappeared files.
 osc addremove

Generates a diff, to view the changes
 osc diff 			# current dir
 osc diff file1 file2 ...

Shows the build results of the package
 osc results
 osc results [platform]

Shows the log file of a package (you need to be inside a package directory)
 osc log <platform> <arch>

Shows the URLs of .repo files which are packages sources for Yum/YaST/smart
 osc repourls [dir]

Triggers a package rebuild for all repositories/architectures of a package
 osc rebuildpac [dir]

Shows available platforms/build targets
 osc platforms

Shows the configured platforms/build targets of a project
 osc platforms <project>

Shows meta information
 osc meta Apache
 osc meta Apache subversion
 osc id username

Edit meta information
(Creates new package/project if it doesn't exist)
 osc editmeta Apache
 osc editmeta Apache subversion

Update package meta data with metadata taken from spec file
 osc updatepacmetafromspec <dir>


There are other commands, which you may not need (they may be useful in scripts):
 osc repos
 osc buildconfig
 osc buildinfo


Locally build a package (see 'osc help build' for more info):
 osc build <repo> <arch> specfile [--clean|--noinit]


Update a package to a different sources (directory foo_package_source):
 cp -a foo_package_source foo; cd foo; osc init <prj> <pac>; osc addremove; osc ci; cd $OLDPWD; rm -r foo



HINT FOR W3M USERS

Putting the following in the file ~/.w3m/passwd will make
w3m know the credentials for the buildservice servers:

"""
host api.opensuse.org
  port 80
  realm Authentication required
  login foo
  password bar

host build.opensuse.org
  port 80
  realm openSUSE Build Service
  login foo
  password bar
"""

chmod 0600 ~/.w3m/passwd


NOTES about the testsuite

It requires editing tests.py, for a user account / project to work with.
I use my own project (home:poeml) for testing.
Tests can be run as ./tests.py
or, more powerful, with nosetests:
  nosetests --exe
To run a single test, you can use:
  nosetests --exe tests:TestOsc.testCmdOptVersion