1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-21 17:56:19 +02:00
Commit Graph

1568 Commits

Author SHA1 Message Date
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
2bc186d0ea add new stage option for the build script
(minor code improvement for handing over release number)
2021-02-18 09:01:18 +01:00
c06b794ddf support osc build --shell-after-fail from build script 2021-02-12 08:20:51 +01:00
bc25ac769e add showlinked command 2021-02-08 10:50:45 +01:00
Marcus Huewe
2371a6c91b Support slash notation in "osc creq -a <action type> args"
Most osc commands support slash notation for the specification of
a project package pair. That is, "osc <cmd> prj/pkg" has the same
semantics as "osc <cmd> prj pkg" (in most cases).
For consistency reasons, "osc creq" should also support the slash
notation for the action type's arguments. That is, for instance,
"osc creq -a submit src_prj/src_pkg dst_prj/dst_pkg" should have the
same effect as "osc creq -a submit src_prj src_pkg dst_prj dst_pkg".

Proposed-by: darix
2021-01-25 21:16:17 +01:00
ca080d2118 add --lastsucceeded option also for buildlog command
introduce --last-succeeded alias
2021-01-18 10:21:58 +01:00
Marcus Huewe
6104560050 Merge branch 'creq_no_supersede_dups' of https://github.com/marcus-h/osc
Do not supersede the same requests several times in osc creq.
2020-12-22 16:07:43 +01:00
Marcus Huewe
0926e37f1e Do not return Request instances in Osc._submit_request
If there are existing requests that should be superseded, the old
code stores the Request instances in the myreqs list, which is
returned to the caller. However, the caller expects only request
ids instead of instances of class Request. Eventually, this results
in a type error - excerpt:

