- added configuration migration information (it is also available in the wiki
[opensuse:osc.git] / README
1 osc -- opensuse-commander with svn like handling
2
3
4 Please send patches to poeml@suse.de, or work directly on
5 https://forgesvn1.novell.com/svn/opensuse/trunk/buildservice/src/clientlib/python/osc/
6
7
8 INSTALLATION:
9
10 RPM packages are here (yum repository):
11 http://download.opensuse.org/repositories/openSUSE:/Tools/
12
13 To install from svn, do
14         python setup.py build
15         python setup.py install
16         # create a symlink 'osc' in your path pointing to osc.py.
17         ln -s osc-wrapper.py /usr/bin/osc
18
19 Alternatively, you can directly use osc-wrapper.py from the source dir
20 (which is easier if you develop on osc).
21
22
23 The program needs the cElementTree python module installed. On SUSE, the
24 respective package is called python-elementtree (before 10.2: python-xml). 
25 For local building, you will need python-urlgrabber in addition. Those are
26 standard package on SUSE Linux since a while. If your version is too old, you
27 can find python-elementtree and python-urlgrabber here:
28 http://download.opensuse.org/repositories/devel:/languages:/python/
29
30
31
32 CONFIGURATION:
33
34 When you use it for the first time, it will ask you for your username and
35 password, and store it in ~/.oscrc.
36
37
38 CONFIGURATION MIGRATION (only affects versions >= 0.114):
39
40 Version 0.114 got some cleanups for the configfile handling and therefore some
41 options are now deprecated, namely:
42 * apisrv
43 * scheme
44
45 One new option was added:
46 * apiurl = <protocol>://<somehost> # use this as the default apiurl. If this
47 option isn't specified the default (https://api.opensuse.org) is used.
48
49 So far osc still has some backward compatibility for these options but it might
50 get removed in the future that's why it issues a deprecation warning in case
51 one of those options is still in use.
52
53 The new configuration scheme looks like the following:
54  # entry for an apiurl
55  [<protocol>://<apiurl>]
56  user = <username>
57  password = <password>
58  ...
59
60 '''Before starting the migration please save your ~/.oscrc file!'''
61
62 If the migration doesn't work for whatever reason feel free to send me an email
63 or ask on the opensuse-buildservice mailinglist or in the #opensuse-buildservice
64 irc channel.
65
66 === Migration case I (apisrv only) ===
67 The apisrv option is used to specify the default apihost. If apisrv isn't
68 specified at all the default ("api.opensuse.org") is used.
69 The current [general] section looks like this:
70  [general]
71  ...
72  apisrv = <somehost>
73  # or
74  apisrv = <protocol>://<somehost>
75
76 apisrv got superseded by the new apiurl option which looks like this:
77  [general]
78  ...
79  apiurl = <protocol>://<somehost>
80
81 If apisrv has no "<protocol>" https is used. Make sure all apiurl sections have
82 the new format which is described above. Afterwards apisrv can be removed.
83
84 === Migration case II (scheme only) ===
85 The current [general] section looks like this:
86  [general]
87  ...
88  scheme = <protocol>
89
90 This means every apiurl section which don't have the new format which is
91 described above for instance
92  [<somehost>]
93  user = <username>
94  password = <password>
95  ...
96
97 has to be converted to
98  [<protocol>://<somehost>]
99  user = <username>
100  password = <password>
101  ...
102
103 Afterwards the scheme option can be removed from the [general] section (it
104 might be the case that some sections already have the correct format).
105
106 === Migration case III (apisrv and scheme) ===
107 The current [general] section looks like this:
108  [general]
109  ...
110  apisrv = <somehost>
111  scheme = <protocol>
112
113 Both options can be removed if all apiurl sections have the new format which is
114 described above. So basically just adjust all apiurl sections (it might be the
115 case that some sections already have the correct format).
116
117
118
119 USAGE EXAMPLES:
120 (online at http://en.opensuse.org/Build_Service/CLI )
121
122 To list existing content on the server
123  osc ls                                 # list projects
124  osc ls Apache                  # list packages in a project 
125  osc ls Apache subversion       # list files of package of a project
126
127 Check out content
128  osc co Apache                  # entire project
129  osc co Apache subversion       # a package
130  osc co Apache subversion foo   # single file
131
132 Update a working copy
133  osc up
134  osc up [pac_dir]               # update a single package by its path
135  osc up *                       # from within a project dir, update all packages
136  osc up                         # from within a project dir, update all packages
137                                    AND check out all newly added packages
138
139 If an update can't be merged automatically, a file is in 'C' (conflict)
140 state, and conflicts are marked with special <<<<<<< and >>>>>>> lines. 
141 After manually resolving the problem, use
142  osc resolved foo
143
144 Upload change content
145  osc ci                         # current dir
146  osc ci <dir>
147  osc ci file1 file2 ...
148
149 Show the status (which files have been changed locally)
150  osc st
151  osc st <directory>
152  osc st file1 file2 ...
153
154 Mark files to be added or removed on the next 'checkin'
155  osc add file1 file2 ...
156  osc rm file1 file2 ...
157
158 Adds all new files in local copy and removes all disappeared files.
159  osc addremove
160
161 Generates a diff, to view the changes
162  osc diff                       # current dir
163  osc diff file1 file2 ...
164
165 Shows the build results of the package
166  osc results
167  osc results [platform]
168
169 Shows the log file of a package (you need to be inside a package directory)
170  osc log <platform> <arch>
171
172 Shows the URLs of .repo files which are packages sources for Yum/YaST/smart
173  osc repourls [dir]
174
175 Triggers a package rebuild for all repositories/architectures of a package
176  osc rebuildpac [dir]
177
178 Shows available platforms/build targets
179  osc platforms
180
181 Shows the configured platforms/build targets of a project
182  osc platforms <project>
183
184 Shows meta information
185  osc meta Apache
186  osc meta Apache subversion
187  osc id username
188
189 Edit meta information
190 (Creates new package/project if it doesn't exist)
191  osc editmeta Apache
192  osc editmeta Apache subversion
193
194 Update package meta data with metadata taken from spec file
195  osc updatepacmetafromspec <dir>
196
197
198 There are other commands, which you may not need (they may be useful in scripts):
199  osc repos
200  osc buildconfig
201  osc buildinfo
202
203
204 Locally build a package (see 'osc help build' for more info):
205  osc build <repo> <arch> specfile [--clean|--noinit]
206
207
208 Update a package to a different sources (directory foo_package_source):
209  cp -a foo_package_source foo; cd foo; osc init <prj> <pac>; osc addremove; osc ci; cd $OLDPWD; rm -r foo
210
211
212
213 HINT FOR W3M USERS
214
215 Putting the following in the file ~/.w3m/passwd will make
216 w3m know the credentials for the buildservice servers:
217
218 """
219 host api.opensuse.org
220   port 80
221   realm Authentication required
222   login foo
223   password bar
224
225 host build.opensuse.org
226   port 80
227   realm openSUSE Build Service
228   login foo
229   password bar
230 """
231
232 chmod 0600 ~/.w3m/passwd
233
234
235 NOTES about the testsuite
236
237 It requires editing tests.py, for a user account / project to work with.
238 I use my own project (home:poeml) for testing.
239 Tests can be run as ./tests.py
240 or, more powerful, with nosetests:
241   nosetests --exe
242 To run a single test, you can use:
243   nosetests --exe tests:TestOsc.testCmdOptVersion