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

1443 Commits

Author SHA1 Message Date
2912c1f34f
Trying to improve maintenance warning
Based on a suggesstion of

Co-Author: Jan Zerebecki <jzerebecki@suse.com>
2022-03-23 09:34:29 +01:00
Daniel Mach
b83aee10f5
Merge pull request #848 from adrianschroeter/repository_details
show repository state and details. It can be broken and the user must…
2022-03-16 16:46:55 +01:00
389a37fbd0 show repository state and details. It can be broken and the user must be able to see the reason.
That was always a problem, but with the new option for disabled publishing
due to package failures it becomes more critical
2022-03-16 14:33:32 +01:00
Daniel Mach
cb4b2389a6
Merge pull request #747 from adrianschroeter/request_diffing
support request diffing relative to a former request
2022-03-16 14:20:20 +01:00
c568cf7b41 support request diffing relative to a former request 2022-03-16 13:57:01 +01:00
f4626dd91f open 0.177.0 development 2022-02-28 21:14:29 +01:00
5f56c71e7f release 0.176.0 2022-02-28 16:44:11 +01:00
d222a38d03 Fix getbinaries command to fetch also multibuild packages 2022-02-23 14:56:02 +01:00
171b546379 Remove Windows from the supported operating systems
The ':' character is used as a separator in Open Build Service
and constantly appears in directory names after running osc commands.
Windows do not support ':' as a valid character on file system.
This breaks not only osc but also basic commands such
as 'git clone' on a project that contains colons in paths.

That's why we decided to make osc unsupported on Windows.
2022-02-17 13:34:03 +01:00
lethliel
2e80671523 open 0.176.0 development 2021-12-02 08:51:26 +01:00
lethliel
52e89604b3 release 0.175.0 2021-12-02 08:48:19 +01:00
Marcus Huewe
81d1985bc5 Improve error message in case of an URLError
The old code does not print any information about the host, for
which the access failed, in case of an URLError. In order to fix
this, add information about the host (and port) to the URLError
instance in core.http_request and use this information in the
babysitter to print out a more detailed error message (which includes
the host (and port)).
For now, we simply add a "private" "_osc_host_port" attribute to
the URLError instance (this way we avoid potential name clashes (due
to the "_osc" prefix) and could come up with a different/more clever
way in the future (due to its privateness)).

Fixes: #954 ("Better diagnostic for domain name issues")
2021-09-30 14:09:08 +02:00
f98083df5c
detachbranch: remove _link when link target got removed 2021-09-16 17:15:33 +02:00
Marcus Huewe
2cb308105a Offer a force ("f") choice in metafile.edit's error handling code path
Offer a force ("f") choice if, for instance, "osc meta prj foobar -e"
fails due to a HTTPError in metafile.edit. If the force choice is
selected, a new url is constructed by invoking the metafile._URLFactory
instance with a "force='1'" argument (this adds a "force=1" to the
original url's query string (*)) and the corresponding file is PUTed
to the new url. If this PUT fails again and now the "y" choice is
selected, the file is PUTed to the original url (*).

(*): Stricly speaking, from metafile.edit's POV, the concrete url
depends on the passed in metafile._URLFactory instance, though.

Note: the metafile._URLFactory class and its is_force_supported method
is a gross hack. That's why this class is marked as private (that is,
we can remove it at any point in time again without breaking the
API/3rd party applications). An alternative to the metafile._URLFactory
approach would be manual URL parsing and manual URL construction
(adding "force=1" to the query string)... but this is also pretty
awkward (if done properly).

