* obsolete deletepac and deleteprj to delete and rdelete commands.
- enable package tracking by default
* add support to hide commands in help list (so we can show propper
help when people still try to use it).
seife: this is for you, drop your own scripts emulating it :)
The usage information on osc co PACKAGE was a bit confusing and one of
the descriptions was inaccurate. Remove the inaccurate description and
improve the language on the clearer one.
A simple solution to the colons in project names messing up LD_LIBRARY_PATH:
http://lists.opensuse.org/archive/opensuse-buildservice/2008-12/msg00166.html
Example use:
$ osc co -c openSUSE:Factory osc
A $PWD/osc/debian.changelog
A $PWD/osc/debian.tar.gz
A $PWD/osc/osc-0.113.tar.gz
A $PWD/osc/osc.changes
A $PWD/osc/osc.dsc
A $PWD/osc/osc.spec
A $PWD/osc/ready
Versus without -c
$ osc co openSUSE:Factory osc
A $PWD/openSUSE:Factory/osc/debian.changelog
A $PWD/openSUSE:Factory/osc/debian.tar.gz
A $PWD/openSUSE:Factory/osc/osc-0.113.tar.gz
A $PWD/openSUSE:Factory/osc/osc.changes
A $PWD/openSUSE:Factory/osc/osc.dsc
A $PWD/openSUSE:Factory/osc/osc.spec
A $PWD/openSUSE:Factory/osc/ready
Signed-off-by: Brandon Philips <bphilips@suse.de>
New functions:
osc.core.get_commit_message_template()
- check the differences in .changes
- extract them and add to the commit message
osc.core.dgst_from_string():
- same as dgst, but work with string argument
Modified functions:
osc.core.edit_message():
- new optional argument template
osc.commandline.do_commit():
- use get_commit_message_template to collect the changes and call the
edit_message with template argument
osc.core.edit_message():
- used dgst_from_string for header_orig value, so commit message could be
used as is with template. Used a mtime check for canceling support.
TODO: maybe is dgst_from_string unecessary
- print_buildlog: use streamfile() to retrieve the buildlog
- do_cat: use streamfile() to retrieve a file - there's no need to have a tempfile or to read the entire file into memory anymore
- add --current parameter for linkpac to use current revision of source
package fixed.
- add osc setlinkrev to add or update revision number in links easily
- fix streaming of binary files via "cat" (#493325)
fostering open source contributions says that it can discourage contribution by
conveying a false sense of "code ownership". Marking territory is negatively
affecting collaboration. See http://www.youtube.com/watch?v=ZSFDm3UYkeE
* basically get rid of the scheme and apisrv mess - instead directly use the apiurl (== <protocol>://<host>) for everything
* some other minor cleanups here and there
* everyone who has a scheme or apisrv entry in his ~/.oscrc will get a deprecation warning but it's still working (at some point in the future we might remove these code paths)
* when writing a new ~/.oscrc store the apiurl in the conffile [fixes#478054]
- while being at it:
* fixed#478054 ("osc asks for build.o.o credential even if -A<somelocalapi> is always used")
* fixed#478052 ("osc backtrace on password entry (first startup)")
- osc diff -rX:Y: the default is to return an unified diff (to get a pretty diff use the --pretty option)
- osc rdiff: the default is to return a pretty diff (to get an unified diff use the --unified option)
- osc sr show --diff: the default is to return a pretty diff (to get an unified diff use the --unified option)
- core.get_binarylist(): add "verbose" switch that returns instances of class
File, instead of filenames
- improve core.get_binary_file():
* clean up tempfiles,
* set mtime,
* set file mask
Function signature is changed, because I'm not aware of any user than the example
script I once published on http://en.opensuse.org/Build_Service/osc_plugins
- do_addremove():
* if "do_package_tracking" is enabled scan the project dir for new/disappeared packages
* added --recursive option (If CWD is a project dir then scan all package dirs as well)
* minor pathname fix
- fixed argument handling in some methods: don't remove items from a list while looping over it
now 'osc submitrequest create' checks if you already submitted requests for this package, if so it'll ask you if the previous submissions should be revoked
OscConfigParser() behaves like a normal ConfigParser() object. The
only differences is that it preserves the order+format of configuration entries
and that it stores comments.
In order to keep the order and the format it makes use of the ConfigLineOrder()
class.
- removed .netrc cruft from the conf module
- other config cleanups
circumstances -- when there is a working copy, and the package is a source
link, osc will figure out what's needed.
- don't stop submitrequests on packages that have a devel project defined, if
the submit comes from that project.
- osc checkout: checkout of source links is now done in expanded form per
default. --unexpand-link can be used to get the raw link file (and patches).
https://forgesvn1.novell.com/svn/opensuse/branches/buildservice/osc-exception-handling
........
r3774 | poeml | 2008-04-22 17:39:45 +0200 (Tue, 22 Apr 2008) | 3 lines
A first draft on implement systematic exception handling:
Add errors.py with some exceptions defined, and babysitter.py to handle them
........
r3775 | poeml | 2008-04-22 22:34:12 +0200 (Tue, 22 Apr 2008) | 9 lines
- new global options:
--debugger jump into the debugger before executing anything
--post-mortem jump into the debugger in case of errors
-t, --traceback print call trace in case of errors
- traceback and post_mortem can also be set in .oscrc.
- catch more errors (HTTPError).
- make config accessible from outside of the Osc instance, by making it a class
attribute
........
r3779 | poeml | 2008-04-23 00:55:49 +0200 (Wed, 23 Apr 2008) | 5 lines
- new global option:
-d, --debug print info useful for debugging
- catch some more errors (HTTPError), with OscHTTPError which isn't very
advanced yet.
........
r3781 | Marcus_H | 2008-04-23 01:02:00 +0200 (Wed, 23 Apr 2008) | 2 lines
- added OscConfigError class (just for testing).
- small change in the signature of the OscBaseError constructor (actually we should get rid of the 'args' tuple because it will be deprecated sooner or later
........
r3782 | Marcus_H | 2008-04-23 02:02:13 +0200 (Wed, 23 Apr 2008) | 2 lines
- access the prg.conf.config dict in a save way - this way we avoid AttributeErrors if the prg.conf.config dict doesn't exist
- in case of an configparser error we have to use the prg.options object directly (this was removed in r3781 by accident)
........
r3787 | poeml | 2008-04-23 09:23:56 +0200 (Wed, 23 Apr 2008) | 4 lines
- remove local exception handling from do_req
- for HTTPError, print details (headers and response) when in debug mode
- catch AttributeError
........
r3789 | poeml | 2008-04-23 16:23:14 +0200 (Wed, 23 Apr 2008) | 4 lines
- errors: add two new classes named OscWrongOptionsError and OscWrongArgsError
- commandline: raise instances of the new errors in a number of places
- commandline: add get_cmd_help() to Osc instance which returns the formatted help of a subcommand
........
r3790 | Marcus_H | 2008-04-23 16:48:28 +0200 (Wed, 23 Apr 2008) | 4 lines
- added 2 new exception classes: OscNoConfigfileError and OscIOError
- added new method write_config() to the conf.py module: This method writes osc's configuration file
- minor cleanups in the conf module
........
r3791 | poeml | 2008-04-23 17:11:07 +0200 (Wed, 23 Apr 2008) | 3 lines
small compatibility fix for r3790: try-except-finally isn't supported in
python-2.4.2, thus do the same as try-except inside a try-finally.
........
r3792 | poeml | 2008-04-23 17:37:53 +0200 (Wed, 23 Apr 2008) | 2 lines
fix up the remaining places regarding handling of errors related to commandline parsing
........
r3793 | poeml | 2008-04-23 17:40:34 +0200 (Wed, 23 Apr 2008) | 3 lines
raise a NoWorkingCopyError in osc.core.store_read_project() in case of an
IOError
........
r3798 | Marcus_H | 2008-04-23 23:55:24 +0200 (Wed, 23 Apr 2008) | 1 line
ported -r3797 from trunk
........
r3802 | Marcus_H | 2008-04-24 11:00:55 +0200 (Thu, 24 Apr 2008) | 1 line
ported -r3801 from trunk
........
r3805 | poeml | 2008-04-24 12:52:30 +0200 (Thu, 24 Apr 2008) | 2 lines
raise OscHTTPError in show_pattern_meta(), replacing local error handling
........
r3817 | poeml | 2008-04-24 20:21:32 +0200 (Thu, 24 Apr 2008) | 9 lines
- remove errors.OscHTTPError again.
it seems simpler to use urllib2.HTTPError instead (and just add a specific
error text message where appropriate, and re-raise)
- for 404s, check out _which_ part was not found
it is very ugly, but may be considered Good for pragmatic reasons
- removed local exception handling and workaround for returned 500's from
delete_package() and delete_project(), thereby getting rid of 4 possible exit
points.
........
r3818 | Marcus_H | 2008-04-24 22:36:17 +0200 (Thu, 24 Apr 2008) | 1 line
- this check is superfluous because every HTTPError instance has a code attribute
........
r3819 | poeml | 2008-04-25 00:39:39 +0200 (Fri, 25 Apr 2008) | 1 line
remove a forgotten debug line from core.delete_project()
........
r3820 | poeml | 2008-04-25 10:07:58 +0200 (Fri, 25 Apr 2008) | 2 lines
- ditch local error handling from wipebinaries(), rebuild(), and abortbuild()
........
r3821 | poeml | 2008-04-25 10:56:38 +0200 (Fri, 25 Apr 2008) | 2 lines
It is never needed to import the exception module.
........
r3822 | poeml | 2008-04-25 11:13:39 +0200 (Fri, 25 Apr 2008) | 4 lines
- when going into the debugger with --post-mortem, always print a traceback before
(thus implying -t)
- do not jump into the debugger if not on a TTY, or working in interactive mode
........
r3827 | poeml | 2008-04-25 13:07:46 +0200 (Fri, 25 Apr 2008) | 9 lines
- add errors.OscWorkingCopyOutdated, which takes a tuple with three args:
path to working copy, current rev, expected rev
- add handler for urllib2.URLError errors to the babysitter
- simplify the OscWrongArgsError and OscWrongOptionsError handlers, by removing
the extra line "Sorry, wrong ..." that was printed before the messages given
when the error was raised.
- remove one more errors.OscHTTPError which was still there, and raise
urllib2.HTTPError instead (show_package_meta())
........
r3829 | poeml | 2008-04-25 14:19:10 +0200 (Fri, 25 Apr 2008) | 11 lines
- comment some methods in osc.core which are used by nearly all do_* methods in
osc.commandline
- improve "is not a package/project dir" error messages, by printing the
absolute path tried, instead of '.' for the cwd
- make core.store_read_package() raise a proper NoWorkingCopyError instead of
terminating
- give attribution to things in babysitter.py copied from mercurial
- prefix HTTPError exceptions with 'Server returned an error:'
- remove obsolete local error handling from do_prjresults(), do_importsrcpkg(),
do_repos()
........
r3830 | poeml | 2008-04-25 14:29:35 +0200 (Fri, 25 Apr 2008) | 1 line
catch IOError exceptions in the babysitter
........
r3837 | poeml | 2008-04-25 17:27:36 +0200 (Fri, 25 Apr 2008) | 5 lines
- do_remotebuildlog: raise errors for wrong arguments, remove exits
- raise AttributeError in make_meta_url() instead of exiting
- delete unused method core.delete_server_files()
- replace exit call inside make_meta_url() with an AttributeError
........
r3838 | poeml | 2008-04-25 17:49:18 +0200 (Fri, 25 Apr 2008) | 1 line
simplify the check in do_checkout if a project exists, by using show_project_meta() instead of meta_exists
........
r3839 | poeml | 2008-04-25 18:31:26 +0200 (Fri, 25 Apr 2008) | 6 lines
- commandline do_checkout(): change the order of the two checks, first do the
(cheaper) check for existing directory
- core.core checkout_package(): simplify the check in if the package
exists, by using show_package_meta() instead of meta_exists
Let it throw an exception, instead of using sys.exit().
........
r3841 | Marcus_H | 2008-04-27 15:48:06 +0200 (Sun, 27 Apr 2008) | 5 lines
- added 2 new exception classes: PackageError() and PackageExistsError. The PackageError() class is meant to be the base class for all subsequent package exceptions.
- get rid of 2 sys.exit(1) calls
- make the update() method of the Project() class safer: in any case we have to write the _packages file otherwise the package tracking will be screwed up.
- minor fix in delPackage(): use getTransActPath() when printing out the filename
........
r3842 | Marcus_H | 2008-04-27 16:52:55 +0200 (Sun, 27 Apr 2008) | 3 lines
- make the commit() method safe: in any case we have to write the _packages file otherwise the package tracking will be screwed up.
- removed another sys.exit(1): raise an exception if a package is missing when doing a commit. For now we use the PackageExistsError() exception but this might change in the future (updated description of PackageExistsError() according to this change)
........
r3848 | poeml | 2008-04-28 12:46:45 +0200 (Mon, 28 Apr 2008) | 3 lines
rename several error classes, dropping the "Osc" prefix, and "Error" suffix in
cases where they don't really make sense.
........
r3849 | poeml | 2008-04-28 12:57:32 +0200 (Mon, 28 Apr 2008) | 3 lines
- rename osc.errors module to osc.oscerr, to make it easier to import it from
other programs and have a crystal clear namespace
........
r3850 | poeml | 2008-04-28 13:26:12 +0200 (Mon, 28 Apr 2008) | 2 lines
split PackageExists exception class into PackageExists and PackageMissing
........
the BUILD_DIST environment variable will be ignored by osc
- the following environment variables can still be used:
# OSC_SU_WRAPPER overrides the setting of su-wrapper.
# OSC_BUILD_ROOT overrides the setting of build-root.
# OSC_PACKAGECACHEDIR overrides the setting of packagecachedir.
(now they're documented in the helptext)
* make_dir() and checkout_package() got a new optionally 'prj_dir' parameter. This parameter specifies in which dir we want to create new project/package dirs.
Add support for handling linked packages in expanded form. They can be checked
out, updated (expanding or unexpanding them), and built locally.
Missing: commit support.
Newly introduced options are:
- osc checkout: --expand-link
- osc update: --expand-link and --unexpand-link
Other changes:
- osc core: add show_upstream_xsrcmd5() method which returns the xsrcmd5 (if a
linkinfo element exists only, of course)
- made updating of expanded sources work with package tracking, too.
* createPackageDir(): create and initialize a new package dir in
the given project.
* get_apiurl_usr(): returns the username for a certain apiurl
* get_configParser(): returns an ConfigParser() object which can be
used for parsing the ~/.oscrc file
- fixed username issues when creating a new package (the problem was
that the username for the default host was used and not the one for
that specific apiurl)
- some small fixes in the do_importsrcpkg() method
- when requesting a submit, save the source package's revision id (looking up
what it currently is)
- give the user a way to override it, to submit an older revision
- when using show --diff, take the actual old revision into account. Thus, the
diff is against the source revision of the time of request creation.
- rename 'refuse' -> 'decline', which is more polite.
- show: make the diff optional
- add RequestState class
- handle state history
- implement 'decline' action
meta_exists, make_meta_url, checkRevision
if no apiurl parameter is specified the global value (conf.config['apiurl'])
will be used. This should fix bug #361764
- some small apiurl fixes in the make_diff method (the package_tracking branch already has this fix)
* --local-package: use this option if you're trying to build a
package which doesn't exist on the server
* --alternative-project <project>: use this option to specify an
alternative project if the current project doesn't exist on the
server, e.g.: osc build [OPTS] --alternative-project openSUSE:10.3 standard i586 BUILD_DESCR
- some other minor cleanups in build.py
- get_repos_of_project() is now a generator function
(you don't have to checkout the package to view the buildlog)
- renamed "get_log()" to "get_buildlog" to avoid any confusion with
"get_commitlog()"
- added new method "print_buildlog()" which prints out the buildlog on the
standard output
* some new things like showing newly added files
* moved the whole code into a new methode (make_diff())
* behave more like svn when doing a diff against a certain revision
- changed the storedir attribut of the Package() class to an absolute
filename - normally this shouldn't have any impact on existing methods, functionality etc.
get_config(override_conffile = None,
override_http_debug = None,
override_apisrv = None)
Thus, it should be possible to use the osc module with one simple
conf.get_config() call. It is no longer required to set up the api url in the
config dict, and call conf.init_basicauth().
* by default the new files will be comitted
(if it is a new package or if there are no
source files on the server)
* added --disable-commit option switch to
import the package only locally
* added --delete-old-files option switch to
delete old files from the server.
- some changes in the Package class:
* extended existing commit() method to do
all the commit work (before it was done
in the do_commit() method).
* moved stuff from the constructor into a
new method (update_datastructs()).
* now a package can be imported from a
src.rpm
* thanks to Peter for his is_rpm() and is_srcrpm()
methods
- split out some methods into smaller ones (so they
can be reused for other tasks)
- added some new methods for unpacking a src.rpm
- changed read_meta_from_spec() method to be more
flexible (it is possible to specify the tags and
sections).