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

3383 Commits

Author SHA1 Message Date
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
1385297978 Fix several issues in HTML doc rendering, improve output 2022-03-16 15:19:24 +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
7370b23822 osc can crash due to various exceptions when loading
key management.

Not sure if this is the best way, but make osc usable at all again...
2022-03-16 14:19:01 +01:00
c568cf7b41 support request diffing relative to a former request 2022-03-16 13:57:01 +01:00
Daniel Mach
546991a201
Merge pull request #1010 from Firstyear/format-in-sccache-file-uri
Allow formatting of the sccache uri
2022-03-15 13:23:55 +01:00
Daniel Mach
ade215c071
Merge pull request #460 from JanZerebecki/rm-dead-doc-ref
Remove reference to non existing documentation
2022-03-15 09:56:41 +01:00
Daniel Mach
473b0d4048
Merge pull request #329 from andrewshadura/master
Allow whitespace before ${cmd_name}.
2022-03-15 09:45:24 +01:00
12e2e81703 Check if repos provided to aggregatepac command exist 2022-03-11 09:59:08 +01:00
William Brown
e25682b802 Allow formatting of the sccache uri
This allows a format to be specified in the sccache uri, specifically
the file uri so that a per-package cache can be created. This way
an osc build locally doesn't ruin your cache moving between different
packages.
2022-03-04 14:10:44 +10:00
5c5597432c Support flavors in aggregatepac 2022-03-02 14:38:21 +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
Daniel Mach
ced706080b
Merge pull request #1006 from dmach/getbinaries-multibuild
Fix getbinaries command to fetch also multibuild packages
2022-02-28 16:35:26 +01:00
Daniel Mach
a0388fc6e7
Merge pull request #1004 from dmach/osc-localbuild-hdrmd5
Fix "Error: hdrmd5 mismatch" during local build
2022-02-28 16:34:54 +01:00
e37e144099 Fix getbinaries -M/--multibuild-package option usage 2022-02-28 13:31:51 +01:00
08a70952c0 Skip fetching metadata and logs in the getbinaries command
They have identical names for all downloaded packages
and get overwritten by the last downloaded file.
Unless we dowload them into subdirs or prefix them with package name,
it makes no sense to download them.
2022-02-28 13:09:37 +01:00
fd6634e320 Re-download file from API when hdrmd5 doesn't match 2022-02-28 09:28:32 +01:00
John Paul Adrian Glaubitz
483e07042a Add -F option to osc submitreq
Fixes #1001
2022-02-25 12:01:10 +01:00
d222a38d03 Fix getbinaries command to fetch also multibuild packages 2022-02-23 14:56:02 +01:00
d76ec31ef4 Honor --download-api-only option
Used Marcus Huewe's patch from:
https://github.com/openSUSE/open-build-service/issues/12034#issuecomment-1003051674
2022-02-18 12:00:53 +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
dc253ed212
add build --verbose option for build script
shows kernel messages (only) atm
2022-01-13 11:57:54 +01:00
8d082fae6b No need to ignore SIGWINCH anymore
In normal mode, SIGWINCH is handled by ProgressBar.
In quiet mode, there's no SIGWINCH handler at all.
2022-01-07 13:51:48 +01:00
74671532a7 Fix crash on terminal resize during download 2022-01-03 11:47:33 +01:00
Marcus Huewe
cf8aadc886 Do not fail with a traceback in case of a config error
Do not fail with a traceback if the config file parsing fails.
Hence, catch the configparser.Error exception and print its
"message" attribute to the user.

