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

3169 Commits

Author SHA1 Message Date
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
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
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
lethliel
a3ab245893 open 0.165 development 2019-01-09 12:02:02 +01:00
lethliel
6800582512 release 0.164 2019-01-09 11:57:37 +01:00
Marcus Huewe
be94132298 Remove superfluous try-except from meter import
Since commit 8a6abe3a6c ("warn user
if python-progressbar is not installed") it is always safe to import
the meter module (even if the progressbar module is not installed).
2019-01-08 18:03:23 +01:00
Marco Strigl
8a6abe3a6c warn user if python-progressbar is not installed
On ImportError have_pb_module is false and the class NoPBTextMeter gets
returned which prints "Please install progressbar module..." on TextMeter.start()
2019-01-08 17:39:13 +01:00
Andreas Schwab
51812b7e93 Don't crash if can_also_build does not contain hostarch 2019-01-04 19:39:18 +01:00
lethliel
6ddf771c9f [python3] make oscssl.py python3 ready.
* works also with python2
2018-12-13 14:53:34 +01:00
lethliel
4269426b28 [python3] msg and body are byte strings 2018-12-13 14:32:38 +01:00
lethliel
67560887db [python3] enable full python3 support for man 2018-12-13 13:33:51 +01:00
lethliel
017c74ba21 [python3] the result of a division is a float
but we need int to continue.
2018-12-13 13:29:14 +01:00
lethliel
40caf1ce0a [python3] self[i] is now self.args[i] 2018-12-13 13:27:22 +01:00
lethliel
2d5a3aeb3b [python3] magic is now a bytestring in python3 2018-12-13 13:23:26 +01:00
b4b1ec7b64 don't fail on request processing, where the object has not yet a state
element.

Happens only before submitting to api
2018-12-13 13:14:19 +01:00
Fridrich Štrba
89cef1f8c1 Do not choke on operators < and > in spec files 2018-11-28 10:55:17 +01:00
74ed6a5b9a report status as outdated if the scheduler can not re-evaluated the
repository because it needs to wait for other repos first
2018-11-26 16:42:17 +01:00
lethliel
2c905ad94f do not add key to buildinfo if not existent
fixes issue: https://github.com/openSUSE/osc/issues/471

Add the key_path only to buildinfo(bi) if it exists (not try_parent)
2018-11-20 20:41:03 +01:00
lethliel
4b29e1c543 add helper functions for python3 support
This functions are used in the whole code and are
mandatory for the python3 support to work. In python2
case nothing is touched.

* cmp_to_key:
  converts a cmp= into a key= function

* decode_list:
  decodes each element of a list. This is needed if
  we have a mixed list with strings and bytes.

* decode_it:
  Takes the input and checks if it is not a string.
  Then it uses chardet to get the encoding.
2018-11-08 09:55:07 +01:00
Marcus Huewe
aa88b6b795 Merge branch 'prjresults-watch' of https://github.com/JanZerebecki/osc
Add "--watch" option to "osc prjresults" ("--watch" can only be used
in combination with "--xml").
2018-11-06 16:44:50 +01:00
5e03ffcec9
Add --watch for osc prjresults --xml
Like: osc results --watch
2018-11-06 15:13:08 +01:00
Marcus Huewe
07b6b41154 Merge branch 'fix_OscMirrorGroup_bug_with_network_not_reachable' of https://github.com/lethliel/osc
Catch URLError and remove superfluous counter in OscMirrorGroup.urlgrab.
2018-11-06 15:05:25 +01:00
lethliel
a65606cbfe fix broken URLError handling in OscMirrorGroup.urlgrab()
If urlgrab returns a URLError (for example if the Network is unreachable)
the for loop did not continue and the osc build aborts.

Now we also catch the URLError and try the next mirror and return False
correctly if no mirror could be reached. And then try to download it from
api
2018-11-06 13:29:17 +01:00
Luca Weiss
f5938348db Fix Python 3.7 support
See PEP 479
2018-11-06 10:35:38 +01:00
Marcus Huewe
e5478e2ff6 Merge branch 'release-no-delay' of https://github.com/JanZerebecki/osc
Add --no-delay option to the "osc release" command.
2018-11-01 20:07:57 +01:00
Marcus Huewe
d5dd5708d5 Merge branch 'add_alternative_project_to_buildinfo' of https://github.com/lethliel/osc
Add --alternative-project option to the "osc buildinfo" command.
2018-11-01 20:04:04 +01:00
Marcus Huewe
ad1450a1f7 Remove superfluous error message
Printing something like "Error 404" might be a bit confusing for
the users.
2018-11-01 19:55:52 +01:00
Marcus Huewe
bec52a7917 Merge branch 'python3_prep' of https://github.com/lethliel/osc
Get rid of the urlgrabber dependency. The current implementation of the
progress bar is quite "noisy" if the line length exceeds the size of
the terminal window, but that's something we could fix later. (The
superfluous error message will be fixed in a subsequent commit.)
2018-11-01 19:55:07 +01:00
fb80026651
Add --no-delay for osc release
This is useful so one can wait with a following osc prjresult until
everything done. Without this one can not know if a release job hasn't
started yet or is already finished.
2018-10-31 03:45:17 +01:00
1fab61c875 Fix help for osc token 2018-10-25 10:20:16 +02:00
Marco Strigl
92d15b2d95 add --alternative-project option to buildinfo
to be consistent with osc build
2018-10-23 20:27:43 +02:00
lethliel
65b053abb3 replace urlgrabber to enable python3 compatibility
- new module grabber.py
  * OscMirrorGroup to keep urlgrabber.mirrorgroup behavior
  * OscFileGrabber moved here

