1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00
Commit Graph

3564 Commits

Author SHA1 Message Date
Marcus Huewe
9b2cbfead0 Merge branch 'fix_osc_api_without_arguments' of https://github.com/lethliel/osc
Fix handling of incorrect CLI arguments (python3).
2020-05-18 20:05:25 +02:00
lethliel
69b1233316 add regex for python3 missing arguments err
add new regex and check for missing arguments.
The error message in python3 differs from the one in python2.

python3:
do_api() missing 1 required positional argument: 'url'

python2:
do_api() takes exactly 4 arguments (3 given)

To be compatible with python2 two checks are needed.
2020-05-18 19:46:22 +02:00
Marco Strigl
2b26419e6d
Merge pull request #791 from adrianschroeter/shell_cmd
complete --shell-cmd support
2020-05-12 13:19:14 +02:00
12e0b67117 complete --shell-cmd support parts to get it working 2020-05-12 13:16:29 +02:00
Marcus Huewe
1d056c01ea Merge branch 'fix_git_detectoin' of https://github.com/adrianschroeter/osc
Fix heuristic to detect a git url. It does not have to necessarily end
with ".git" and can start with git:// or git@.
2020-05-05 12:22:34 +02:00
5d6351b1bd Support git@ (private github) or git:// URLs correctly 2020-05-05 10:54:43 +02:00
Marco Strigl
9aa3777a60
Merge pull request #788 from lethliel/documentation
improve documenation
2020-04-30 09:00:36 +02:00
lethliel
26b2fea6d2 improve documenation
removed tutorial. Added missing osc.util.helper

added more modules:

* OscConfigParser
* build
* conf
* credentials
2020-04-29 20:13:48 +02:00
Marcus Huewe
582ac00483 Merge branch 'quote_arch_on_bl' of https://github.com/lethliel/osc
Callers of core.print_buildlog should properly quote the project, package,
repo, and arch parameters. Actually, doing this at the caller's level
is pretty insane but this way, we do not break the existing API (of
core.print_buildlog).
In the future, we should move all the quoting logic into core.makeurl
(even if this breaks the API).
2020-04-28 15:59:29 +02:00
lethliel
9a3fda8471 quote prj, repository, arch and package
quote the arguments before creating the apiurl.
This prevents weird behaviour when any has an '#'
at the end.
2020-04-28 14:47:40 +02:00
Marco Strigl
e98728d394
Merge pull request #657 from lethliel/better_errmsg_oscci_editor_not_present
Better errmsg oscci editor not presentosc ci improve error message on fail
2020-04-20 21:02:29 +02:00
Marcus Huewe
c156815d5e Merge branch '776-ccache' of https://github.com/Firstyear/osc
Add ccache option to the oscrc (default: disabled). If enabled, the
--ccache option is always passed to the build script (if invoked via
osc.build.main).
2020-04-15 13:29:33 +02:00
William Brown
bdb0c8033c Add ccache argument for oscrc 2020-04-14 14:50:24 +10:00
Marcus Huewe
01d235d998 Merge branch 'travis' of https://github.com/crazyscientist/osc
Improve deployment via travis. Unfortunately, style + semantics changes
are in a single commit... but let's not be too picky. See also the
discussion in  [1].

[1] https://github.com/openSUSE/osc/pull/739
2020-04-10 20:04:17 +02:00
Andreas Hasenkopf
f817db1053 Automatic package publication via Travis CI
* `.travis.yml`
  - Reformatted for easier reading
  - Used `before_*` statements instead of script chains
  - Publish only source packages
* `setup.py`
  - Reformatted for easier reading
  - Use README contents for `long_description` to have a nice description on PyPI
  - Added classifiers
  - Added explicit package dependencies
* fixes #658
* fixes #708
2020-04-06 09:32:01 +02:00
Marcus Huewe
07d422063b Merge branch 'fix_HTTPError_reason' of https://github.com/lethliel/osc
Fix str formatting in build.get_preinstall_image.
2020-04-01 13:29:25 +02:00
lethliel
81acc39c9f e.reason is a string not a integer decimal 2020-04-01 12:48:12 +02:00
Marcus Huewe
894f1c281a Merge branch 'packagequery_bytes_fixes' of https://github.com/marcus-h/osc
bytes fixes/cleanups in the packagequery and repodata modules.
2020-03-25 19:39:11 +01:00
lethliel
b99c4486e8 update news and open new development milestone 2020-03-23 13:50:01 +01:00
Marco Strigl
81d221242b
Merge pull request #767 from Vogtinator/completion
Completion usability improvements
2020-03-23 13:36:31 +01:00
Marco Strigl
93a5a4d353
Merge pull request #736 from lethliel/improve_bash_completion
improve speed of bash completion
2020-03-23 13:36:14 +01:00
Marcus Huewe
55aef1a014 Convert repodata.RepoDataQueryResult to a bytes API
The repodata.RepoDataQueryResult is supposed to be a bytes API and
that's what our users (see build module) expect.
Note that the repodata.RepoDataQueryResult.path method still returns
a str. That's what the rpmquery.RpmQuery, debquery.DebQuery, and
archquery.ArchQuery classes also do (if the "path" was initially
passed as a str).

