1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 09:16:16 +02:00
The Command Line Interface to work with an Open Build Service
Go to file
Dr. Peter Poeml 4944828bf1 - improve usage info on meta command
- if PUT on metadata fails with a 500, and http_debug is True, print out the
  body of the server reply
- rename update_pacmeta() to update_local_pacmeta() for clarity
- rename update_filesmeta() to update_local_filesmeta() for clarity
2007-07-16 13:40:58 +00:00
osc - improve usage info on meta command 2007-07-16 13:40:58 +00:00
CREDITS - with small changes, apply a patch from Marcus Huewe: 2007-06-14 14:30:36 +00:00
NEWS bump version (0.97); update NEWS file 2007-07-11 09:19:06 +00:00
osc_hotshot.py - rewrite configuration handling 2006-10-10 14:04:34 +00:00
osc-wrapper.py Complete rewrite of the internal commandline handling, using cmdln.py. 2007-04-24 23:00:12 +00:00
README Switch from software.opensuse.org to download.opensuse.org as default 2007-07-16 09:45:17 +00:00
setup.py - bump version (0.7) 2006-07-14 17:39:46 +00:00
tests.py adjust testsuite for the new meta command, and for the new commit output 2007-07-16 10:11:40 +00:00
TODO add to TODO 2007-07-13 14:43:22 +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.

If authentication data is found in .netrc, it will also be used.



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