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

3169 Commits

Author SHA1 Message Date
lethliel
c32ec4bc1c appent opts.file to args not cmd_list
prepend to args instead to cmd_list. Otherwise the
changes file will be written into the given --file

osc vc --file=proposed.changes package.changes
2019-11-13 09:50:05 +01:00
Marco Strigl
f78057e2d5
Merge pull request #641 from mcepl/337_check_for_request_on_action_1
Make check_for_request_on_action on per default.
2019-11-05 16:03:59 +01:00
Marcus Huewe
8bb96776a8 Merge branch 'fix_decoding_linkpac' of https://github.com/lethliel/osc
Fix link_pac (meta_exists returns a list of bytes (if create_new is False)).
2019-11-04 15:11:57 +01:00
lethliel
02207d719c fix decoding for osc linkpac
in def link_pac dst_meta is a list of bytes-like objects.
so b''.join(dst_meta) is needed
2019-11-04 15:00:59 +01:00
Marcus Huewe
f9b1fa18ad Move passx handling into ObfuscatedConfigFileCredentialsManager
Minor cleanup for commit c5231d61dd
("fix credentials with passx entries").
2019-11-04 14:25:48 +01:00
Andreas Schwab
5227e357bc Don't enforce password reuse 2019-11-03 13:43:22 +01:00
lethliel
992255b0df release 0.166.1 2019-10-29 11:15:35 +01:00
lethliel
c5231d61dd fix credentials with passx entries
Existing passx enries resulted in a stacktrace because
the cp.get() call for the passx entries was missing.

Also added a delete_password function for ObfuscatedPasswordManager
to delete passx entries
2019-10-29 11:04:22 +01:00
lethliel
64a5969ca8 release 0.166.0 2019-10-24 11:48:35 +02:00
lethliel
2f02db1621 Merge branch 'master' of github.com:openSUSE/osc 2019-10-24 11:44:42 +02:00
Marco Strigl
aa50dca4eb
Merge pull request #650 from lethliel/fallback_if_keyring_not_present
catch configured keyring without module installed
2019-10-24 11:29:26 +02:00
lethliel
5fa1e73db6 catch configured keyring without module installed
If a python-keyring based backend is configured, but
python-keyring is not installed osc fails without giving
the user the opportunity to continue.

This introduces a new class method `create` for the AbstractCredentialsManager.
The CredentialsManagers for the backends that use a 3rd party software can
now check if the software is present in its own create method.
2019-10-24 11:21:23 +02:00
lethliel
af6d0bc652 osc ci improve error message on fail
The error message if the call of _commit is just:
"ERROR: service run failed"

One option why this can fail is that the user Editor in env('EDITOR')
is not present.

We check now if e.msg gives a hint about "not found file" and then
error out with a better error message
2019-10-23 14:12:03 +02:00
lethliel
d59141e3fe fix build with alternative prj and multibuild
building with alternative project (pac='_repository')
and multibuild did not work correctly, because the buildflavor
was not submitted to the src server.

With commit 2390823d649a3b0b6bf3b7bd07713c4426932bed in open-build-service
it is now possible to submit the build flavor like this: _repository:<flavor>

The obs commit also enables osc buildinfo --alternative-prject -M <flavor>
to show the correct buildinfo for the flavor.
2019-10-23 11:46:38 +02:00
Marco Strigl
6f34f2b8d8
Merge pull request #651 from lethliel/implement_incoming_option_for_rq
implement incoming option for osc rq
2019-10-22 13:15:17 +02:00
lethliel
b556095502 implement incoming option for osc rq
There is a config option 'include_request_from_project' which
can be set to 0 to exclude all requests originating from the
project in osc [rq|review] list.

