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

3964 Commits

Author SHA1 Message Date
Andreas Hasenkopf
dba77a315b CI pipeline: Skip cleanup prior to deployment
Deployment via Travis CI failed due an error during
cleanup (#884):

`Could not restore untracked files from stash entry`

Disabling the cleanup fixes this problem.
2020-12-28 10:25:37 +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
e06c633798 Merge branch 'fix__submit_request_id_return' of https://github.com/marcus-h/osc
Only return request ids in Osc._submit_request in order to avoid a
TypeError in the caller when processing the results.
2020-12-22 16:06:37 +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
5428c09cd7 Merge branch 'use_getcwdb' of https://github.com/marcus-h/osc
os.getcwd() fixes:
- Fix a potential TypeERror in util.ArFile.saveTo.
- Avoid error prone use of os.getcwd().encode() in util.cpio.CpioRead.
2020-12-01 13:20:12 +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
Marcus Huewe
926c2eb422 Merge branch 'support-nspawn' of https://github.com/OlegGirko/osc
Support "osc build --vm-type=nspawn". Without this change build_root
is changed to "build_root/.mount", which results in an invalid name
for systemd-nspawn (see build-vm-nspawn in the obs-build codebase).
Now, --vm-type=nspawn behaves the same as --vm-type=lxc wrt. option
passing to the build script and package signature checking.
2020-11-22 17:09:47 +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
Marco Strigl
5e313ed485
Merge pull request #866 from marcus-h/cpio_bytes_fix
Fix a potential TypeError in CpioRead.copyin and CpioRead.copyin_file
2020-11-20 11:43:11 +01: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
Marcus Huewe
558efce0fd Merge branch 'master' of https://github.com/mlschroe/osc into master
Initial support for flatpak. Note that this requires a recent obs-build
version.
2020-11-12 19:52:36 +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
Marcus Huewe
699827d091 Merge branch 'checkRevision_meta_mode' of https://github.com/marcus-h/osc into master
Fix show_upstream_rev call in checkRevision in the meta=True
case.
2020-10-27 01:08:23 +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
4ee9c1ad38 Merge branch 'fix_readme' of https://github.com/dcermak/osc into master
Fix bugzilla URL. Alternatively, we could also directly point to
https://github.com/openSUSE/osc/issues/new.
2020-10-14 21:05:11 +02:00
3956abbd3c
Replace link to novell Bugzilla with openSUSE's Bugzilla 2020-10-14 17:02:34 +02:00
Bernhard M. Wiedemann
f59dd4f9f8 Use python3 in osc-wrapper
because python2 is obsolete
and we dont want to install python2-m2crypto and other deps
just for development
2020-10-14 04:52:10 +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
Marco Strigl
7b5d105523
Merge pull request #841 from lethliel/add_proper_repourls
add proper reporuls
2020-09-22 11:55:33 +02:00
lethliel
eaf50dd13d add proper reporuls
for use in Arch, Debian and Ubuntu
2020-09-22 08:52:57 +02:00
Daniel Ziltener
835e035799
Make python3 explicit 2020-09-19 23:28:30 +02:00
Daniel Ziltener
3b401e2585
Make python3 explicit 2020-09-19 23:28:12 +02:00
3cb40c51b1
Merge pull request #836 from marcus-h/preinstallimage_offline
Support a preinstallimage in combination with the --offline option
2020-09-08 09:06:46 +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
Marco Strigl
1649fe47df
Merge pull request #834 from adrianschroeter/github_hack
catch URLs to github.com and gitlab.com as git repos
2020-09-01 14:10:16 +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
Marco Strigl
d3acec44e3
Merge pull request #833 from mcepl/ignore_SIGNWINCH
Ignore signal.SIGWINCH.
2020-08-31 10:38:07 +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
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