Fixes: #985 ("Type error on any osc call")
2021-12-19 17:38:22 +01:00
Marcus Huewe
c1134d2f4d Merge commit 'refs/pull/981/head' of github.com:openSUSE/osc
Do not download a bdep with a hdrmd5 from the api by default.
2021-12-15 00:04:41 +01:00
Marco Strigl
6c89e4eb5c
Merge pull request #980 from marcus-h/escape_binary_download_urls
Escape % character in binary download URLs
2021-12-08 11:42:03 +01:00
Marcus Huewe
7da451c87d Do not download a bdep with a hdrmd5 from the api by default
Since a recent backend change, a bdep has a hdrmd5 by default. That
is, osc always downloads these bdeps from the API (unless they are
cached) instead of a mirror. This is not intended.
Using a mirror is no problem because the hdrmd5s are verified in
the build module.
Note: If this causes a problem, one could also use "osc build
--download-api-only" to mimic the old behavior.
2021-12-08 10:41:04 +01:00
Marcus Huewe
c45373faaa Merge branch 'oscrc-symlink' of https://github.com/dmach/osc
If the oscrc is a symlink, follow the symlink when writing the
configuration file. The old code replaced the symlink with a
regular file (see #390 ("symlinked $HOME/.oscrc gets replaced
with a ordinary file")).

Implementation note: if the directory, which contains the resolved
config file, has a <config file>.new file, the file is overwritten.
2021-12-08 10:24:01 +01:00
5ba6bbe0c2 conf: Preserve oscrc symlink
When a user creates a symlink pointing from ~/.config/osc/oscrc
to a different location, don't overwrite the symlink but follow
it when writing configuration on disk.
2021-12-08 08:48:59 +01:00
Marcus Huewe
d549f27ec5 Escape % character in binary download URLs
Without escaping the % character, the download URL could be subject
to string formatting (depending on the subsequent characters). For
instance, if the url attribute's value of a buildinfo's path element
contains the substring "c_c%2B%2B", the "%2B" is interpreted as a
format string (see issue #965), which is wrong ("B" is not a valid
format character at all). In order to avoid this, escape all
% characters in the download urls.
Note: escaping the % characters in the download url itself is OK
because we only intend to "format" the path.

Note: we do not escape the % characters for urls from the config
file (implicit assumption: the user already correctly escaped the
urls (whether this assumption is sensible or not is debatable, of
course)).

Fixes: #965 ("unsupported format character 'B' (0x42) at index 66")
2021-12-07 20:44:48 +01:00
f3a9ef6446 build: Fix printing paths to built debian packages 2021-12-07 09:17:55 +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
b8482bfab3 Osc.postoptparse only returns if the get_config call succeeds
The old code passes try_again=False to the recursive postoptparse
call when calling it from one of the exception handlers. This is
wrong because it can result in an incomplete conf.config dict (for
instance, if two apiurl sections have no user and no password and
no credentials_mgr_class option - see #761 ("Traceback config with
two backends and no username")).
Hence, Osc.postoptparse should only return if the conf.get_config
call succeeds. For this, unconditionally call Osc.postoptparse from
within the exception handlers. Note: this could potentially (although
quite unlikely) result in an endless recursion but in each recursive
call "user" interaction is required (that is, the user could simply
press CTRL+c) - so this should not be a problem.

Implementation note: this change breaks the API. Rationale: the
semantics of Osc.postoptparse changed. Hence, "pretending" to
honor the try_again parameter could result in unexpected behavior
(from the API consumer's POV). Hence, a traceback might be more
sensible.

Fixes: #761 ("Traceback config with two backends and no username")
2021-11-23 15:34:48 +01:00
Marcus Huewe
d3e9ff739a Merge branch 'zstddeb' of https://github.com/adrianschroeter/osc
Support a zst compressed control.tar in debquery.DebQuery. A zst compressed
control tar is used, for instance, in Ubuntu 21.10.
Note: this requires the 3rd-party python-zstandard module.
2021-10-26 21:10:29 +02:00
fe311c7ae5
support zst compressed control files in deb archives
eg. some packages Ubuntu 21.10
2021-10-26 07:29:43 +02:00
William Brown
d56a46b669 Improve logic for conffile mode handling 2021-10-25 09:34:16 +10:00
4d7dd3d46c
fix hdmrd5 check of local cached files
Current OBS is delivering hdrmd5 in buildinfo. It turns out
that osc has already code for validating cached files, but it
invalidates all local files atm with python 3.x
2021-10-19 16:01:24 +02:00
b5d337d037
fix hdmrd5 check of local cached files
Current OBS is delivering hdrmd5 in buildinfo. It turns out
that osc has already code for validating cached files, but it
invalidates all local files atm with python 3.x
2021-10-12 10:54:20 +02:00
Marcus Huewe
b6f69180e2 Merge branch 'fix_mr' of https://github.com/adrianschroeter/osc
Do not create an MR for the entire project if "osc mr" is invoked in
a package wc (only create an MR for the specific package instead).
Strictly speaking, the "breaks" the existing UI - but this rather seems
to be a "fix" than a "break";)
2021-10-11 16:05:06 +02:00
Marcus Huewe
26aea786da Merge branch 'improve_URLError_msg' of https://github.com/marcus-h/osc
Improve error message in case of an URLError.
2021-10-11 16:03:26 +02:00
2b278e7226
avoid sending entire projects on "osc mr"
We may have a package working directory, so we should only put this into
request and not entire project.
2021-10-08 17:13:53 +02:00
2b1c04757b
Merge pull request #952 from adrianschroeter/fix_download
fix downloading from mirrors
2021-10-06 13:22:48 +02:00
3b90480dfc
fix downloading from mirrors
Some of our repositories have specific download urls. osc is ignoring
this so far and just tries to use the generic downloadurl

This code prefers definitions for individual path elements if they exist.
We could IMHO remove the old code, since old OBS instances would still
work via the api download fallback.

Real life examples for repo specific configs are on openSUSE all
repositories outside of the /repositories/ directory. eg.

  <path project="openSUSE:Tumbleweed" repository="dod" url="http://download.opensuse.org/tumbleweed/repo/oss/"/>

Co-Author: Marcus Hüwe <suse-tux@gmx.de>
2021-10-06 13:16:40 +02: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
0285986f52 Handle missing os.sysconf more gracefully
os.sysconf is not available on all platforms (like Windows) but it
is used to retrieve the number of online processors. If missing,
assume one processor (building on such a platform will most likely
not work, though).

Fixes: #948 ("Windows compatibility") (at least it improves the
Windows support a bit)
2021-09-03 10:41:43 +02:00
Marcus Huewe
a7bdd67e92 Merge branch 'token_workflow_operation' of https://github.com/marcus-h/osc
Small do_token cleanup + support creation of a workflow token.
2021-09-02 15:12:23 +02:00
Marcus Huewe
2d43ea59dd Merge branch 'metafile_edit_support_force' of https://github.com/marcus-h/osc
Offer a force ("f") choice in metafile.edit's error handling code path.
2021-09-02 15:10:39 +02:00
Marcus Huewe
d38d6a53a4 Add support for creating a workflow token via "osc token"
A workflow token can be created via "osc token --create --operation
workflow --scm-token <SCM_TOKEN>".
Triggering a workflow token via osc is probably unlikely - that's
why it is not yet implemented (it would also make the UI a bit
awkward because one has to specify a concrete http header).

Fixes: #943 ("implement osc token --operation=workflow")
2021-08-26 11:05:02 +02:00
Marcus Huewe
9eea35eda0 Use makeurl instead of manual URL construction in do_token
The use of makeurl makes the code more readable/maintainable (IMHO)
and it also does proper percentage encoding of the query string (not
that the osc codebase cares much about it, though:/).
2021-08-26 10:46:57 +02:00
Oleg Girko
fd5483c3a2 Fix XPath used in search requests.
Newer rexml Ruby gem used on OBS server side uses stricter XPath parsing.
This change fixes incorrect XPath that was accepted by older rexml,
but not accepted by newer one.

Signed-off-by: Oleg Girko <ol@infoserver.lv>
2021-08-25 19:46:23 +01: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
ebcf3de6ab Merge branch 'xdg-cookiejar' of https://github.com/hyperupcall/osc
Store the cookiejar file in a location that is compliant with the
XDG base directory specification (unless ~/.osc_cookiejar exists).
2021-08-16 20:30:49 +02:00
Edwin Kofler
a557f01c9f
fix: '.osc_cookiejar' creation adheres to XDG Base Directory Specification
The order is now:
- ~/.osc_cookiejar, if it exists
- $XDG_STATE_HOME/osc/cookiejar if XDG_STATE_HOME neither null nor empty
- ~/.local/state/osc/cookiejar
2021-08-16 00:55:42 -07:00
Marcus Huewe
3ed9325a15 Merge branch 'Issue_936' of https://github.com/e4t/osc
Do not try to run source services when building in a non package wc. This
is the behavior we had prior commit c39c3b8cae
("Cleanup the source services execution code in do_build").
There is no "sane" way to execute the source services in case of a
non package wc build because we cannot export the OBS_SERVICE_PACKAGE
env variable with a meaningful value.

Fixes: #936 ("'osc build --local-package ...' fails with 'not an osc
package working copy'")
2021-08-14 16:15:47 +02:00
Edwin Kofler
afd5b27196
fix: XDG_CONFIG_HOME no longer used if empty
Previously, if XDG_CONFIG_HOME was defined as an empty string, it
was used. Now, if XDG_CONFIG_HOME is an empty string, `~/.config` is
used instead
2021-08-13 15:55:48 -07:00
b61b79cf85 Don't run source services when building outside of an OSC package working copy
When building a package from a directory that is not a checked-out
OBS working, the error message:
"Error: "<directory>" is not an osc package working copy."
is generated.
This occurs when build.main() attempts to run source services which
is probably not a good idea as these are part of the core.Package
infrastructure which cannot be initialized for such packages.

It is probably best to disable the source services in this case.
See Issue#936.

Suggested-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Egbert Eich <eich@suse.com>
2021-08-08 18:20:30 +02:00
Marcus Huewe
d7dbd1bc0b Do not crash when running "osc search --binary --verbose foo"
The old code does not support the --binary option in combination
with the --verbose option. Specifying --binary and --verbose at
the same time results in a crash (because the binary listing
contains no <title>...</title> element).
In order to fix this, do not try to access a <title>...</title>
element when --binary and --verbose are both specified. Instead,
in this case, include information about the repo, arch, version,
and release of the corresponding binary element.

Fixes: #933 ("osc se -v -B crash")
2021-07-30 21:05:05 +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
6b83134377 Merge branch 'config_select_password_store' of https://github.com/marcus-h/osc
Add support for changing the password store via "osc config" + a small
bugfix in the "osc config -d <apiurl> pass" codepath.
2021-07-21 10:31:47 +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
fd4d8d726a Fix typo in the password deletion codepath in conf.config_set_option
A password can be deleted via "osc config -d <apiurl> pass". Actually,
if we really want to support password deletion, we should introduce
a --delete-password option because the "pass" config option can be
considered as an implementation detail, which we should not expose
to our users.
2021-07-14 11:31:56 +02:00
Marcus Huewe
7e23743239 Add support for changing the password store via osc config
The password store can be changed (without entering the password
again) via "osc config <apiurl> --select-password-store". This
command deletes the password from the current password store and
stores it in the selected password store.

Previously, the --select-password-store option had no meaningful
semantics. In order to use it, one always had to provide a password
and explicitly pass "pass" as the config option (the same could be
achieved by using --change-password). Hence, in a strict sense,
this change breaks the UI.
2021-07-14 11:28:57 +02:00
Marcus Huewe
0963bc690f Slash split arguments in do_browse
Without the slash splitting, "osc browse prj/pkg" interprets the
argument as a project, which is wrong. Hence, perform the slash
splitting (as most commands do).
2021-07-13 15:57:58 +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
90d9402a05 fix local product builds using obsrepositories:/ directives
We need an absolute path since osc calls build in user home directory.

Also extend the file name to hint to osc (and not any service
configuration)
2021-06-28 09:26:27 +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
209686a16f support cross compile using a sysroot
We need to hand over the sysroot rpms in rpmlist with a prefix. And we
need to take care of the "crossarch" definition in buildinfo
2021-05-18 07:57:02 +02:00
William Brown
c12e0b5cda Add support for sccache.
Sccache is an alternate build caching system to ccache/icecream. It
supports C, C++ and Rust. It can optionally have distributed or remote
caches via redis, s3 object stores, memcached, azure storage or
google cloud storage.

This can help to significantly improve the performance of Rust rebuilds.

For example, Kanidm changes from 400s to 122s on a rebuild, and rust-lang
rebuilds improve from 7200s to 4770s. With some changes to the rust
packages especially this will be possible to speed up over version
changes as well.

See also: obs-build PR https://github.com/openSUSE/obs-build/pull/680
2021-05-14 12:57:40 +10:00
Marcus Huewe
1e94757498 Merge branch 'build_as_user' of https://github.com/adrianschroeter/osc
Do not use a preinstallimage if the local build is executed as a non-root
(the preinstallimage contains device nodes which usually cannot be created
by a non-root user - this is not a problem in the non-preinstallimage
codepath (see [1])).

[1] https://github.com/openSUSE/osc/pull/908#issuecomment-806903856
2021-04-28 16:55:34 +02:00
08979fb0eb do not use preinstallimages when building as non-root
it can not work and build script will direct complain in future
2021-04-28 16:53:17 +02:00
6632ca2d2e support _keyinfo route with signkey command by default 2021-04-28 13:42:06 +02:00
Pedro Monreal
67ac287f55 Adjust the description size of 'osc service run' 2021-04-28 12:11:56 +02:00
320adda399 simpleimage uses OTHER directory to deliver files 2021-04-26 08:02:38 +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
3c9ee7545e Merge branch 'remove_etree_getchildren' of https://github.com/marcus-h/osc
Do not use the deprecated Element.getchildren anymore.
2021-03-28 21:10:30 +02:00
6ac7855f4d remove "need root" autodetection
This kind of guessing can not really work here and leads to failing
builds when using KVM. (eg. when using a preinstallimage)

Removing the code, since we have a now a way to allow the user to
specify building as user via su-wrapper config
2021-03-25 09:06:48 +01:00
Marcus Huewe
4e9dde71b8 Merge branch 'build-as-user' of https://github.com/adrianschroeter/osc
Allow a local build as the current user/support an empty su-wrapper
config option.
2021-03-22 15:22:13 +01:00
4907982d42 allow to run build script as user
works only with kvm atm, we should maybe point the user to it in that
case?

Requires: https://github.com/openSUSE/obs-build/pull/678/files
2021-03-22 15:16:35 +01: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
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
fc7d3d91fc Merge branch 'creq_slash_split' of https://github.com/marcus-h/osc
Support slash notation in "osc creq -a <action type> args".
2021-02-01 23:06:57 +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
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
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
ca080d2118 add --lastsucceeded option also for buildlog command
introduce --last-succeeded alias
2021-01-18 10:21:58 +01:00
9ad555ee24 mention flatpack as well 2021-01-18 10:21:50 +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
745dc1180d Merge branch 'fix__html_escape_usage' of https://github.com/marcus-h/osc
Avoid superfluous/excessive usage of _html_escape.
2020-12-05 19:26:59 +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
b647521f81 Support a regex based name filtering in core.get_prj_results
So far, core.get_prj_results only supports a substring based name
filtering mechanism. Now, a regex based name filtering mechanism
is used. That is, if the regex matches a package name, the package
is not filtered out.

This is an API incompatible change:
- 3rd party code which looks like this is going to break:
  class Foo(str):
      ...
      def __eq__(self, other):
          return ...

  ... = core.get_prj_results(..., name_filter=Foo())

  (My gut feeling says there are no such callers. However, if this
  really breaks any serious code, we can fix it in a follow-up commit)

- "osc prjresults openSUSE:Leap:15.2:Update --name-filter zypper." will
  now also show "zypper-docker" etc. because the dot (".") matches any
  character (except a newline). Previously, only packages that contained
  the str "zypper" followed by a dot (".") were shown. The old behavior
  can be restored, if the dot is escaped: "osc prjresults
  openSUSE:Leap:15.2:Update --name-filter 'zypper\.'".
  Of course, this affects all other special characters, too.
  Additionally, if an illegal regex is passed to the --name-filter option,
  an exception is raised. The previous code did not fail.

  This can break existing workflows and scripts. We could avoid this by
  introducing a --name-filter-regex option but this would clutter the
  UI (IMHO).

A regex based name filtering feature was requested by darix.
2020-11-25 22:51:02 +01:00
Marcus Huewe
1933da5bcc Use os.getcwdb() instead of os.getcwd().encode() in util.cpio.CpioRead
Using os.getcwd() in combination with a subsequent .encode() is error
prone:

marcus@linux:~> mkdir illegal_utf-8_encoding_$'\xff'_dir
marcus@linux:~> cd illegal_utf-8_encoding_$'\xff'_dir/
marcus@linux:~/illegal_utf-8_encoding_ÿ_dir> python3
Python 3.8.6 (default, Nov 09 2020, 12:09:06) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd().encode()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 36: surrogates not allowed
>>>

Hence, use os.getcwdb(), which returns a bytes, instead of
os.getcwd().encode().

Fixes: commit 36f7b8ffe9 ("Fix a
potential TypeError in CpioRead.copyin and CpioRead.copyin_file")
2020-11-22 17:39:54 +01:00
Marcus Huewe
674ea78815 Avoid a potential TypeError in util.ArFile.saveTo
If no dir is passed to util.ArFile.saveTo, dir is set to os.getcwd(),
which returns a str. Since self.name is a bytes, the subsequent
os.path.join(dir, self.name) results in a TypeError.
To fix this, use os.getcwdb(), which returns a bytes instead of a
str.
2020-11-22 17:36:17 +01:00
Oleg Girko
74846ea83b Add support for nspawn VM type.
This allows to utilise support for systemd-nspawn backend in build engine.
Like LXC, systemd-nspawn creates isolated lightweight container.

Signed-off-by: Oleg Girko <ol@infoserver.lv>
2020-11-22 14:34:37 +00:00
Marcus Huewe
36f7b8ffe9 Fix a potential TypeError in CpioRead.copyin and CpioRead.copyin_file
If no "dest" argument is specified when calling CpioRead.copyin or
CpioRead.copyin_file, a TypeError occurs in CpioRead._copyin_file
because os.getcwd(), which returns a str, is used as dest and, hence,
the subsequent os.path.join(...) fails (because it tries to join a
str and a bytes).
In order to avoid this, encode the result of os.getcwd().

Note that the existing

archive.copyin_file(hdr.filename,
                    os.path.dirname(tmpfile),
                    os.path.basename(tmpfile))

was OK because CpioRead._copyin_file os.path.join()s "dest" and
"new_fn", which are both str. It is just changed to stress that
CpioRead is a bytes-only API.

Fixes: #865 ("Traceback in osc/util/cpio.py line 128: TypeError:
Can't mix strings and bytes in path components")
2020-11-20 09:55:09 +01:00
Anatoli Babenia
48e8a1e802 Pretty print dists table with two spaces between columns 2020-11-14 19:45:29 +03:00
Anatoli Babenia
c000e0e372 Simplify looping over /distributions XML 2020-11-14 18:31:03 +03: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
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
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
Bernhard M. Wiedemann
c3522dbb28 Use verifymd5 to determine freshness
to speed up osc up for large repo checkouts by a factor of 10 or more

The verifymd5 value is not (yet) stored
so we quickly compute it as needed

https://github.com/openSUSE/open-build-service/issues/10250
2020-10-17 21:14:12 +02: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
lethliel
8085aa6012 use sr_ids[0] for superseding
result is not assigned in the case of many packages per request
2020-10-05 19:53:45 +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
lethliel
eaf50dd13d add proper reporuls
for use in Arch, Debian and Ubuntu
2020-09-22 08:52:57 +02:00
Marcus Huewe
e58abf1527 Support a preinstallimage in combination with the --offline option
Currently, if the --offline option is passed to "osc build ...", a
preinstallimage is not used (even if it exists). Instead, a
preinstallimage should be used (if it exists) even if the --offline
option is specified.
2020-09-07 18:54:59 +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
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
Kevin Tee
783544d2da
Update build.py
Fix repeated word.
2020-07-26 11:57:18 +00: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
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