To force this behaviour just once (without always editing oscrc
the '--incoming' option can be used.
2019-10-22 10:20:15 +02:00
Ludwig Nussel
e53d16f5d8 New browse command to quickly open web browser 2019-10-22 09:16:57 +02:00
Marcus Huewe
5611c55bde Merge branch 'fix_buildinfo_with_alternative_project' of https://github.com/lethliel/osc
Make "osc buildinfo --alternative-project <project> ..." consistent with
"osc build --alternative-project <project> ...". This change breaks some
invocations where a build_descr is omitted (but in this case, simply
use "osc buildinfo <project> <package> <repo> <arch>).
2019-10-21 16:16:55 +02:00
Marcus Huewe
3025dbf954 Merge branch 'support_appimage_yml' of https://github.com/adrianschroeter/osc
Support "appimage.yml" in parse_repoarchdescr.
2019-10-21 16:06:29 +02:00
lethliel
333028401e use _repository if alt prj is used
Use _repository as package name if alternative_project is used
2019-10-21 13:29:37 +02:00
e43d0641c6 find appimage.yml files as build description 2019-10-17 08:07:38 +02:00
lethliel
aaa51bcab1 improve help text for osc maintained
The help text does not indicate that only osc mbranch
really creates a branch.

osc maintained and osc sm are just aliases for osc mbranch --dryrun
2019-10-16 14:41:22 +02:00
ea5f8d40aa
Make check_for_request_on_action on per default.
Fixes #337
2019-10-10 18:02:20 +02:00
Marcus Huewe
95d49a0af6 Merge branch 'fix' of https://github.com/adrianschroeter/osc
Only a 404 implies a "meta_change" in link_pac and aggregate_pac.
2019-10-09 14:38:50 +02:00
e2c50fb8c1 be sure that destination is not existing before overwriting content
we used to crash on utf encoding errors, be sure not to replace meta
data in that case
2019-10-09 07:34:20 +02:00
Marcus Huewe
dc60cc2a09 Merge branch 'fix_#637_osc_vc_escape_chars' of https://github.com/lethliel/osc
Pass the filename to the vc script instead of passing its content via
the "-m" parameter. If "osc vc --file <fname>" is issued, it might be
possible that $EDITOR is still opened (if the "vc" script is too old),
which contradicts the --file option's help text. This "break" is acceptable
(just update osc in tandem with the vc script).
2019-09-27 22:35:25 +02:00
lethliel
edc2bde460 Transfer the name of the input file to vc
instead of the content and let vc do the rest.
This prevents calling echo -e and interpreting
escape characters.
2019-09-25 11:36:25 +02:00
Marco Strigl
99d305e969
Merge pull request #643 from lethliel/fix_quoted_output
unquote prj on osc co error message
2019-09-23 11:55:52 +02:00
40c480e9ef
Resurrect merge_cmd variable after it got removed in the past
In case diff3 returns something except 0 or 1, osc errors out because the
variable merge_cmd is not defined. It used to exist, but got removed in the
past and is reintroduced via this commit.
2019-09-20 21:56:35 +02:00
lethliel
e89c7dd12d unquote prj on osc co error message 2019-09-20 09:28:19 +02:00
Marco Strigl
e7e91709ef
Merge pull request #621 from lethliel/fix_#617_regression_in_deleterequest
make now() UTC aware for accept-in-hours
2019-09-18 16:57:56 +02:00
lethliel
ced4ac6506 append '+00:00' to now.isoformat() to satify api
just append '+00:00' so that the api calculates the correct accept time
based on UTC
2019-09-18 16:55:10 +02:00
Marcus Huewe
5756e90b90 Merge branch 'fix_decoding_in_osc_cat' of https://github.com/lethliel/osc
Do not perform any decoding in do_cat.
2019-09-18 16:36:00 +02:00
lethliel
6f674a6289 do not decode diff before passing it to run_pager
run_pager will take care of the bytes-like object and
will directly write it to sys.stdout.buffer.write() or
NamedTemporaryFile.
2019-09-18 11:26:16 +02:00
lethliel
d1d45f4618 fix decoding for osc cat
use sys.stdout.buffer.write() to print encoded data
correctly
2019-09-18 10:49:39 +02:00
Marco Strigl
1e4e7edad5
Merge pull request #446 from lethliel/add_error_for_issue_445
print error and exit if p.apiurl != -A <apiurl> using osc sr
2019-09-17 14:11:20 +02:00
lethliel
4b1e2343d8 fix TypeError with python3.7 configparser
configparser.py in python3.7 does not take None Type.
We override the _validate_value_types method in
OscConfigParser class to disable this check.
2019-09-17 13:35:30 +02:00
5f1109072f fix checkout of meta files
typo leaded to wrong parameter
2019-09-16 14:01:35 +02:00
Marco Strigl
035457cc26
Merge pull request #630 from lethliel/fix_decoding_on_lbl
decode data on osc lbl
2019-09-12 12:27:42 +02:00
lethliel
ee64437521 decode data on osc lbl 2019-09-12 10:41:26 +02:00
Mike Gorse
ef1c605a32 Initialize diff as bytes
Otherwise, python 3 will throw a traceback if the fallback code is
triggered, since it appends bytes.
2019-09-11 10:05:32 -05:00
lethliel
406918469d [python3] decode tmpfile content on edit_message 2019-08-30 11:57:31 +02:00
Marcus Huewe
749f994465 Merge branch 'simplify_sr_on_prj_level' of https://github.com/lethliel/osc
Simplify the project sr handling in do_submitrequest a bit. It also fixes
a bug in case a target project and --separate-request is specified.
Other bugs are retained for now (for instance, --update-link is ignored).
2019-08-30 10:52:52 +02:00
lethliel
3da7b9b3d8 simplify osc sr code in submitting prj
Most of the stuff is now done in the API.
For just submitting all in one request the following is sufficient:

<action type="submit"> <source project="%s" /> %s </action>

If a target project is given it looks like this:

<action type="submit"> <source project="%s" /> <target project="%s"> %s </action>

We don't need package name or source package and targets anymore.
This is all handled by the API now.

For the --seperate-requests case the check for the entries in the linkinfo
is not working on most cases. So we handle this in the do_submitrequest
and skip the package if X-Opensuse-Errorcode is missing_action which means
basically nothing to do for this package

redesign target_project handling
2019-08-30 10:42:08 +02:00
lethliel
74c70620b7 Add project parameter to print_repos
This is needed if the project differs from the current
working copy.

Fixes https://github.com/openSUSE/osc/issues/623
2019-08-30 10:32:02 +02:00
Marcus Huewe
e7397221b3 Add --change-password example to the help text of do_config
This should have been part of commit
cba4b58bbe ("Improve password
handling").
2019-08-29 16:42:09 +02:00
lethliel
3ba02b9cec Refactor user extraction
Implement _extract_user_compat() for gnomekeyring special case.
2019-08-29 16:11:29 +02:00
lethliel
cba4b58bbe Improve password handling
* Adapt do_config to use the new credentials manager implementation
  and add a --change-password option which can be used to change the
  password.
* Adapt config_set_option to follow the change in do_config.
* Split selection of the credentials manager descriptor to reuse it
  in do_config and interactive_config_setup.
* Introduce new ConfigMissingCredentialsError which is raised in case
  of missing credentials (user or password). In this case the user will
  be asked to enter the new credentials.
2019-08-29 16:11:17 +02:00
lethliel
36ec0c48d4 Remove passx encode/decode functions from conf.py
They are no longer needed with the new CredentialsManagers
2019-08-29 15:06:48 +02:00
lethliel
629ab25a0e Remove check for GNOME_DESKTOP_SESSION_ID
It was removed from GNOME with this commit:
6bf47ad8c6
2019-08-29 15:06:48 +02:00
lethliel
abf206fa0d New credentials backend (Transient store)
New backend to not store the password and ask for
it every time.
2019-08-29 15:06:45 +02:00
lethliel
eb3a3ef0ec Introduction of new credential management
* new module credentials.py which contains classes
  and methods to set and get passwords for different
  backends:
      - python-keyring
      - gnomekeyring
      - ConfigFile based storage

The new code should be backward compatible except a minor
change in add_section (pass and passx are not removed from
the config parser). This affects only callers that do not pass
a creds_mgr_descriptor.

On initial osc call or initial osc call on new API Url
the user now can decide where to store the password (based
on the backends available on his system)
2019-08-29 15:04:36 +02:00
lethliel
c9d85ac248 move raw_input function to helper module 2019-08-27 15:17:53 +02:00
Marcus Huewe
7c01399a4a Deprecate the "plaintext_passwd" config option
The upcoming credentials manager abstraction supersedes the old
plaintext_passwd behavior. This commits "breaks" the old behavior:
Passwords are not rewritten anymore (plaintext <-> obfuscated)
2019-08-27 15:15:59 +02:00
lethliel
428a81e451 Refactor config setup dialog
Move logic to conf module in new function interactive_config_setup
for new config file and missing apiurl section.

Dropped keyring code, because it was never used in write_initial_config()
2019-08-26 17:25:56 +02:00
lethliel
dbed74a13f reopen 0.166 development 2019-08-05 08:47:46 +02:00
lethliel
5994326451 release 0.165.4 2019-08-05 08:45:32 +02:00
Marcus Huewe
63c103770a Merge branch 'fix_600_osc-h_not_working_with_plugins' of https://github.com/lethliel/osc
python3 "workaround" for the quite fragile code in
RawCmdln._help_preprocess: It depends on the "non-deterministic" order
of preprocessor.items(). Hence, the results may differ on python2 and
python3. The real fix is probably to enforce a fixed iteration order.
See also the discussion in [1].

[1] https://github.com/openSUSE/osc/pull/604
2019-08-03 16:20:01 +02:00
lethliel
c78c8178e6 prevent plugins to break help
prevent call of preprocessor if ${cmd_name} marker is accidentaly set,
but cmdname is None.

Also for cmd_option_list and cmd_usage
overwrite _help_preprocess_* functions in Osc class
2019-08-02 20:02:14 +02:00
Marcus Huewe
6e95f8019d Merge branch 'fix_#607' of https://github.com/lethliel/osc
Do not apply the --target-package-filter pattern if there is no target
package.
2019-08-02 13:31:53 +02:00
Andreas Schwab
c9d320bf92 Use correct appname for trusted-certs store 2019-07-28 14:59:14 +02:00
Marcus Huewe
e5c4a10673 Merge branch 'dont_decode_None' of https://github.com/lethliel/osc
Do not try to decode None in decode_it (in this case None is returned).
2019-07-26 14:35:03 +02:00
lethliel
a802df15ad return the obj if None type is passed to decode_it
If a obj of type None is passed to decode_it just
return it and do not try to decode it as this will fail
2019-07-26 14:22:26 +02:00
Marcus Huewe
1b6149fc75 Merge branch 'fix_local_package_cache_for_all_formats' of https://github.com/lethliel/osc
Make osc.util.{debquery,rpmquery} a bytes only api again.
2019-07-26 14:01:59 +02:00
lethliel
2aa6e998d2 fix and unify building of local package cache
* all filename functions now return bytes-like objects
* the caller does the decoding
* the caller in build.py passes encoded arguments
2019-07-26 13:38:45 +02:00
Marco Strigl
d2de7ccc97
Merge branch 'master' into maint_enforce_branch 2019-07-25 13:46:18 +02:00
f465717668 allow implicit branch on maintenance request creation
via --enforce-branching option

This may be default by server side settings
2019-07-25 13:43:45 +02:00
Matthias Gerstner
0a99f35126
babysitter: fix RPMError fallback when running in Python3
After (successfully) running an 'osc vc' the following exception trace
comes up, when no rpm python module is available:

```
no changes made
Traceback (most recent call last):
  File "/home/mgerstner/.local/lib64/python3.6/site-packages/osc/babysitter.py", line 62, in run
    return prg.main(argv)
  File "/home/mgerstner/.local/lib64/python3.6/site-packages/osc/cmdln.py", line 344, in main
    return self.cmd(args)
  File "/home/mgerstner/.local/lib64/python3.6/site-packages/osc/cmdln.py", line 367, in cmd
    retval = self.onecmd(argv)
  File "/home/mgerstner/.local/lib64/python3.6/site-packages/osc/cmdln.py", line 501, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/home/mgerstner/.local/lib64/python3.6/site-packages/osc/cmdln.py", line 1232, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/home/mgerstner/.local/lib64/python3.6/site-packages/osc/commandline.py", line 8924, in do_vc
    sys.exit(vc.returncode)
SystemExit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mgerstner/bin/osc", line 41, in <module>
    r = babysitter.run(osccli)
  File "/home/mgerstner/.local/lib64/python3.6/site-packages/osc/babysitter.py", line 172, in run
    except RPMError as e:
TypeError: catching classes that do not inherit from BaseException is not allowed
```

To fix this change the fallback RPMError from None to an actual
Exception-derived type.
2019-07-25 10:58:56 +02:00
lethliel
5e39cdf683 open 0.166 development 2019-07-24 15:15:45 +02:00
lethliel
26214f7dcd release 0.165.3 2019-07-24 15:13:39 +02:00
Marcus Huewe
71ae93b35a Merge branch 'switch_diffs_to_bytes' of https://github.com/lethliel/osc
Since we do not know the files' encoding, the diff functions/methods
have to return bytes. Note: decoding the diff result is wrong in
general (see the discussion in [1]).

[1] https://github.com/openSUSE/osc/pull/554
2019-07-24 14:45:23 +02:00
lethliel
2b47be6b1e switch to difflib.diff_bytes in python3 case.
The files are now opened as rb for diffing. In python2 nothing changes.
In python3 the returned diff is bytes now.

The following changes were made:
  * commandline.py: The returned diff is now bytes
  * get_diff now returs the diff as a bytes-like object
  * run_pager writes with sys.stdout.buffer.write if message
    is not a string
  * for the commit message the returned diff needs to be decoded
    now. Otherwise it will just producce garbage. For the commit
    message the diff on decoded bytes-objects is ok. (nothing harmfull
    can happen here)
  * fixed submit_action_diff
  * fixed request_interactive_review
2019-07-24 13:48:39 +02:00
lethliel
1d866351b9 fix oscssl.py not verifying TLS cert verification
use own implementation of HTTPSConnection (myHTTPSConnection)
instead the one provided by M2Crypto (httpslib.HTTPConnection)
And in proxy case use myProxyHTTPSConnection.

all credits go to wfrisch
2019-07-23 19:42:51 +02:00
lethliel
0c0dca0b27 Fix package filtering for osc rq
Check if action.tgt_package is None.
2019-07-23 15:51:41 +02:00
lethliel
cc44dded85 Do not decode output from osc api calls
Do not guess the decoding of the returned output on osc api calls.
This could lead to unexptected behavior. Just use sys.stdout.buffer.write()
to print the bytes-like object in python3.
2019-07-19 08:44:57 +02:00
lethliel
49b0325ab0 fix error when f.size is None but f.mtime is not
The if statement just catches the case when both (f.size
and f.mtime) are None.

Added two elifs to catch the cases that just one of them is None.
2019-07-11 13:43:22 +02:00
lethliel
9a1b2d980a open 0.165.3 development 2019-07-08 11:30:42 +02:00
lethliel
d17b46c948 release 0.165.2 2019-07-08 11:28:50 +02:00
lethliel
ef4b0ce023 fix handling of empty prjconfig meta
if prjconfig meta is empty the class metafile init
fails with

if isinstance(input[0], str):
IndexError: list index out of range

This is because input is an empty list and has no
[0] index.

This can be fixed by changing this line to:

if input and isinstance(input[0], str):
2019-07-02 09:36:05 +02:00
72b96b7d39 fix typo in last commit fixing simpleimage support 2019-06-27 16:34:41 +02:00
Marco Strigl
704c495dca
Merge pull request #590 from adrianschroeter/simpleimage
fix local build using simpleimage
2019-06-27 16:20:43 +02:00
024759bee0 fix local build using simpleimage 2019-06-27 16:14:17 +02:00
lethliel
682452d914 [python3] fix osc lbl non utf8 encoding
data can contain non-utf8 chars. So passing data to
the decode_it function will solve this problem.
2019-06-21 10:13:31 +02:00
Marco Strigl
7df178b50b
Merge pull request #552 from lethliel/fix_unhandled_exception_on_empty_package
fix triggerreason on empty packages.
2019-06-12 13:07:16 +02:00
lethliel
2568f88438 simplified class metafile __init__ method
simplified and fixed the __init__ method of the metafile class.
input can be string, bytes-like object, list of strings or list
of bytes-like objects now.

Based on the input now always a list is generated and joined to
a string for writing in the fd. (This is ugly but needed for
compat reasons)
2019-06-11 15:08:52 +02:00
Marco Strigl
9a098c4af8
Merge pull request #578 from lethliel/python3_fix_set_bugowner
[python3] osc maintainer -s now works with python3
2019-06-11 12:53:20 +02:00
lethliel
d85c901f88 osc maintainer -s now works with python3
data is a bytes-like object now and needs to be joined into a
bytes-like object.
2019-06-11 12:00:42 +02:00
Marcus Huewe
ee34429d75 Merge branch 'master' of https://github.com/andreas-schwab/osc
Use ET to parse the error xml in metafile.edit.
2019-06-02 20:07:43 +02:00
Marcus Huewe
a72d90a7af Merge branch 'priorize-command-typo' of https://github.com/sknorr/osc
Spelling and grammar fixes.
2019-05-29 23:13:27 +02:00
Andreas Schwab
ce63cd3e18 Properly parse error message in metafile.edit 2019-05-29 12:27:40 +02:00
Marco Strigl
d5c91d6a73
Merge pull request #568 from MaximilianMeister/fetch
cast bytes object to string during os.path.join
2019-05-28 13:36:06 +02:00
Maximilian Meister
1c825ec8b6
cast bytes object to string during os.path.join
this makes sure not to mix objects to prevent a TypeError

TypeError: Can't mix strings and bytes in path components

Fixes#567

Signed-off-by: Maximilian Meister <mmeister@suse.de>
2019-05-28 13:29:12 +02:00
6eac27ec1c support different token operations (runservice, release and rebuild) (requires OBS 2.10) 2019-05-27 14:50:34 +02:00
Stefan Knorr
4c16177ada Random drive-by typo fixes for osc command-line messages 2019-05-27 11:54:42 +02:00
Marcus Huewe
cf96f85590 Merge branch 'master' of https://github.com/sknorr/osc
Improve grammar in check_existing_requests and
check_existing_maintenance_requests.
2019-05-25 23:44:44 +02:00
Marcus Huewe
f1100d2a45 Merge branch 'master' of https://github.com/bmwiedemann/osc
Fix opts.define codepath in the build module (missing encode).
2019-05-25 23:36:31 +02:00
Marcus Huewe
0c9c616bd8 Merge branch 'master' of https://github.com/andreas-schwab/osc
Decode data in do_token before printing it.
2019-05-25 23:14:41 +02:00
Marcus Huewe
c4dd37936f Merge branch 'fix_offline_mode_for_build' of https://github.com/lethliel/osc
Do not make a http request if noinit is True in parse_repoarchdescr.
2019-05-25 23:10:49 +02:00
Bernhard M. Wiedemann
13a174bdcc Fix encode method call
This broke with
--define="%_buildhost foo"
2019-05-25 13:36:10 +02:00
Stefan Knorr
b14c9cfd92 Add "prioritize" as (preferred) alias for "priorize" command
"priorize" is not an English word, "prioritize" is the correct
version:
* https://www.merriam-webster.com/dictionary/priorize
* https://www.merriam-webster.com/dictionary/prioritize

The "priorize" command will continue to exist after this commit, but the
documented  version will be "prioritize".
2019-05-24 13:22:30 +02:00
Andreas Schwab
7ed9ff32ad osc token: decode data from trigger url 2019-05-23 09:53:05 +02:00
lethliel
178dfd16c3 fix offline build mode
The offline mode does not really work offline since
parse_repoarchdescr() uses get_buildconfig to store the
buildconfig in a temporary file.

Solution:

Use the same logic as in build.py. If in offline mode(noinit = True)
try to use the local _buildconfig file. If not in offline mode just
download the buildconfig from the server via get_buildconfig
2019-05-22 13:58:46 +02:00
Marco Strigl
c4979dcde2
Merge pull request #562 from lethliel/fix_status_outupt_of_attribute_deletion
[python3] fix outupt of status on attribute deletion
2019-05-22 13:08:43 +02:00
lethliel
1ab68d3bfb open 0.165.2 development 2019-05-22 13:00:55 +02:00
lethliel
260d5f585a fix outupt of status on attribute deletion
On osc meta attribute --attribue <name> --delete the returned
data is encoded. Therefore the sys.stdout.write(data) call fails.

Solution: Decode data

--> sys.stdout.write(decode_it(data))
2019-05-22 12:57:02 +02:00
lethliel
8b56405d10 release 0.165.1 2019-05-20 08:35:27 +02:00
lethliel
860548bc30 fix getbinaries in commandline (progress_meter)
change progress_meter = opts.quiet to
progress_meter = not opts.quiet
2019-05-16 15:21:16 +02:00
lethliel
5bd5fdb22c Revert "fix getbinaries quiet logic"
This reverts commit 82ac5f6f06.
2019-05-16 09:31:38 +02:00
Marco Strigl
8c14208ad0
Merge pull request #555 from lethliel/fix_get_binaries_quiet_logic
fix getbinaries quiet logic
2019-05-15 17:29:16 +02:00
lethliel
82ac5f6f06 fix getbinaries quiet logic
opts.quiet is passed to get_binary_file which is False by default.
So the following if progress_meter is always False unless -q is given.

So it needs to be if not progress_meter.
2019-05-15 17:22:51 +02:00
lethliel
877d5e50b6 fix triggerreason on empty packages.
When running osc triggerreason on newly created (empty) packages
the command failes with AttributeError: 'NoneType' object has no attribute 'text'
because root.find('explain') is NoneType.

Solution:

Check if root.find('explain') is None and print "No triggerreaseon found".
In this case also do not try to get the triggertime. It will result in the same error.
2019-05-15 11:45:20 +02:00
Stefan Knorr
84c8019383 Improve grammar of request supersede message 2019-05-14 20:05:38 +02:00
lethliel
597eadf2f4 fix adding dirs as compressed archive
The content in the todo dict are strings. In python3 the communicate
method expects a bytes-like object not a string.

Solution: Encode every element in todo to a new dict (enc_todo) and
pass this instead of todo
2019-05-14 10:24:17 +02:00
lethliel
03777b7e4d fix get_commitlog to decode correct.
get_commitlog mixes bytes and strings when the output is
xml or csv.

This is fixed by decoding the commit message before replacing chars.
2019-05-14 10:01:02 +02:00
Marco Strigl
c5139fdff8
Merge pull request #538 from lethliel/fix_unimported_urldefrag
Import urldefrag function
2019-04-26 12:14:15 +02:00
lethliel
9aba391a11 Import urldefrag function
The function was not imported and so osc crashed when executed behind a proxy
2019-04-26 10:49:03 +02:00
3886b95ae4 [python3] release command: fix exception on missing bytearray/str decode 2019-04-25 22:28:19 +02:00
Marcus Huewe
a3de1bdad1 Merge branch 'master' of https://github.com/lnussel/osc
Remove group elements during copy_pac, link_pac, aggregate_pac.
2019-04-24 20:11:50 +02:00
lethliel
1dc836f48c open 0.166 development 2019-04-18 14:30:14 +02:00
lethliel
baf80268b7 release 0.165.0 2019-04-18 14:27:42 +02:00
Ludwig Nussel
9d4f584aeb Also remove groups on copypac 2019-04-17 11:42:29 +02:00
lethliel
0d55ddc1b3 [python3] fix decoding in addGitSource
open the file with mode 'w' instead of 'wb'. The 'b' is not needed.
Neither in python2 nor in python3.

Fixes github issue https://github.com/openSUSE/osc/issues/507
2019-04-16 16:55:06 +02:00
Marco Strigl
393290bfe5
Merge pull request #528 from lethliel/python3_fix_bsc1129889
[python3] add exception if encoding fails and try ISO-8859-1
2019-04-16 15:49:29 +02:00
Marco Strigl
fc8e6f8695
Merge pull request #529 from lethliel/python3_fix_bsc1131512
[python3] return value when adding attrs is bytes
2019-04-16 15:41:10 +02:00
lethliel
d10c9b4cea [python3] fix sorting when using osc se
osc se did not sort the output anymore. The logic
in the existing results.sort(key=...) was wrong. Now it is using
key=itemgetter(0,1) has two columns and key=itemgetter(0) if there
is only one column.
2019-04-16 15:18:04 +02:00
lethliel
b7dea9ddcd [python3] return value when adding attrs is bytes
When adding attribute with osc meta attribute <prj> -a <attr> -s '<val>'
the api call gets executed successfull but the return value needs to be
decoded to print it correctly.
2019-04-16 14:57:19 +02:00
lethliel
5841bf759f add exception if encoding fails and try ISO-8859-1
In some rare cases the chardet encoding detection detects
a wrong encoding standard. Then we switch to latin-1 which
covers most if utf-8 does not work.
2019-04-16 14:40:13 +02:00
Marco Strigl
71770555ac
Merge pull request #526 from lethliel/python3_fix_debquery_decoding
[python3] fix decoding issue in debquery.py
2019-04-15 15:10:21 +02:00
Marco Strigl
6c074fce20
Merge pull request #524 from lethliel/python3_packagequery_fix_decoding
[python3] fix decoding for packageqeury.py
2019-04-15 15:09:59 +02:00
Marco Strigl
2693d24a0a
Merge branch 'master' into python3_fetch_module 2019-04-15 15:09:31 +02:00
Marco Strigl
41ced89fcc
Merge pull request #522 from lethliel/python3_repodata_module
[python3] fix epoch encoding in repodata.py
2019-04-15 15:07:50 +02:00
Marco Strigl
19965b7a15
Merge pull request #513 from lethliel/python3_compatible_fetch_module
[python3] cpio.py is now a bytes only api.
2019-04-15 15:07:37 +02:00
Marco Strigl
32a28ae460
Merge pull request #493 from lethliel/python3_commandline_module
[python3] python3 support for commandline module
2019-04-15 15:07:24 +02:00
Marco Strigl
498bc9d44d
Merge pull request #492 from lethliel/python3_core_module
[python3] python3 support for core library
2019-04-15 15:07:02 +02:00
Marco Strigl
ec7945a07e
Merge pull request #491 from lethliel/python3_build_module
[python3] build.py with python3 (mostly bytestring)
2019-04-15 15:05:28 +02:00
Marco Strigl
05d90f9e96
Merge pull request #490 from lethliel/python3_oscssl_module
[python3] make oscssl.py python3 ready.
2019-04-15 15:05:04 +02:00
Marco Strigl
3ec9a57ab5
Merge pull request #485 from lethliel/python3_babysitter_module
[python3] babysitter.py msg and body are byte strings
2019-04-15 15:04:32 +02:00
Marco Strigl
0086bcfa64
Merge pull request #483 from lethliel/python3_rpmquery_module
[python3] rpmquery.py now python3 ready
2019-04-15 15:02:59 +02:00
Marco Strigl
5e6bcf5610
Merge pull request #479 from lethliel/python3_cmdln_module
[python3] enable full python3 support for man page building
2019-04-15 15:02:19 +02:00
Marco Strigl
d5108c7536
Merge pull request #464 from lethliel/python3_utils_helper
[python3] add helper functions for python3 support
2019-04-15 15:00:58 +02:00
lethliel
fe642db042 [python3] python3 support for commandline module
* use cmp_to_key from functools for python 2.7 and higer
* use self written cmp_to_key for python 2.6
* a lot of bytestring handling and decoding
2019-04-12 09:58:23 -05:00
lethliel
60c6ec2b52 [python3] fix decoding issue in debquery.py
name, version, release and arch are strings, not bytes
2019-04-07 14:44:25 -05:00
lethliel
ee694b54f2 [python3] python3 support for core library
* use cmp_to_key from functools for python 2.7 and higer
* use self written cmp_to_key for python 2.6
* new functions compare und cmp (used in python2 and python3)
* a lot of bytestring handling and decoding
* fix slow rbl based on f.readline(bufsize)
2019-04-07 11:14:49 -05:00
Marco Strigl
030cd69771
Merge branch 'master' into python3_build_module 2019-04-07 11:09:15 -05:00
lethliel
c235148180 [python3] now python3 ready:
* new function cmp (not available in python3)
  * fix decoding in canonname function
2019-04-07 11:05:13 -05:00
lethliel
6c001fa64c [python3] build with python3 (mostly bytestring)
* return of get_buildinfo is bytestring with python3
* other variables contain bytestrings as well now
2019-04-07 10:42:00 -05:00
lethliel
c6d3870942 [python3] fix decoding for packageqeury.py
name, arch, version and release need to be decoded
2019-04-07 10:31:23 -05:00
Marco Strigl
b71deaa537
Merge branch 'master' into python3_fetch_module 2019-04-07 10:25:50 -05:00
lethliel
87628a4150 [python3] fix epoch encoding in repodata.py
other.epoch() needs to be encoded to work with the vercmp callers.
2019-04-07 10:19:47 -05:00
lethliel
96ce14221b [python3] fetch.py python3 ready
* the result of a division is a float
  but we need int to continue.
* use decode_it to decode hdr.filename
2019-04-07 10:06:24 -05:00
Michael Schroeder
8b4dae21f7 Fix kiwi builds where the project does not define a path
In that case, the packages to setup the build environment are
taken from the repositories defined in the kiwi file. Osc did
not take into account that the build config must match this
path. So it cannot just get the build config like with normal
builds, but must use a different path.

This led to build errors on some projects like CentOS 7 which
rely on 'Order' statements from the project config.

The OBS backend already had support for this: the 'path' parameter
can be used to overwrite the project path in the _buildconfig
query. We now use this to provide the correct path if we
detect this case. (The detection is currently a heuristic
because OBS does not provide us with a clear indicator.)
2019-03-11 16:39:04 +01:00
Marcus Huewe
c39c3b8cae Cleanup the source services execution code in do_build
Always error out if the source services execution failed (the old
code only errored out if the local_service_run config option was
set (this behavior was probably unintentionally introduced in commit
d3dd8539d9 ('- fallback to "build
--local-package" if it does not exist instead of complaining'))).
Also, do not suppress all exceptions (if something failed in the
services execution code path, the user should be informed).

The bug was reported by darix.
2019-02-22 15:42:23 +01:00
lethliel
442a2731be cpio.py is now a bytes only api.
The decoding of the header needs to be done in fetch.py
2019-02-12 14:04:42 +01:00
lethliel
93ea66b922 reopen 0.165 development 2019-02-12 09:17:05 +01:00
lethliel
4a7248562f release 0.164.2 2019-02-12 09:11:43 +01:00
lethliel
0ab8661a8b reworked deleterequest commit (add --all)
* removed superfluous parenthesis
* switched package == None to package is None
2019-02-04 14:56:20 +01:00
Marco Strigl
4b4774872e
Merge pull request #509 from adrianschroeter/deletereq
deleterequest for entire projects needs the --recursive option as add…
2019-02-04 14:52:25 +01:00
a760e2bd39 Return exitcode when "osc results" is falling through prjresults
Otherwise a failure from osc prjresults does not propagate
up.
2019-02-04 13:07:59 +01:00
Marcus Huewe
555efc845f Avoid a potential http request if there are no services
The vc_export_env call was introduced in commit
37ca5535ce ("Export vc env vars when
running a source service") and broke the testsuite. The potential
http request is useless if there are no services. Hence, avoid it.

Thanks to Marco Strigl for catching the testsuite error!
2019-02-04 12:19:57 +01:00
677c741189 deleterequest for entire projects needs the --all option as additional protection
We had it two times this week that people dropped entire projects
(important ones)
2019-02-04 11:54:03 +01:00
Marcus Huewe
37ca5535ce Export vc env vars when running a source service
Some services (like the obs_scm) will use them. Note: if realname
or email is not set in the oscrc, an additional http request will
be performed.

This change was requested by darix.
2019-01-29 14:30:52 +01:00
Marcus Huewe
fefd7c1dea Move vc env exporting code into core.vc_export_env
This allows for reuse. In the future, these variables should also
be exported when executing source services.
2019-01-29 14:20:12 +01:00
Marcus Huewe
c534d7e990 Fix logic error in DebQuery.vercmp
res is never None, because DebQuery.rpmvercmp always returns -1, 0,
or 1.
2019-01-27 19:43:38 +01:00
Marcus Huewe
cd5f46984d Port debquery module to python3
No functional changes. Note that we cannot simply decode the control's
fields as ascii/utf-8 because a field is not necessarily a valid
ascii/utf-8 encoding (it is possible to register _arbitrary_ custom
fields via a 'register-custom-fields' hook when building a deb
package).

Note: DebQuery.debvercmp really deserves a cleanup:/
2019-01-27 19:31:47 +01:00
Marcus Huewe
bb9f9a7fde Refactor DebQuery.__parse_control a bit
No functional changes. This just simplifies the upcoming python3
port a bit.
2019-01-27 17:35:47 +01:00
Marcus Huewe
f63a0957af Remove superfluous try-except block in the archquery module
ArchQuery.query never raises an ArchError exception.
2019-01-27 16:51:58 +01:00
Marcus Huewe
2074a1c01d Make ArchQuery.canonname more robust against None values
Use ArchQuery.filename to construct the filename and raise an
ArchError exception if we are unable to construct a filename.
2019-01-27 16:46:52 +01:00
Marcus Huewe
8c1cb190bd Port the missing pieces of the archquery module to python3
This is a follow-up commit for commit
21eca9e3f1 ("[python3] switch
ArchQuery to bytestrings").
2019-01-27 16:27:30 +01:00
Marcus Huewe
2d0c974296 Add cmp function to packagequery module
cmp(a, b) returns
-1 if a < b
 0 if a == 0
 1 if a > b

This is needed since python3 has no cmp function anymore.

All credits for this go to Marco Strigl <mstrigl@suse.com> (see
PR#483 [1]).

[1] https://github.com/openSUSE/osc/pull/483
2019-01-27 16:12:57 +01:00
Marcus Huewe
a3720c5286 Fix ArchQuery.rpmvercmp if one of its arguments is None
The None argument is always <= than the other argument. We need this
in case of a broken/pathological package where version() or release()
return None (see vercmp (which calls rpmvercmp)).
2019-01-27 15:50:35 +01:00
Marcus Huewe
5c639db805 ArchQuery.epoch should never return None
Returning None breaks ArchQuery.vercmp. Returning b'0' is ok because
an epoch, if present, is always supposed to be an integer (at least
in a "valid" arch package (see scripts/libmakepkg/lint_pkgbuild/epoch.sh.in
in the pacman sources)). Hence, if we compare the epoch of a package,
which has no explicit epoch set, with the epoch of a package, which
has an explicit epoch set, we always have a <= relation.
2019-01-27 15:39:07 +01:00
Marcus Huewe
deee8ef6cb Fix logic error in ArchQuery.vercmp
res is never None, because ArchQuery.rpmvercmp always returns -1, 0,
or 1.
2019-01-27 15:00:36 +01:00
Marcus Huewe
562374f045 Simplify ArchQuery.read a bit
No functional changes - just to improve readability.
2019-01-27 14:57:47 +01:00
Marcus Huewe
e580769757 Merge branch 'python3_archquery_module' of https://github.com/lethliel/osc
Initial port of the archquery module to python3 (ArchQuery.__init__,
ArchQuery.read, and ArchQuery.canonname are ported - the rest is missing).
2019-01-27 14:55:01 +01:00
Marco Strigl
fb6605f475
Merge pull request #481 from lethliel/python3_oscerr_module
[python3] self[i] is now self.args[i]
2019-01-23 23:37:49 +01:00
lethliel
21eca9e3f1 [python3] switch ArchQuery to bytestrings
decode explicit (ascii)
2019-01-23 22:59:55 +01:00
Marcus Huewe
60f9290d02 Fix ZeroDivisionException in meter.PBTextMeter
If size is 0, using pb.Percentage will result in a
ZeroDivisionException. Note: the output in case of
size == 0 looks a bit "strange" - for a consistent
output we should probably subclass pb.Percentage.
2019-01-23 15:37:01 +01:00
Marco Strigl
f233066448
Merge pull request #482 from lethliel/python3_packagequery_module
[python3] magic is now a bytestring in python3
2019-01-18 14:34:43 +01:00
lethliel
623f33daa4 reopen 0.165.0 development 2019-01-16 14:04:04 +01:00
lethliel
8cf5e7bfd3 release 0.164.1 2019-01-16 14:02:23 +01:00
Marcus Huewe
218e77aadc Merge branch 'rework_meter_py' of https://github.com/lethliel/osc
Simplify code that uses meter.TextMeter (for the details, see the
discussion in https://github.com/openSUSE/osc/pull/502).
2019-01-16 12:59:50 +01:00
lethliel
93d15fc83b reworked meter.py based on discussion
* new function create_text_meter with fallback selection
* NoPBTextMeter.start() will print the basename (if not stated otherise with
  basename = None)
* The callers that should use an alternare TextMeter class now call create_text_meter()
* The callers that should not use and alternate TextMeter (because of different handling,
  like build.py) call create_text_meter(use_pb_fallback=False)
* the warning 'Please install the progressbar module' is now only shown once

improvements
2019-01-16 11:39:40 +01:00
Marcus Huewe
e60af6f120 Use with statement in CpioRead._copyin_file
This makes sure that the file is closed in case of an exception.
2019-01-15 20:49:26 +01:00
Marcus Huewe
5387744d36 Port CpioWrite to python3
Now, CpioWrite provides a bytes-only API. It would be also possible
that the API accepts bytes and str (we would need to explicitly
encode the latter) but this would be a bit inconsistent wrt.
cpio.CpioRead (which is bytes-only).
Also, by using a bytesarray instead of a [] we avoid several
intermediate ''.join(...)s.
2019-01-15 20:48:42 +01:00
Marcus Huewe
3e326b1bb4 Port CpioRead and CpioHdr to python3
This is a bytes only API because a filename in a cpio archive can
contain, for instance, illegal utf-8 sequences. A user can decode
the filename/content as she wishes.
2019-01-15 20:05:47 +01:00
Marcus Huewe
54ac438eb0 Do not mmap a cpio archive
There is simply no need for a mmap.
2019-01-15 19:47:27 +01:00
Marcus Huewe
1c4385a579 Run a small demo when the cpio module is invoked as a script
It just reads in a cpio archive and print the headers.
2019-01-15 19:46:00 +01:00
Marcus Huewe
245df33444 Merge branch 'samefile' of https://github.com/maltek/osc
Just catch an AttributeError in os_path_samefile instead of using a
general "except".
2019-01-15 17:49:07 +01:00
Malte
3fc3dfb802 improve os_path_samefile 2019-01-15 17:22:27 +01:00
Marcus Huewe
5c19425c9b Use with statement in ArFile.saveTo
This makes sure that the file is closed in case of an exception.
2019-01-15 17:18:50 +01:00
Marcus Huewe
b26a4a967d Raise a ValueError if neither fn nor fh is passed to Ar.__init__
A ValueError is more appropriate because there is no issue with the
ar archive itself. Also, the old codepath never worked because the
fn parameter was missing.
2019-01-15 17:18:50 +01:00
Marcus Huewe
6fdce86fc9 Port the ar module to python3
Since an ar archive can contain arbitary filenames (that is a
filename can be an invalid utf-8 encoding (for instance,
"foo\xff\xffbar")), the ar module provides a bytes only API. A
user can decode filenames as she wishes.
Note: if a "fn" parameter is passed to Ar.__init__ it should be a
bytes (a str is also ok, but then be aware that an ArError's file
attribute might be a str or a bytes).
2019-01-15 17:18:37 +01:00
Marcus Huewe
68cf974c78 Do not mmap the ar archive
There is really no need for a mmap here. Also, the comment in the
docstr does not apply/is nonsense (there is no performance gain).
2019-01-15 17:18:19 +01:00
Marcus Huewe
e12181b11d An ext fn header in an ar file has no mode
Use a dummy mode of 0 in this case (internally, the mode is never
used).
2019-01-15 17:18:19 +01:00
Marcus Huewe
2e45edbe16 Remove superfluous StopIteration exception from the ar module
There is no need to raise a StopIteration exception.
2019-01-15 17:18:19 +01:00
Marcus Huewe
470b187374 Run a small demo when the ar module is invoked as a script
It just prints the ar headers.
2019-01-15 17:18:10 +01:00
Marcus Huewe
35a909bee5 Merge branch 'python3_fetch_module' of https://github.com/lethliel/osc
Explicitly "cast" the division result to an int. This is needed for the
python3 port (in python3 a division of two ints yields a float).
2019-01-14 17:11:16 +01:00
Marcus Huewe
28eeff8683 Simplify rpmquery.unpack_string
There is no need to unpack a single byte because it is not
affected by (byte) endianness (and that's what struct.unpack is
about). Moreover, rpmquery.unpack_string now supports an optional
encoding parameter, which could be used by the python3 port to
decode a string. Note: in general we cannot assume that all strings
in a rpm are utf-8 encoded (it is possible to build a rpm that
contains illegal utf-8 sequences).
2019-01-14 16:40:09 +01:00
Marcus Huewe
e608200414 Remove yet another superfluous try-except from meter import
Follow-up fix for commit be94132298
("Remove superfluous try-except from meter import").
2019-01-14 00:41:09 +01:00
lethliel
8b3c2bd61a improve handling of missing progressbar module
With the NoPBTextMeter class the build view gets broken.
Old view:
1/11 (repo) filename

new view:
Please install the progressbar module...
Please install the progressbar module...
Please install the progressbar module...

With this commit the old behavior is restored.

The getbinaries call now lists the file he downloads instead of just
stating "Please install the progressbar module..." several times.
(but only if not called with the option quiet)
2019-01-11 10:16:02 +01:00