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

3869 Commits

Author SHA1 Message Date
Marcus Huewe
8dd9cbef39 Merge branch 'help-workerinfo' of https://github.com/JanZerebecki/osc
Improve documentation of the "workerinfo" command (make the abstract
"workername" more precise (hostarch:workerid)).
2020-08-25 17:50:56 +02:00
75934c995c
fix content of osc workerinfo --help
Replace usage with better explanation. It was missing that it requires a
prefixed hostarch. Also workername is instead called workerid in the
API.

Usage help was before: osc workerinfo WORKER

Add actual example.

See also the fix for this in OBS API docs:
https://github.com/openSUSE/open-build-service/pull/10024
2020-08-25 16:42:01 +02:00
Marco Strigl
568cb38e3d
Merge pull request #828 from lethliel/implement_normal_release_request
implement releaserequest for non-maintenance prj
2020-08-07 09:44:46 +02:00
lethliel
a91b8f051e implement releaserequest for non-maintenance prj
In the API a new request action release was implemented. This changes
enables the user to create a release request for non-maintenance projects
and to review / view the release requests
2020-08-06 21:52:53 +02:00
Marcus Huewe
3216a56d08 Merge branch 'fix-single-service-run' of https://github.com/cmurphy/osc
Fix "osc service run <service>" so that it takes the parameters from
the _service file if <service> is present in the _service file. Also
document (+ fix) the (undocumented) "osc service <command> <service>"
behavior. This enables, for instance, to run "osc service mr foobar",
which would execute all foobar services with mode "manual" (now, this
also works, if the foobar service is not part of the _service file).
2020-08-04 09:13:07 +02:00
Colleen Murphy
cb6eaf3720 Fix single service disabled run
Without this patch, running an individual service that has parameters
defined in the _service file fails:

  $ osc service run obs_scm
  Please specify valid --scm=... options
  Aborting: service call failed:  /usr/lib/obs/service/obs_scm --outdir [snipped]

This is because although the service is defined in the _service file and
the "scm" parameter is set in it, the service wasn't being found in the
data structure and so the service executable wasn't being called with
the parameters supplied in the _service file. This patch corrects the
issue with the services data structure so that the service data isn't
overridden if it is defined in the _service file.

A side effect of this correction for services defined in the _service
file is that instead of overriding the service mode with '', the mode is
taken from the _service file. When using the "run" command, this would
mean that the call mode of None may not be in agreement with the service
mode defined in the file, e.g. "manual", and so the "run" command would
no longer cause it to run when it would before. We can take this
opportunity to define this as the correct behavior - the "run" command
now only runs services with "trylocal", "localonly", or no mode set -
and also ensure that other call mode commands result in sensible
behavior when called with a service name, for instance "osc service
manualrun download_files" will run only services with mode="manual" and
name="download"files" instead of all services with mode="manual".
Additionally, services that aren't defined in the _service file can be
called with a call mode command and will use that call mode rather than
None.
2020-08-03 18:01:30 -07:00
Marcus Huewe
7612fe1614 Merge branch 'undeprecate-disabledrun' of https://github.com/cmurphy/osc
Add a "manual" service mode. A service with mode "manual" is not executed
by default (that is, via "osc service run"). As of now, "manual" is in
some sense just an alias for "disabled". However, this might change in the
future [1]. Also, "localrun" now executes services with mode "serveronly".
Moreover, the documentation of "disabledrun" is updated ("disabledrun"
never executed services with mode "serveronly"). Additionally, "localrun"
and "disabledrun" are marked as "[n]ot for common usage anymore" in the
service command's description.
The rationale for these changes is (partly) described in [1]. The main
motivation is to add some clarity (in contrast to the "disabled" mode,
it is probably easier to get/guess the semantics of the "manual" mode).

