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

2880 Commits

Author SHA1 Message Date
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
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