Fixes: #916 ("for osc meta edit change y/n to y/n/f")
Fixes: #942 ("Offer -f when prjmeta change leads to repo_dependency")
2021-08-25 19:48:07 +02:00
Marcus Huewe
e5dda8337c Merge branch 'mergefile_fixed_suffix' of https://github.com/marcus-h/osc
Use a fixed suffix for the upfilename in Package.mergefile.
2021-07-27 22:36:40 +02:00
Marcus Huewe
3883ea4bcb Open 0.175.0 development 2021-07-21 10:46:46 +02:00
Marcus Huewe
dd2481da20 Release 0.174.0
For the details, see the NEWS file (which is mostly about user
visible changes).
2021-07-21 10:43:53 +02:00
Marcus Huewe
bf42c70f56 Use a fixed suffix for the upfilename in Package.mergefile
The old code uses a variable .rXYZ suffix (where XYZ is the revision
of the package wc during the merge operation). Now, if Package.mergefile
is invoked during an update, XYZ represents the "old" revision. That
is, if a merge conflict happens, then a subsequent "osc resolved <file>"
will not unlink the <file>.rXYZ file (because
Package.clear_from_conflictlist only takes the current rev into account).

In order to fix this, use a fixed ".new" suffix. This way,
Package.clear_from_conflictlist can properly unlink the corresponding
*.new file. This naming scheme for the "upfilename" is in line with
"osc pull" and "osc repairlink".

Note: if a working copy was updated with an "old" osc version (without
this commit) and a "new" osc version (with this commit) is used to run
"osc resolved <file>", then the <file>.rXYZ file is _NOT_ removed (it
is not worth the effort to add compat code for this).
2021-07-20 15:19:16 +02:00
Marcus Huewe
e71b79c6d0 Fix the commit of a frozen package wc
Always send the sha256sums of all tracked files in case of a
frozen package wc. For instance, this is needed if the package is
a plain link (no branch) because in this case the backend might
request a sha256sum for a tracked but unmodified file (this can
happen because the backend cannot expand the link).
The new behavior is in line with a pulled/linkrepair package wc.

Fixes: #924 ("Transmitting file data There is no sha256 sum for
file")
2021-07-02 23:20:16 +02:00
Marcus Huewe
fb44630ad7 Handle "cd prj; osc ci non_existent_pkg" more gracefully
When trying to commit a non-existent package via Project.commit it
is treated as an external package (because a non-existent package
has no "state" inside the project). That is, Project.commitExtPackage
is called, which fails with a FileNotFoundError in case of a
non-existent package (and the traceback is printed to the user).
In order to fix this, treat a non-existent package as broken package.
That is, simply print an info message and do not error out with a
traceback (note: the commit is _not_ aborted).

Fixes: #920 ("osc commit should fail gracefully in case of
nonexistent  filename")
2021-06-04 13:06:00 +02:00
Marcus Huewe
c94ea04eb7 Open 0.174.0 development 2021-05-18 22:39:39 +02:00
Marcus Huewe
60e06ad96d Release 0.173.0
For the details, see the NEWS file (which is mostly about user
visible changes).
2021-05-18 22:36:09 +02:00
Marcus Huewe
c932f95d46 Support an arbitrary sized file in core.http_request
The old code only supports a file whose size is less then or equal
to INT_MAX (due to a reasonable(!) limit in M2Crypto). The actual
issue is in core.http_request which mmap(...)s the file, wraps it
into a memoryview/buffer and then passes the memoryview/buffer to
urlopen. Eventually, the whole memoryview/buffer is read into memory
(see m2_PyObject_GetBufferInt). If the file is too large (> INT_MAX),
m2_PyObject_GetBufferInt raises a ValueError (which is perfectly
fine!).
Reading a whole file into memory is completely insane. In order to
avoid this, we now simply pass a file-like object to urlopen (more
precisely, the file-like object is associated with the Request
instance that is passed to urlopen). The advantange is that the
file-like object is processed in chunks of 8192 bytes (see
http.client.HTTPConnection) (that is, only 8192 bytes are read into
memory (instead of the whole file)).

There are two pitfalls when passing a file-like object to urlopen:
* By default, a chunked Transfer-Encoding is applied. It seems that
  some servers (like api.o.o) do not like this (PUTing a file with
  a chunked Transfer-Encoding to api.o.o results in status 400). In
  order to avoid a chunked Transfer-Encoding, we explicitly set a
  Content-Length header (we also do this in the non-file case (just
  for the sake of completeness)).