[1] https://github.com/openSUSE/osc/pull/826
2020-07-31 15:01:23 +02:00
Colleen Murphy
894b97d471 Add command "manualrun" to replace "disabledrun"
The "disabledrun" service commands is marked as deprecated but has no
explicit replacement. It is still a useful command for updating packages
manually or through a CI system without being forced to run all defined
services with the "runall" command. This change adds a new command
"manualrun" and a new mode "manual" which behave the same as the
deprecated "disabledrun" command and "disabled" mode but have clearer
meaning. "manualrun" does not attempt backwards-compatible behavior with
the "disabledrun" mode for "disabled" services because "disabled" mode
may eventually be removed or change meaning. The "localrun" command is
enhanced to consider the "serveronly" mode. Since "disabledrun" never
executed services with mode "serveronly", its docs are updated
accordingly.
2020-07-30 14:26:47 -07:00
Marco Strigl
bf7e483c33
Merge pull request #827 from kevinsmia1939/patch-1
Update build.py
2020-07-26 20:38:32 +02:00
Kevin Tee
783544d2da
Update build.py
Fix repeated word.
2020-07-26 11:57:18 +00:00
Marcus Huewe
077138e5ad Merge branch 'detailed_error_int_review' of https://github.com/lethliel/osc
Be more verbose in case of an HTTPError in core.request_interactive_review.
2020-07-22 23:16:57 +02:00
lethliel
0ef77b8cd7 print detailed error message in interactive review
Print the details of a Bad Request also in interactive review mode.
2020-07-22 20:20:09 +02:00
lethliel
55d3f46ac0 open 0.171.0 development 2020-07-09 10:27:10 +02:00
lethliel
ead43243db release 0.170.0 2020-07-09 09:57:53 +02:00
Marcus Huewe
76eafc92b5 Merge branch 'print_links_in_mr' of https://github.com/lethliel/osc
Print a link to webui if a new maintenance request is created and
the "print_web_links" config option is enabled.
2020-07-07 17:50:48 +02:00
lethliel
ce794cb37d print web links on osc mr
print web_links also on maintenance requests when print_web_links=1
is configured in oscrc
2020-07-07 17:31:20 +02:00
Marcus Huewe
ea8c6e1c45 Merge branch 'overhaul_do_service' of https://github.com/lethliel/osc
Improve error message in do_service a bit. The old "Too few arguments."
was misleading (for instance, if a non-remote command was not executed
in a package wc).

Note: with the new logic we could also get rid of the
"raise oscerr.WrongArgs('Local directory is no package')" statement.
2020-07-07 17:19:38 +02:00
Marcus Huewe
aa855b1c69 Merge branch 'filter_results_based_on_code' of https://github.com/lethliel/osc
Add a --status-filter option to "osc results" that can be used to
show, for instance, only the repos where a package failed to build. As
a short circuit, a -f/--failed option is added, too.
Add a --brief option to "osc prjresults" and "osc results" that can be
used to get a more compact representation of the results. In case of
"osc results", --brief is ignored if the results for a package are
requested.
2020-07-07 17:08:32 +02:00
lethliel
f2f80a1498 fix error message if osc service not in cwd
fix the error message if osc servce is run without [proj] [pack] arguments
in a non-valid osc working directory.
2020-07-07 08:31:35 +02:00
lethliel
2f0918b93e add brief results/prjresults with filtered code
in do_results:
  * add --brief option on prj level:
    [packagename] [repo] [arch] [buildstatus]
  * filter by --status-filter <long status name>
    works on prj and pkg level

in do_prjresults:
  * --brief
  * assume len(state)>1 as long state

core.py
  * filter packages by build status
  * long status handling in get_prj_results
  * brief output generation in get_prj_results