...
  File "/usr/lib/python3.8/site-packages/osc/commandline.py", line 1892, in do_createrequest
    change_request_state(apiurl, srid, 'superseded',
  File "/usr/lib/python3.8/site-packages/osc/core.py", line 4322, in change_request_state
    u = makeurl(apiurl,
  File "/usr/lib/python3.8/site-packages/osc/core.py", line 3326, in makeurl
    return urlunsplit((scheme, netloc, '/'.join([path] + list(l)), query, ''))
TypeError: sequence item 2: expected str instance, Request found

Hence, simply return the request ids instead of the Request instances.

Note: this changes the API of the Osc._submit_request method but
this is OK because it is not part of the public API.
2020-12-22 16:04:13 +01:00
Marcus Huewe
1aab0a8ed9 Do not supersede the same requests several times in osc creq
When calling "osc creq -a prj1 foo prj2 bar -a submit prj1 bar prj2 bar",
the requests that could be superseded are calculated two times for the
prj2/bar package. Hence, they could end up two times in the "supersede"
list (see do_createrequest) In order to avoid duplicates, use a set
instead of a list.

Kudos to darix for pointing this out!

Note: it is a bit questionable if osc's current semantics makes sense
in the above example.
2020-12-09 21:41:37 +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
Marcus Huewe
d7594ddeda Merge branch 'do_init_non_existent_prj' of https://github.com/marcus-h/osc into master
Fix "osc init" in case of a non-existent project.
2020-11-12 22:41:51 +01:00
Michael Schroeder
5d2542522d Support flatpak building 2020-11-12 14:08:10 +01:00
Marcus Huewe
0d78560e5d Do not retrieve the package list when initializing a project via osc init
Currently, when trying to initialize a non existent (server-side)
project via "osc init <prj>", osc errors out (after creating the wc)
because it fails to retrieve the package list. However, there is no
need to retrieve the package list in the "osc init <prj>" case. Hence,
skip the package list retrieval. As a result, osc does not error out.

For the background, see the discussion in #858 ("osc fails to check
out an empty project as project") [1].

[1] https://github.com/openSUSE/osc/issues/858#issuecomment-722330024
2020-11-05 13:13:07 +01:00
lethliel
eaf50dd13d add proper reporuls
for use in Arch, Debian and Ubuntu
2020-09-22 08:52:57 +02:00
9b245db224 catch URLs to github.com and gitlab.com as git repos
yes, ugly, but I am tired to explain people to add a .git suffix
to get the right mode for "osc add"
2020-09-01 13:50:18 +02:00
Marco Strigl
5bf40aa9a4
Merge pull request #830 from adrianschroeter/owner
maintainer search: lookup via package name by default and binary as fallback
2020-09-01 13:25:21 +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
bf7899da83
Ignore signal.SIGWINCH.
Fixes #584
2020-08-27 16:56:36 +02:00
Marcus Huewe
a57b8a60b2 Merge branch 'help-rdiff-p-in-archives' of https://github.com/JanZerebecki/osc
Improve the documentation of the "rdiff" command + its "--plain" option.
2020-08-25 18:44:56 +02:00
294aaa0dd7
help rdiff: -p shows diff of files in archives
This was undocumented.

Also remove the part that incorrectly says this is the default.
2020-08-25 18:14:02 +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
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
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
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
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
1d26cb3079 Merge branch 'ccache' of https://github.com/sjamgade/osc
Add "--ccache" option to "osc getbinaries".
2020-05-27 16:09:06 +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
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
Marcus Huewe
6b5b0fd55d Merge branch 'fix_help_depends_on' of https://github.com/lethliel/osc
Split dependson and whatdependson into two commands. This way, both
commands are part of "osc --help".
2020-05-19 12:56:55 +02:00
lethliel
798e3e4f63 split dependson/whatdependon in two commands
split the code of do_dependson into two separate commands (just for
the osc help overview)

They are doing the opposite of each other.

Duplicate code was moved to _dependson()

do_whatdependson and do_dependson just call _dependson with an option
reverse set to None or 1.
2020-05-19 12:50:15 +02:00
12e0b67117 complete --shell-cmd support parts to get it working 2020-05-12 13:16:29 +02:00
5d6351b1bd Support git@ (private github) or git:// URLs correctly 2020-05-05 10:54:43 +02:00
lethliel
9a3fda8471 quote prj, repository, arch and package
quote the arguments before creating the apiurl.
This prevents weird behaviour when any has an '#'
at the end.
2020-04-28 14:47:40 +02:00
Marcus Huewe
33bbc57b5f Fix the previously introduced escaping via the html module
This is a follow-up commit for commit
6dbf103e10 ("Use html.escape instead
removed cgi.escape"), which breaks the python2 backward compatibility
(since the "html" module is not available by default) and also breaks
the code in general (due to missing html imports).

The fix is based on the proposed fix in [1].

Fixes: boo#1166537 ("osc rq accept - forwarding request causes backtrace")

[1] https://github.com/openSUSE/osc/pull/764
2020-03-12 23:00:47 +01:00
6dbf103e10
Use html.escape instead removed cgi.escape
Fixes:

`Traceback (most recent call last):
  File "/usr/bin/osc", line 41, in <module>
    r = babysitter.run(osccli)
  File "/usr/lib/python3.8/site-packages/osc/babysitter.py", line 64, in run
    return prg.main(argv)
  File "/usr/lib/python3.8/site-packages/osc/cmdln.py", line 344, in main
    return self.cmd(args)
  File "/usr/lib/python3.8/site-packages/osc/cmdln.py", line 367, in cmd
    retval = self.onecmd(argv)
  File "/usr/lib/python3.8/site-packages/osc/cmdln.py", line 501, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/usr/lib/python3.8/site-packages/osc/cmdln.py", line 1232, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/usr/lib/python3.8/site-packages/osc/commandline.py", line 1458, in do_submitrequest
    result = create_submit_request(apiurl,
  File "/usr/lib/python3.8/site-packages/osc/core.py", line 4244, in create_submit_request
    cgi.escape(message))
AttributeError: module 'cgi' has no attribute 'escape'
`
`cgi.escape` was deprecated in python 3.2
2020-03-11 16:58:04 +01:00
Matthew D
9ba0d8adcd Fix -n / --name flag on importsrcpkg command.
osc importsrcpkg -n <pacname> does not work.  If the option is supplied, osc
mistakenly trys to "decode" the pac object.  This patch limit the decode
call when pac is not a string.

Refactored fix based on suggestions from marcus-h
2020-02-24 00:23:14 -05:00
Marcus Huewe
32859d6803 Merge branch 'handle-string-conversion' of https://github.com/krig/osc
Add core.parse_meta_to_string helper to work around the insane
implementation of core.meta_exists. Since core.meta_exists may return
a list of bytes, a str, a list of str etc., we ultimately convert the
data to str before passing it ET.fromstring(...).

In case of bytes, the explicit decoding is OK because it is assumed to
be a valid utf-8 encoding (the data represents an xml).

Note: at the moment core.parse_meta_to_string is also called even if it
is not necessary (it is only necessary if the "create" parameter of a
corresponding core.meta_exists call is True).

Note 2: this is just a temporary workaround and, eventually, we will make
the implementation of core.meta_exists more reasonable. When doing so,
we will also remove "public" function core.parse_meta_to_string again.
(Yes, this breaks API but the core.meta_exists change will also break the
API in some sense - so that's OK.)
2020-02-07 10:27:10 +01:00
Kristoffer Grönlund
16a3fcfabf Handle bytes vs. str error when parsing meta (#683)
In all the cases where meta_exists returns either
string data, bytes data or a list, the output needs
to be parsed correctly.

Signed-off-by: Kristoffer Grönlund <kgronlund@suse.com>
2020-02-07 10:02:27 +01:00
Marco Strigl
9449745b5e
Merge pull request #673 from lethliel/fix_non_colon_checkout_on_prj_level
fix checkout_no_colon on project level
2020-02-07 09:27:00 +01:00
lethliel
cf6939e68a fix checkout_no_colon on project level
prj_dir was not altered when issuing osc co on
project level.

Solution: Replace ":" with "/" on project level when
no output_dir is given
2020-02-07 09:21:36 +01:00
Marcus Huewe
4d0c9f2dc6 Merge branch 'print_additional_APIURL_links' of https://github.com/lethliel/osc
Add a "print_web_links" option. If enabled, a webui url is printed after
certain operations. For now, it is only used in "do_submitrequest" in order
to print the webui url that can be used to view the newly created request
(note: the print_web_links option is not considered in the "cd prj; osc sr"
case).
2020-02-06 21:26:20 +01:00
lethliel
f079be17c2 print web url links for creating requests
This will print the direct url to show the created request.
New general bool option 'print_web_links' must be set to enable
this.

Right now this is only for creating requests. More to follow.
2020-02-06 13:57:38 +01:00