* If the request fails with status 401, it is retried with an
  appropriate Authorization header. When retrying the request, the
  file's offset has to be repositioned to the beginning of the file
  (otherwise, a 0-length body is sent which most likely does not
  match the Content-Length header).

Note: core.http_request's "data" and "file" parameters are now mutually
exclusive because specifying both makes no sense (only one of them
is considered) and it simplifies the implementation a bit.

Fixes: #202 ("osc user authentification seems to be broken with last
commit")
Fixes: #304 ("osc ci - cannot handle more than 2 GB file uploads")
2021-04-10 22:14:25 +02:00
Marcus Huewe
21274b6981 Do not use the deprecated Element.getchildren anymore
Element.getchildren is deprecated and not available on python39
anymore. Instead, iterate over the element itself (which iterates
over the element's children).

Fixes: #903 ("AttributeError: 'xml.etree.ElementTree.Element' object
has no attribute 'getchildren'")
2021-03-21 19:19:23 +01:00
Marcus Huewe
f65f08dfbb Add "--force" option to the "osc add" command
"osc add --force <filename>" adds the filename to the working copy
even if it is excluded by the exclude_glob config option.
2021-03-18 15:05:31 +01:00
Marcus Huewe
609990ba62 Open 0.173.0 development 2021-01-27 13:30:43 +01:00
Marcus Huewe
5df5465b1a Release 0.172.0
For the details see the NEWS file.
2021-01-27 13:21:32 +01:00
Ludwig Nussel
224ec6eef5
Merge pull request #847 from marcus-h/service_old_dir
Add .old dir support for source services
2021-01-20 15:08:27 +01:00
Marcus Huewe
fbea0ea729 Avoid superfluous/excessive usage of _html_escape
When creating a new request via the core.Request.create method, there is
no need to escape the data that is assigned to the "description" attribute
of a core.Request instance. Internally, core.Request.create ensures that
the data, which is POSTed to the api, is correctly escaped (the escaping
is implicitly done by ET (see core.Request.to_str)). Manually escaping the
description results in a double escaping (the escaped description is
escaped by ET again) - this is not the desired behavior.
Analogously, there is no need to escape the data that is passed to the
message parameter of the core.create_submit_request function because
core.create_submit_request takes care of escaping it.

Fixes: #869 ("Silly encoding of htmlencodable entities")
2020-11-28 18:03:24 +01:00
lethliel
a47a0a5f3c open 0.172.0 development 2020-11-10 14:31:25 +01:00
lethliel
528991829f release 0.171.0 2020-11-10 14:25:02 +01:00
Marcus Huewe
b573f02eb4 Fix show_upstream_rev call in checkRevision
If meta=True is passed to checkRevision, the meta parameter is used
as a revision in the show_upstream_rev call. Instead, it should be
bound to show_upstream_rev's meta parameter.
2020-10-13 19:35:08 +02:00
Marcus Huewe
89bb15d3b6 Add .old dir support for source services
Some services expect "old" service files (that is, files from a
previous service run) to be present in an ".old" dir. Hence, osc
should support that.
Instead of removing all files from a previous service run, move them
to the ".old" dir, run the services, and, finally, remove the ".old"
dir.
Unfortunately, the location of the ".old" dir is hardcoded in the
specific services. That is, we have to be careful if an ".old" dir
exists (in this case, we error out).

Based on [1].

[1] https://github.com/openSUSE/osc/pull/846
2020-10-01 14:03:10 +02:00
36fc925ee0 maintainer search: lookup via package name by default and binary as fallback
This is faster in best case since the binary search does not need
to be executed on the server.

It also finds package names where no binary with that name exists.
(as for some multibuild cases)
2020-08-31 13:53:41 +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
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
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
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
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
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
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
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