2020-07-07 08:23:02 +02:00
Marcus Huewe
ce291abac6 Merge branch 'fix_string_literal_in_commit_msg' of https://github.com/lethliel/osc
Interprete unicode escape characters in a "--message" option. In some
cases, this breaks the existing UI (but that's OK because it can be
fixed by properly escaping the escape character(s)).
Note: if we are going to do more advanced stuff in the future, we should
move the logic into a separate function.
2020-06-29 23:53:32 +02:00
lethliel
16fda3115c interpretation of string literals in messages
string literals are not interpreted correctly when using -m "my\ntwo line message"
2020-06-26 17:42:35 +02:00
Marco Strigl
b13935adf7
Merge pull request #815 from marcus-h/python2_decode_it_fix
Fix python2 regression in util.helper.decode_it
2020-06-25 17:53:14 +02:00
Marcus Huewe
d85030b72d Fix python2 regression in util.helper.decode_it
In commit 276d6e2439 ("Do not use the
chardet module in util.helper.decode_it") util.helper.decode_it was
changed to always decode the passed object if it has a decode method.
Since a python2 str has a decode method, the new code tries to utf-8
decode the passed str. As a result, a unicode object is returned (if
the decoding worked). Since a unicode object is not an instance of
type str, all subsequent isinstance(decoded_obj, str) checks evaluate
to False, which break some codepaths.
In order to fix this, restore the old python2 behavior (that is, if
the passed object is a str, it is not decode it). This change does not
affect the python3 codepaths.

Fixes: #814 ("osc log | fails")
2020-06-25 15:38:14 +02:00
Marcus Huewe
050c94dcf3 Merge branch 'fix_issues_diff' of https://github.com/lethliel/osc
Improve "osc rdiff --issues-only ..." output: now, it shows the added,
deleted and changed issues. Also, add a new "osc rdiff --xml ..." option,
which only works in combination with the "--issues-only" option: it prints
the raw xml.

Note: server_diff_noex has no option for the "full" parameter. Hence,
with the addition of the "xml=False" parameter, the signatures of the
server_diff_noex and server_diff functions are going to differ "forever".
That's OK (IMHO) because it is probably more sane to simply specify the
additional args via the kwargs syntax.
2020-06-15 22:42:16 +02:00
lethliel
a1df48145b Add more infos to issues rdiff
Show the state of the issues (added, deleted, changed)
of the issues in a list.

Also --xml can now be given to get the raw xml output from the server.
2020-06-15 20:53:38 +02:00
Marcus Huewe
dd814054ee Merge branch 'remove_dead_code' of https://github.com/lethliel/osc
Remove dead code from the fetch module. Actually, it should have
been removed in commit 95ec7dee7b
('- fixed #590606 ("osc/fetch.py does not support authenticated URLs")').
2020-06-08 21:32:42 +02:00
lethliel
297b050f1e remove dead opener code
The opener is generated but never used.
Since commit 95ec7dee7b
2020-06-08 20:31:28 +02:00
Marcus Huewe
a87d2c1202 Document a potential decoding issue in print_buildlog
We should reconsider this in the future (in practice, it does not
seem to cause too much trouble (at least I'm not aware of any bug
reports)).
2020-06-04 15:09:03 +02:00
Marco Strigl
869772f054
Merge pull request #803 from marcus-h/remove_chardet_decoding
Do not use the chardet module in util.helper.decode_it
2020-06-04 15:00:37 +02:00
Marcus Huewe
276d6e2439 Do not use the chardet module in util.helper.decode_it
In general, decode_it is used to get a str from an arbitrary bytes
instance. For this, decode_it used the chardet module (if present)
to detect the underlying encoding (if the bytes instance corresponds
to a "supported" encoding). The drawback of this detection is that
it can take quite some time in case of a large bytes instance, which
represents no "supported" encoding (see #669 and #746).
Instead of doing a potentially "time consuming" detection, either
assume an utf-8 encoding or a latin-1 encoding. Rationale: it is just
not worth the effort to detect a _potential_ encoding because we have
no clue what the _correct_ encoding is. For instance, consider the
following bytes instance:

b'This character group is not supported: [abc\xc3\xbf]'

It represents a valid utf-8 and latin-1 encoding. What is the "correct"
one? We don't know... Even if you interpret the bytes instance as a
human you cannot give a definite answer (implicit assumption: there is
no additional context available).
That is, if we cannot give a definite answer in case of two potential
encodings, there is no point in bringing even more potential encodings
into play. Hence, do not use the chardet module.

Note: the rationale for trying utf-8 first is that utf-8 is pretty
much in vogue these days and, hence, the chances are "high" that we
guess the "correct" encoding.

Fixes: #669 ("check in huge shell archives is insanely slow")
Fixes: #746 ("Very slow local buildlog parsing")
2020-06-04 13:12:22 +02:00
Marcus Huewe
e807abbf7c Enable python3.8 testing in travis
Based on PR#750 [1].

[1] https://github.com/openSUSE/osc/pull/750
2020-06-04 12:05:07 +02:00
Marcus Huewe
3d21f2498b Merge branch 'tests_python3_fixes' of https://github.com/marcus-h/osc
Make the testsuite work with python3.8
2020-06-04 12:00:14 +02:00
Marcus Huewe
613daa7a09 Merge branch 'no-celementtree' of https://github.com/AdamWill/osc
Use xml.etree.ElementTree if xml.etree.cElementTree is not available
anymore (python3.9).
2020-06-03 22:01:04 +02:00
Marcus Huewe
443e3ef90b tests: Ignore the ordering of attributes in XML documents
Old xml.etree.cElementTree versions (python2) reorder the attributes
while recent xml.etree.cElementTree versions (python3) keep the
document order.

Example:

python3:
>>> ET.tostring(ET.fromstring('<foo y="foo" x="bar"/>'))
b'<foo y="foo" x="bar" />'
>>>

python2:
>>> ET.tostring(ET.fromstring('<foo y="foo" x="bar"/>'))
'<foo x="bar" y="foo" />'
>>>

So far, the testsuite compared two serialized XML documents via a simple
string comparison. For instance via,
self.assertEqual(actual_serialized_xml, expected_serialized_xml) where
the expected_serialized_xml is, for instance, a hardcoded str. Obviously,
this would only work for python2 or python3.
In order to support both python versions, we first parse both XML
documents and then compare the corresponding trees (this is OK because
we do not care about comments etc.).

A related issue is the way how the testsuite compares data that is "send"
to the API. So far, this was a plain bytes comparison. Again, this won't
work in case of XML documents (see above). Moreover, we have currently
no notion to "indicate" that the transmitted data is an XML document.
As a workaround, we keep the plain bytes comparison and in case it fails,
we try an xml comparison (see above) as a last resort. Strictly speaking,
this is "wrong" (there might be cases (in the future) where we want to
ensure that the transmitted XML data is bit identical to a fixture file)
but a reasonable comprise for now.

Fixes: #751 ("[python3.8] Testsuite fails")
2020-06-03 21:50:50 +02:00
Marcus Huewe
27ef627f1d Get rid of bytes usage in tests.common
Simply use the .encode() method (encode using the utf-8 encoding).
2020-06-03 21:50:50 +02:00
Marcus Huewe
c0343207ea Make tests.common.MyHTTPHandler.__mock_PUT bytes aware
For now, we assume that if the "exp" keyword argument is specified,
then it is a str. In this case, we simply encode it (using the utf-8
encoding).
Also, simplify the code a bit (get rid of the if-statement that is
always executed).
2020-06-03 21:50:10 +02:00
Adam Williamson
13a13a87c4 Fix ElementTree imports for Python 3.9
Importing `cElementTree` has been deprecated since Python 3.3 -
importing `ElementTree` automatically uses the fastest
implementation available - and is finally removed in Python 3.9.
Importing cElementTree directly (not as part of xml) is an even
older relic, it's for Ye Time Before ElementTree Was Added To
Python and it was instead an external module...which was before
Python 2.5.

We still need to work with Python 2.7 for now, so we use a try/
except to handle both 2.7 and 3.9 cases. Also, let's not repeat
this import 12 times in one file for some reason.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-06-02 15:13:10 -07:00
lethliel
e99b2942ef increase version number in core.py 2020-05-29 20:35:00 +02:00
lethliel
0e70579113 release 0.169.1 2020-05-29 20:28:42 +02:00
Marcus Huewe
1d26cb3079 Merge branch 'ccache' of https://github.com/sjamgade/osc
Add "--ccache" option to "osc getbinaries".
2020-05-27 16:09:06 +02:00
lethliel
22ac336f8b open 0.170.0 development 2020-05-27 14:50:37 +02:00
lethliel
42b4992ecb release 0.169.0 2020-05-27 14:49:10 +02:00
Marco Strigl
fdcd606122
Merge pull request #797 from lethliel/fix_1122675
fix security issue (bsc#1122675) no / in filename
2020-05-27 11:23:49 +02:00
lethliel
a79c54418b fix security issue (bsc#1122675) no / in filename
This checks if the filename of a downloaded file has
been modified (for example by a MITM attack) to contain
slashes. This could mean that the file is compromised
and that the attacker tries to overwrite system files.
2020-05-27 11:17:40 +02:00
Sumit Jamgade
5557a06e5b add and implement ccache option for getbinaries
If this option is used, the api is asked to list ccache archive if
present, osc will then download the archive.
2020-05-25 09:03:33 +02:00
Marco Strigl
3967133022
Merge pull request #793 from sjamgade/ccache_path
add option pkg-ccache to be passed to build-cmd
2020-05-22 15:55:48 +02:00
Marco Strigl
3e10473e1a
Merge pull request #794 from Vogtinator/kiwifix
Fix kiwi build with --prefer-pkgs
2020-05-20 13:40:16 +02:00
Fabian Vogt
f3d07eab3f Fix kiwi build with --prefer-pkgs
The buildinfo contains packages from the local dir, so it needs the list of
local packages to work correctly.
2020-05-20 11:34:27 +02:00
Sumit Jamgade
5dd853e302 add option pkg-ccache to be passed to build-cmd
this option is a /path/to/_ccache.tar. The patch just forwards that
option to the build script.
2020-05-19 16:15:49 +02:00