- meter.py
  * reworked to use progressbar module instead of progressbar
    of urlgrabber and simplified the module.

- babysitter.py
  * removed URLGrabErrorr

- build.py
  * removed adding of url_local to urllist. (not needed anymore)
  * removed URLGrabError

- commandline.py
  * switched from urlgrabber.urlgrab to OscFileGrabber().urlgrab

- core.py
  * reworked progressbar behavior

- fetch.py
  * removed join_url (not needed anymore)
  * moved OscFileGrabber to grabber.py
  * removed failureReport (not needed anymore)
2018-10-19 09:31:37 +02:00
Marcus Huewe
f12c7747d0 Merge branch 'approver' of https://github.com/adrianschroeter/osc
Introduce "osc request approval..." and "osc request cancelapproval"
commands.
2018-10-18 15:23:06 +02:00
e1fd0b4ee9 add support for approved requests (requires OBS 2.10) 2018-10-18 13:26:39 +02:00
Marcus Huewe
25014c326f Merge branch 'fix_413_get_deleted_sources' of https://github.com/lethliel/osc
Introduce --deleted option to "osc co" for checking out the files of
a deleted package (no package wc is established).
2018-10-18 12:59:55 +02:00
lethliel
0123bb71db fixes 413 checkout deleted package
* altered command do_checkout
  new option -D | --deleted. Can only be used with PACKAGE and needs
  -o to work

* what happens:
  core function checkout_deleted_package fetches the file list of the deleted
  package and saves it to given destdir. If destdir is not existent it
  creates the destination directory. Otherwise the files will be written
  in the existing directory.
