1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 17:26:15 +02:00
Commit Graph

28 Commits

Author SHA1 Message Date
Marcus Hüwe
12ff5ac124 - some cleanups/changes for the config handling:
* extra-pkgs and urllist settings can be separated by a comma and/or whitespace:
    'extra-pkgs: foo, bar xyz'
  * 'True', 'False' etc. are accepted values for boolean options
2008-07-18 12:08:03 +00:00
Dr. Peter Poeml
cdab0b19ea - osc build: make the --extra-pkgs option configurable via .oscrc.
Default is "extra-pkgs = vim gdb strace" -- and it can be overridden with -x ''
  on the commandline, or set to empty in the config.  [bnc#345142]
- make tilde expansion work on the packagecachedir setting
2008-07-12 12:06:23 +00:00
Dr. Peter Poeml
3018460596 Merged revisions 3774-3775,3779,3781-3782,3787,3789-3793,3798,3802,3805,3817-3822,3827,3829-3830,3837-3839,3841-3842,3848-3850 via svnmerge from
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
........
2008-04-28 16:37:44 +00:00
Marcus Hüwe
a4f4488a50 - fixed KeyError when printing the new_conf_template 2008-04-22 22:43:00 +00:00
Marcus Hüwe
303e5dcffc - all necessary auth-information are available in the 'auth_dict' (so there's no need to fool around with the ConfigParser...) 2008-03-18 13:51:57 +00:00
Marcus Hüwe
5d57d7e299 - added 3 new methods:
* 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
2008-03-15 22:51:37 +00:00
Dr. Peter Poeml
e8899aa165 if there are no credentials for the apisrv in use (which may be specified with
-A on the commandline), don't try to set up config['user'] with credentials.
2008-03-13 16:15:41 +00:00
Dr. Peter Poeml
c0fabfc449 merged the package-tracking branch changes r2404:3491 into the trunk. 2008-03-10 18:04:23 +00:00
Dr. Peter Poeml
a3a2667742 - change conf.get_config() to take three optional override values:
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().
2007-08-22 10:18:25 +00:00
Dr. Peter Poeml
106645a87b allow to specify a different config file via the environmental variable OSC_CONFIG 2007-08-22 08:30:53 +00:00
Dr. Peter Poeml
cdf91d7f39 commit: use the documented commit method by default now 2007-08-14 10:30:39 +00:00
Dr. Peter Poeml
a5b0a50d28 https_proxy is not supported by urllib2. It only leads to an error or, at best,
a warning. Thus, unset https_proxy and HTTPS_PROXY in the environment, so
urllib2 doesn't trip over it.
https://bugzilla.novell.com/show_bug.cgi?id=214983
https://bugzilla.novell.com/show_bug.cgi?id=298378
2007-08-08 13:24:52 +00:00
Dr. Peter Poeml
30b82a050e expand tilde to users home for packagecachedir in .oscrc [#293675] 2007-07-24 10:46:03 +00:00
Dr. Peter Poeml
9921fcac8e Switch from software.opensuse.org to download.opensuse.org as default
download URL
2007-07-16 09:45:17 +00:00
Dr. Peter Poeml
0d9278229c - don't need config['pass'] anymore
- but set config['user'], which was unset since the recent changes in auth handling
2007-05-10 14:29:04 +00:00
Dr. Peter Poeml
4e39519efb use new API route for downloading binaries also in configured URLs 2007-05-07 20:14:20 +00:00
Dr. Peter Poeml
354c01be55 - build: fix passing of commandline options and arguments to build.main(),
which was still using sys.argv
- build: use own api server as upstream URL in urllist. So far,
  api.opensuse.org was hardcoded in the download URL [#265211].
2007-04-25 11:22:40 +00:00
Dr. Peter Poeml
b58b6e5a3f - fully implement accessing multiple API servers. "apisrv" in the config takes
a URL now, so the variable "scheme" which was needed in addition before
  becomes obsolete. For backward compatibility, a hostname (and scheme
  variable) are still accepted. Likewise, the auth sections in the config take
  a URL now, and a hostname:port to keep old config working.
  Furthermore, apisrv can be overridden by -A on the commandline. HTTP or HTTPS
  scheme is determined from the URL. Credentials must be configured in .oscrc.
2007-04-25 10:24:51 +00:00
Dr. Peter Poeml
36e4cc3140 initialize the auth handler with all configured credentials, so it is now
possible to use osc with different api servers by overriding apisrv on the
command line
2007-04-25 08:56:31 +00:00
Dr. Peter Poeml
2f5b52e92c Complete rewrite of the internal commandline handling, using cmdln.py.
Bump version to 0.95.

New features:
- implement "rebuild all failed packages", via --failed option in rebuildpac
  subcommand (new api route)
- status -v shows all files, including unmodified ones
- suppress the legend in prjresults by default (show with -l)
- add global options to override config
- can use arbitrary api server via global -A option
- -H enables HTTP traffic debugging
- --version

Bugfixes:
- fix typo in delete_project() (the line building up the URL got lost)
- fix the commit subcommand's arguments. This works correctly now: 
    osc ci ../test/onlyinwc `pwd` fstab ../test/f2 
- fix buildinfo subcommand, if no specfile is posted. Broke with the recent URL
  handling rewrite, but didn't seem to bother because the build subcommand
  always sends the specfile.
- try to fix buildhistory route, but it might be gone actually (need to pursue)
- add --clean/--noinit to osc build help output
2007-04-24 23:00:12 +00:00
Dr. Peter Poeml
56f9752b8c save and reuse HTTP server cookies, speeding HTTP requests up about 5 times (in
our iChain setup anyway...)
2007-04-19 10:40:18 +00:00
Dr. Peter Poeml
c993a04c7c Rewrite the HTTP handling
- adding http_GET/POST/PUT/DELETE() functions, which dispatch to
   http_request(), and use them everywhere
 - removing othermethods.py 
 - keeping urlopen(), in case it is used from externally, but have it print out
   a "depracated" message
 - finally, implementing a global HTTP debug mode
2007-04-19 08:47:22 +00:00
Dr. Peter Poeml
1ecbbf9f23 further the osc buildroot configuration example 2007-04-18 00:26:14 +00:00
Dr. Peter Poeml
a12c8e9b82 merge from Susannes branch (/branches/froh/reponator/)
* I extended the comments in the template with findings I had to dig
    through (how to switch the protocol and how to specify the port)
2007-01-12 03:53:44 +00:00
Dr. Peter Poeml
a94364d95b correct last fix: set scheme in DEFAULTS not in the comment. 2006-10-13 09:19:28 +00:00
Dr. Peter Poeml
4f61fc4bb0 set scheme=https in the default conf; add missing import sys in othermethods.py 2006-10-13 06:37:16 +00:00
Dr. Peter Poeml
baafea955b - add 'edituser' command for editing the metadata of a user account. It tries
to create a user if it doesn't exist yet. A new command 'usermeta' replaces
  'id' respectively 'userid'.
- add preliminary support for doing uploads with a subsequent "commit" request
  (not switched on now, since I want to do more testing on this, and there is
  no way to pass on a commit message yet anyway.)
- add runtime check for build.rpm version, so the rpm package dependencies is
  no longer required
- fix typo introduced last time in the editmeta, deletepac, deleteprj commands
- rewrite the PUT and DELETE request methods to 
  - transparently handle HTTPS 
  - handle path parameters (for commits)
  - send user agent
- rename get_user_id() function to get_user_meta()
- change copyright notice from Peter Poeml to Peter Poeml / Novell Inc.
- fix testsuite
- add CREDITS file
2006-10-12 13:22:56 +00:00
Dr. Peter Poeml
39779ec9bc - rewrite configuration handling
- move all configuration code into module osc/conf.py
  - now, the API server can be configured in .oscrc with
    apisrv = ...
  - also, 'scheme' (http/https) is no longer a module variable but can be
    configured
  - all config is in DEFAULT
- ignore vim swap files
- use urllib() convenience wrapper in some functions that used
  urllib2.urlopen() and had their own error handling. Instead, it seems to make
  sense -- in the future-- to create our own errors and propagate them up, in
  cases where the error handling of urlopen() is too generic
- rename get_slash_source() to meta_get_project_list() for consistency
- show local time in get_buildhistory(), not UTC
- rewrite help text of 'rebuildpac' command
- allow to run commandline.py from the commandline (without the wrapper)
- don't send a space when doing a POST request without body
2006-10-10 14:04:34 +00:00