Fixes: #760 ("osc build fails when called with --prefer-pkgs where the
       passed directory is a repodata repository or a subdirectory of one")
2020-03-15 18:30:28 +01:00
Marcus Huewe
cd51f47a77 Return bytes in packagequery.PackageQueryResult.evr() instead of a str
The packagequery.PackageQueryResult class is supposed to provide a
bytes API. Hence, packagequery.PackageQueryResult.evr() should return
bytes instead of a str. Also, adjust the single caller in the build
module.
2020-03-15 18:30:00 +01:00
Fabian Vogt
ee44164bf1 Discard stderr of the completion script
Otherwise it pollutes the terminal with warnings and errors such as
"interrupted!", which makes the terminal line unusable.
2020-03-13 15:36:08 +01:00
Fabian Vogt
e11b49e2f1 Fetch list of all projects lazily
Currently osc <TAB><TAB> takes a long time to complete, which is incredibly
annoying. Only run "osc ls" if it is necessary for proper completion.
2020-03-13 15:32:29 +01:00
lethliel
3914b8c5e8 release 0.168.2 2020-03-13 07:44:34 +01:00
Marcus Huewe
33bbc57b5f Fix the previously introduced escaping via the html module
This is a follow-up commit for commit
6dbf103e10 ("Use html.escape instead
removed cgi.escape"), which breaks the python2 backward compatibility
(since the "html" module is not available by default) and also breaks
the code in general (due to missing html imports).

The fix is based on the proposed fix in [1].

Fixes: boo#1166537 ("osc rq accept - forwarding request causes backtrace")

[1] https://github.com/openSUSE/osc/pull/764
2020-03-12 23:00:47 +01:00
9b01f59fee
Merge pull request #763 from mimi1vx/patch-3
Use html.escape instead removed cgi.escape
2020-03-11 17:10:42 +01:00
6dbf103e10
Use html.escape instead removed cgi.escape
Fixes:

`Traceback (most recent call last):
  File "/usr/bin/osc", line 41, in <module>
    r = babysitter.run(osccli)
  File "/usr/lib/python3.8/site-packages/osc/babysitter.py", line 64, in run
    return prg.main(argv)
  File "/usr/lib/python3.8/site-packages/osc/cmdln.py", line 344, in main
    return self.cmd(args)
  File "/usr/lib/python3.8/site-packages/osc/cmdln.py", line 367, in cmd
    retval = self.onecmd(argv)
  File "/usr/lib/python3.8/site-packages/osc/cmdln.py", line 501, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/usr/lib/python3.8/site-packages/osc/cmdln.py", line 1232, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/usr/lib/python3.8/site-packages/osc/commandline.py", line 1458, in do_submitrequest
    result = create_submit_request(apiurl,
  File "/usr/lib/python3.8/site-packages/osc/core.py", line 4244, in create_submit_request
    cgi.escape(message))
AttributeError: module 'cgi' has no attribute 'escape'
`
`cgi.escape` was deprecated in python 3.2
2020-03-11 16:58:04 +01:00
lethliel
49c1e9e8ff command substitution should be done by compgen
which is much faster.

builtin compgen -W "${list[*]}" -- "${cur}" | sed -r "s@^${colon_word}@@g"
--> 1 minute 20 seconds

builtin compgen -W 'cat ${projects}' -- "${cur}" | sed -r "s@^${colon_word}@@g"
--> 4 seconds
2020-03-08 20:29:06 +01:00
lethliel
a8641a47c8 release 0.168.0 2020-03-04 10:21:17 +01:00
lethliel
67e251cb2b add recent changes to NEWS file 2020-03-03 10:42:32 +01:00
Marcus Huewe
eb88abc138 Merge branch 'patch-1' of https://github.com/rindeal/osc
Improve keyring installation hint if no keyring module is present. Now,
it suggests to install "python<major version>-keyring" instead of
"python-keyring".
2020-03-01 18:03:19 +01:00
Jan Chren
fa205be798
Suggest correct python-keyring package version
On Tumbleweed, `zypper in python-keyring` installs python2 version, while `osc` runs on python3.
After this change, user will be pointed to the correct version.
2020-02-29 00:28:20 +00:00
Marcus Huewe
c3e7428631 Merge branch 'master' of https://github.com/matthewdva/osc
Fix "osc importsrcpkg --name <name>". Do not try to decode a str.
2020-02-26 21:46:42 +01:00
Marcus Huewe
4e8e0492e8 Fix arch zst magic in util.packagequery
The correct zst magic is b'(\xb5/\xfd' (4 bytes) (that's what obs-build
is also using).

Kudos to Tobias Ellinghaus for spotting this.

Fixes: #756 ("zst detection fails")
2020-02-26 20:04:26 +01:00
Matthew D
9ba0d8adcd Fix -n / --name flag on importsrcpkg command.
osc importsrcpkg -n <pacname> does not work.  If the option is supplied, osc
mistakenly trys to "decode" the pac object.  This patch limit the decode
call when pac is not a string.

Refactored fix based on suggestions from marcus-h
2020-02-24 00:23:14 -05:00
Marcus Huewe
e89c49861b Merge branch 'drop_old_code' of https://github.com/dcermak/osc
Get rid of python < 2.6 cruft.
2020-02-23 19:06:11 +01:00
175bcb4613
Remove compat code for Python < 2.6 2020-02-21 15:09:58 +01:00
Marcus Huewe
20f2f40614 Merge branch 'fix_748' of https://github.com/lethliel/osc
Add missing oscerr import in util.helper. Oops.
2020-02-20 09:10:57 +01:00
lethliel
95c68dc3f0 import oscerr in helper.py 2020-02-20 08:45:02 +01:00
Marcus Huewe
80c9b6e3df Merge branch 'm2crypto_exceptions' of https://github.com/nickbroon/osc
The babysitter module sets SSLError and SSLVerificationError to None, if
m2crypto is, for instance, missing. This works in python2 but breaks in
python3. Hence, both should be classes that inherit from Exception.
2020-02-18 19:41:18 +01:00
Nicholas Brown
75ba922eb2 custom exception if importing m2crypto fails
fixes #743
2020-02-18 17:35:29 +00:00
Marcus Huewe
5185026084 Merge branch 'fix_name_display' of https://github.com/lethliel/osc
Old keyring versions of the KeyringBackend class have no name method (the
name method was added in 2016). In this case, the class name is used as the
backend name.
2020-02-14 09:52:20 +01:00
lethliel
6a20fd8bf5 fix list of backends for old python-keyring
old python-keyring classes have no name method.
This is used instead:

return self._keyring_backend.__class__.__name__
2020-02-14 09:35:07 +01:00
Marcus Huewe
9b0dcf3535 Merge branch 'master' of https://github.com/sbahling/osc
Use configparser.ConfigParser instead of configparser.SafeConfigParser,
since the latter will be removed in future python versions. No functional
changes because SafeConfigParser is a ConfigParser except that its __init__
prints a DeprecationWarning.
2020-02-09 15:57:49 +01:00
Scott Bahling
b9adde96b6 Rename SafeConfigParser to ConfigParser
configparser.SafeConfigParser has been changed to configparser.ConfigParser
upstream in Python 3.2. Warnings are saying that the alias will be
removed in future versions.

Signed-off-by: Scott Bahling <sbahling@suse.com>
2020-02-07 12:04:49 +01:00
Marcus Huewe
32859d6803 Merge branch 'handle-string-conversion' of https://github.com/krig/osc
Add core.parse_meta_to_string helper to work around the insane
implementation of core.meta_exists. Since core.meta_exists may return
a list of bytes, a str, a list of str etc., we ultimately convert the
data to str before passing it ET.fromstring(...).

In case of bytes, the explicit decoding is OK because it is assumed to
be a valid utf-8 encoding (the data represents an xml).

Note: at the moment core.parse_meta_to_string is also called even if it
is not necessary (it is only necessary if the "create" parameter of a
corresponding core.meta_exists call is True).

Note 2: this is just a temporary workaround and, eventually, we will make
the implementation of core.meta_exists more reasonable. When doing so,
we will also remove "public" function core.parse_meta_to_string again.
(Yes, this breaks API but the core.meta_exists change will also break the
API in some sense - so that's OK.)
2020-02-07 10:27:10 +01:00
Marcus Huewe
fb9e64c2f1 Merge branch 'handle_empty_releas_in_rpmquery' of https://github.com/lethliel/osc
Do not pass None as a release to RpmQuery.filename. The release might
be None in case of a kiwi build (the returned canonname is not used in
case of kiwi build).
2020-02-07 10:23:35 +01:00
Kristoffer Grönlund
16a3fcfabf Handle bytes vs. str error when parsing meta (#683)
In all the cases where meta_exists returns either
string data, bytes data or a list, the output needs
to be parsed correctly.

Signed-off-by: Kristoffer Grönlund <kgronlund@suse.com>
2020-02-07 10:02:27 +01:00