2018-10-18 08:59:05 +02:00
Marcus Huewe
d83bf74984 Merge branch 'unclear_error_message' of https://github.com/lethliel/osc
Improve error message in rpmquery.py
2018-10-15 22:18:37 +02:00
lethliel
9ffe9b9288 improve error message if file is not a valid rpm
The current error message is quite confusing and nobody knows what
"invalid lead magic" means.
2018-10-09 10:16:27 +02:00
c5ec3ce807 support checkconstraints command without local checkout 2018-10-02 10:45:38 +02:00
lethliel
f643e37eb1 print error and exit if p.apiurl != -A <apiurl>
Print error and exit if osc -A <apiurl> sr is issued on a
package with a different apiurl in its working copy. This leads
to unexpected behavior, because the SR is created for the package
apiurl, not the apiurl given by the -A command line option.
2018-09-25 13:48:09 +02:00
Johannes Kastl
ba66a0bc1d change keep-link description to make it easier to understand 2018-09-17 20:50:27 +02:00
Marco Strigl
48e71b0255
Merge pull request #438 from andreas-schwab/token
Clarify use of osc token
2018-08-31 11:16:04 +02:00
Marcus Huewe
f1c31561cb Merge branch 'clean_xpath' of https://github.com/lethliel/osc
Let's get rid of this old cruft.
2018-08-30 14:13:00 +02:00
153032bc11 fix local multibuild flavor support when package does not exist ('_repository' case) 2018-08-22 11:20:40 +02:00
ae2656b415 open 0.164 development 2018-08-21 10:34:53 +02:00
d82b30636f release 0.163.0 2018-08-20 13:19:29 +02:00
Marcus Huewe
86e5757832 Refactor the do_vc code a bit
No functional changes.
2018-08-17 22:45:28 +02:00
Marcus Huewe
820c3adc71 Consider the "realname" config option in apiurl sections
This is a follow up fix for commit ef13d67 ("Export a real name
for vc to consume").
2018-08-17 22:45:17 +02:00
Marcus Huewe
6233f8bf0b Merge branch 'moreuserinfoforvc' of https://github.com/Conan-Kudo/osc
Adds support for full author identities in changes files (see also
https://github.com/openSUSE/obs-build/pull/214).
2018-08-17 21:14:30 +02:00
2566d6aa73 add podman build support 2018-08-14 13:02:16 +02:00
Andreas Schwab
4eae5d9a45 Clarify use of osc token
Clarify the fact that the parameters of osc token -t and osc token -d are
of different types.
2018-08-12 13:36:24 +02:00
lethliel
69983249ef cleanup xpath. submit/* is ignored by the API since 2012 2018-08-07 11:53:49 +02:00
ef13d67208 Export a real name for vc to consume 2018-08-01 09:43:14 -04:00
Marcus Huewe
bc57f89e9e Merge branch 'fix_indent_for_python3' of https://github.com/lethliel/osc
Fixes a single indentation.
2018-07-06 10:29:34 +02:00
lethliel
779b66f3c3 fixed indentation of return[].
It works in python2, but will break in python3
2018-07-06 09:54:59 +02:00
4cc87b2c57 fix DISTURL checkout for package containers using a multibuild flavor 2018-06-27 10:25:45 +02:00
Sean Kelly
b42e6f5e04 Support larger uids and gids 2018-06-25 16:55:47 -04:00
Marcus Huewe
b730f880cf Disable ssl session resumption
The old code could potentially yield to a use-after-free situation,
which results in UB. For this, consider the following scenario, where
osc performs several HTTPS requests (assumption: the server supports
ssl session resumption):

- HTTPS Request 1:
  * a new SSL *s connection is established, which also creates a new
    SSL_SESSION *ss => ss->references == 1
  * once the handshake is done, the ss is put into the session cache
    (see ssl_update_cache) => ss->references == 2
  - osc saves the session ss in a class variable
  - s is SSL_free()d, which calls SSL_SESSION_free => ss->references == 1

- HTTPS Request 2:
  * setup a new SSL *s connection that reuses the saved session ss
    => ss->references == 2
  * once the handshake is done, ssl_update_cache is called, which is a
    NOP, because s->hit == 1 (that is, the session was resumed)
  * osc saves the session ss in a class variable
  * s is SSL_free()d, which calls SSL_SESSION_free => ss->references == 1

...

> 2 hours later (see tls1_default_timeout)

...

- HTTPS Request 256:
  * setup a new SSL *s connection that reuses the saved session ss
    => ss->references == 2
  * once the handshake is done, ssl_update_cache is called, but is
    _no_ NOP anymore
  * ssl_update_cache flushes the session cache (this is done every
    255/256 (depending on the way we count) connections) => ss is
    SSL_SESSION_free()d => ss->references == 1
  * osc saves the session ss in a class variable
  * s is SSL_free()d, which calls SSL_SESSION_free:
    since ss->references == 1, ss is eventually free()d

- HTTPS Request 257:
  * setup a new SSL *s connection that reuses the saved session ss

Since ss does not exist anymore, the remaining program execution is UB.

(Note: SSL_free(...) is _NOT_ called, if M2Crypto 0.29 is used.
M2Crypto 0.30 calls SSL_free(...) again.)

Due to a bug in OpenSSL_1_1_0h (see openssl commit 8e405776858) the
scenario from above can be triggered with exactly 2 HTTPS requests (the
SSL_SESSION is not cached, because we configured SSL_VERIFY_PEER, but
no sid_ctx was set). This is fixed in openssl commit c4fa1f7fc01.

In order to reliably reuse a session, we probably need to listen to the
session cache changes. Such callbacks could be registered via
SSL_CTX_sess_set_new_cb and/or SSL_CTX_sess_set_remove_cb, but both
functions are not provided by M2Crypto. Another idea is to directly utilize
the session cache, but this also has to be implemented in M2Crypto first.
Yet another approach is to retrieve the session via SSL_get1_session, which
increases the session's refcnt, but this also needs to be implemented in
M2Crypto first (if we choose to use this approach, we also have to make
sure that we eventually free the session manually...).

Fixes: #398 ("SIGSEGV on \"osc commit\"")
2018-05-08 14:32:33 +02:00
jonsger
6bd8572cf7
Fix typo in "osc revert" help 2018-05-03 16:16:38 +02:00
Marcus Huewe
d6a04e5327 Merge branch 'master' of https://github.com/adrianschroeter/osc
Always pass the "--statistics" option to the build script (only affects
a vm build). It is not implemented as an option, because we already have
so many of them... (see also https://github.com/openSUSE/osc/pull/412).
2018-05-03 11:02:57 +02:00
Marcus Huewe
88274c92ed Merge branch 'fix_newline_in_verbose' of https://github.com/lethliel/osc
Print each unresolvable on a separate line.
2018-05-03 09:57:02 +02:00
0c3edd3fa0 always run build using --statistics. I could have made this
yet another option, but
* only very old build scripts don't know it, we should just require a recent one
* build script is ignoring it for chroot case

so why bother with another option?
2018-04-27 15:01:09 +02:00
bfcfddb0da fix some commands when used with / syntax between arguments 2018-04-27 14:41:08 +02:00
628f7e2cf5 - support "addcontainers" command 2018-04-27 09:16:13 +02:00
Marcus Huewe
d756f56af2 Show diff when creating a new comment (interactive_review)
Note that the diff is only shown, if it was requested before (that is
the "i" command was issued). The new behavior is consistent with the
other commands like "a", "d" etc.
2018-04-26 17:01:49 +02:00
lethliel
b7ada2cb5b fix missing newline in osc r -v
This adds a newline after unresolvable:. So the
messages are now well printed.
2018-04-26 15:38:25 +02:00
Marcus Huewe
cbd10644a2 Merge branch 'fix_IncompleteRead' of https://github.com/lethliel/osc
Retry 3 times in print_buildlog in case of an incomplete read. (Instead
of 3, the "http_retries" config option might be more appropriate.)
2018-04-25 11:02:52 +02:00
lethliel
1caa825e89 fixed IncompleteRead(0) error on long builds.
catch IncompleteRead() and retry until retry_counter is
reached. Then re-raise IncompleteRead()
2018-04-24 10:44:46 +02:00
lethliel
eb2647fd4f fix order of options valdiation. Now -P and -p is
honored if given by user.
2018-04-18 16:04:06 +02:00
fba9af7eee add new options to diff command:
--unexpand for local diffs only (bsc#1089025)
--meta for diffing meta files
2018-04-11 08:01:45 +02:00
Marcus Huewe
5341f3aae5 Merge branch 'fix_dod_get_binaries' of https://github.com/lethliel/osc
Support dod binaries in core.get_binarylist.
2018-03-14 14:06:13 +01:00
lethliel
9b42897413 fix getbinaries with DOD binaries
getbinaries of dod binaries do not have a size or mtime.
This will break. So just set to None and print unkown instead.
2018-03-14 13:45:38 +01:00
Marcus Huewe
a25209ac31 Merge branch 'improve_created_binaries_msg' of https://github.com/lethliel/osc
Improve message that is printed during "osc getbinaries...".
2018-03-13 15:16:12 +01:00
lethliel
e042c585c0 change output when creating binaries directory
was:
Creating binaries

is now:
Creating directory "binaries"
2018-03-13 15:00:46 +01:00
Marcus Huewe
caaefb0bf5 Fix and simplify util.safewriter.SafeWriter
Storing the error encoding in an "encoding" attribute "breaks" the
python3 "input" function: In essence, builtin_input_impl does a
getattr(sys.stdout, 'encoding'), which returns our error encoding
instead of the "real" stdout encoding. In order to avoid this, we
store the error encoding in an "_encoding" attribute.

Making SafeWriter a new-style class simplifies the code a lot.
2018-03-09 16:55:56 +01:00
305501f92c Revert "handle SSL connection closing ourself as advised in boo#1068470 bye"
This reverts commit 0ddb598743.

was incomplete and seems to be the wrong approach
2018-02-26 15:54:20 +01:00
Marcus Huewe
5fb71aa6d4 Merge branch 'fix_385' of https://github.com/lethliel/osc
Fix for python26, since it does not support an epath/xpath like
.//entry[@hash].

Fixes: #385 ("osc 0.162.x does not work anymore on SLE11")
2018-02-23 13:29:11 +01:00
Marco Strigl
e017a8e237 do not use complex path separator fixes #385
This is a fix for issue #385. osc commit breaks due to
the use of sfilelist.findall('.//entry[@hash]')

I now will iterate through the sfilelist and use

for entry in sfilelist.findall('entry'):
    if entry.get('hash'):
        ... execute hash code ...

This is a little bit slower, but should not break
on SLE11 anymore
2018-02-23 13:24:48 +01:00
0ddb598743 handle SSL connection closing ourself as advised in boo#1068470 bye
M2Crypto upstream maintainer.

Should fix hanging connections
2018-02-23 07:33:27 +01:00
Björn Geuken
030c2a41f8 Fix typo in example for osc search 2018-02-18 21:27:22 +01:00
Marcus Huewe
8948a26ae4 Fix --multibuild-package option handling in do_sendsysrq
Concatenating a str and a list does not work.
2018-02-09 15:35:52 +01:00
7fc251d81e fix sendsysrq command description 2018-02-09 10:08:13 +01:00
80352cbfc7 add sendsysrq command 2018-02-09 08:50:21 +01:00
Marcus Huewe
9c4f0d5d30 Ignore "--alternative-project <prj>" if it is equal to the wc's project
Without this change, using "--alternative-project <prj>" in combination
with "--multibuild-package <flavor>" yields to unexpected results (from
a user's point of view). Note that this may break existing (artificial)
workflows (e.g., using --alternative-project to ignore the package
meta's debuginfo flag), but these workflows should be rare and there
are options to achieve the same.

Fixes: #376 ("osc build -M something does not work with
--alternative-project")
2018-02-07 14:35:35 +01:00
Andreas Schwab
50222810f0 osc chroot: also mount devpts
This is needed for running expect, for example.
2018-01-28 16:53:52 +01:00
5e3fe8ba08 give a hint which package to install to get CA certificates 2018-01-26 09:46:52 +01:00
Marcus Huewe
d0213c63a9 All values in the conf.DEFAULTS dict should be strings
Non-strings cause errors during config value interpolation.

Fixes: #372 ("Commit causes crash: The 'build-jobs' config option
should be an integer")
2018-01-24 14:00:02 +01:00
Marcus Huewe
1a92c8b995 The 'build-jobs' config option should be an integer
This fixes the "config['build-jobs'] > 1" check in the build module.
2018-01-23 12:28:55 +01:00
Marcus Huewe
8cb0246c10 Merge branch 'fix_369_crash_at_req_issues' of https://github.com/lethliel/osc
Only include a tag if it "has" text in get_request_issues. Note
that the code in get_formatted_issues always assumes the presence
of the "label" tag.

Fixes: #369 ("crash trying to view diff of a request")
2018-01-22 14:46:21 +01:00
Marco Strigl
5b3d8633fa only assign issue detail if text for tag exists 2018-01-22 11:00:40 +01:00
Marco Strigl
2405134cbf fixes not working osc maintainer <prj>
The retrun at this point breaks the call, because in most
cases <prj> is not a binary. And the code always checks for the
binary first and then returns if no binary with the name <prj>
is found.
2018-01-11 11:57:22 +01:00
Marcus Huewe
0b241a9586 Consider "recommends" and "supplements" in build.create_deps
Fixes: #363 ("osc build -p ../rpms/tw doesnt send recommends to
the server which makes client side build behave differently to server
side build").
2017-12-26 23:28:14 +01:00
Marcus Huewe
ebb2f2ee0d Add support for querying weak dependencies
The following abstract methods are added to the PackageQueryResult
class: recommends(), suggests(), supplements(), and enhances().
Note that not all package/metadata formats have a notion of these
weak dependencies.

              rpm   rpmmd   deb   arch
recommends     x      x      x
suggests       x      x      x     x
supplements    x      x
enhances       x      x      x

(where "x" represents "supported"). In case of an unsupported weak
dependency, the implementation returns an empty list.

We need the weak dependency support in order to fix #363 ("osc build
-p ../rpms/tw doesnt send recommends to the server which makes client
side build behave differently to server side build").
2017-12-26 23:14:47 +01:00
ChrisWi
26f00c6749 change WARNING message for better understanding 2017-12-14 12:11:25 +01:00
lethliel
43be8f0e9c add meaningful error if no attribute name 2017-12-08 13:20:24 +01:00
Marcus Huewe
b1d6d8347b Fix "osc buildinfo --prefer-pkgs <dir>..." (finally!)
This is a follow-up commit for commit ce9a6d0 ("Fixed
\"osc buildinfo --prefer-pkgs...\"").
2017-12-06 18:04:30 +01:00
lethliel
aa01b1c52a reopen 0.163 development 2017-12-06 10:22:15 +01:00
lethliel
067fd4cd2d release 0.162.1 2017-12-05 14:29:03 +01:00
Marcus Huewe
9116d8ff97 Support expansion/unexpansion of a link when updating to certain rev
There is no good reason why "--revision <rev>" and "--expand-link" or
"--revision <rev>" and "--unexpand-link" should be mutually exclusive
during an "osc up" of a package wc.
Introduce the new "--linkrev <rev>" option to specify a rev of the link
target that is used during link expansion.
2017-12-03 16:45:36 +01:00
Marcus Huewe
f698103977 Send sha256 hashes for tracked files if the wc is pulled/linkrepair
In case of a pulled/linkrepair wc, it is possible that the backend
requests a hash for a tracked file, which is neither added, restored,
nor modified. For instance, this can happen if a new file was added
to the link target. Hence, for a pulled/linkrepair wc always send
the sha256 hashes of the tracked files.
2017-12-03 15:02:22 +01:00
e818989d21 0.163 development open 2017-11-28 15:13:26 +01:00
2b0f015de0 0.162.0 2017-11-28 15:12:29 +01:00
lethliel
f0325eb0b5 added code to get the sha256 hashes of files
This is needed for a new validation of the source server.

The source server will 'ask' for the sha256 sum of files which are new or
modified and osc calculates the sha256 sums for those files and sends them
back to the server.

The server checks the sha256 sums and if dies if something is wrong.
2017-11-27 16:18:19 +01:00