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

1530 Commits

Author SHA1 Message Date
Marcus Huewe
5756e90b90 Merge branch 'fix_decoding_in_osc_cat' of https://github.com/lethliel/osc
Do not perform any decoding in do_cat.
2019-09-18 16:36:00 +02:00
lethliel
6f674a6289 do not decode diff before passing it to run_pager
run_pager will take care of the bytes-like object and
will directly write it to sys.stdout.buffer.write() or
NamedTemporaryFile.
2019-09-18 11:26:16 +02:00
lethliel
d1d45f4618 fix decoding for osc cat
use sys.stdout.buffer.write() to print encoded data
correctly
2019-09-18 10:49:39 +02:00
Marco Strigl
1e4e7edad5
Merge pull request #446 from lethliel/add_error_for_issue_445
print error and exit if p.apiurl != -A <apiurl> using osc sr
2019-09-17 14:11:20 +02:00
Marco Strigl
035457cc26
Merge pull request #630 from lethliel/fix_decoding_on_lbl
decode data on osc lbl
2019-09-12 12:27:42 +02:00
lethliel
ee64437521 decode data on osc lbl 2019-09-12 10:41:26 +02:00
Mike Gorse
ef1c605a32 Initialize diff as bytes
Otherwise, python 3 will throw a traceback if the fallback code is
triggered, since it appends bytes.
2019-09-11 10:05:32 -05:00
Marcus Huewe
749f994465 Merge branch 'simplify_sr_on_prj_level' of https://github.com/lethliel/osc
Simplify the project sr handling in do_submitrequest a bit. It also fixes
a bug in case a target project and --separate-request is specified.
Other bugs are retained for now (for instance, --update-link is ignored).
2019-08-30 10:52:52 +02:00
lethliel
3da7b9b3d8 simplify osc sr code in submitting prj
Most of the stuff is now done in the API.
For just submitting all in one request the following is sufficient:

<action type="submit"> <source project="%s" /> %s </action>

If a target project is given it looks like this:

<action type="submit"> <source project="%s" /> <target project="%s"> %s </action>

We don't need package name or source package and targets anymore.
This is all handled by the API now.

For the --seperate-requests case the check for the entries in the linkinfo
is not working on most cases. So we handle this in the do_submitrequest
and skip the package if X-Opensuse-Errorcode is missing_action which means
basically nothing to do for this package

redesign target_project handling
2019-08-30 10:42:08 +02:00
lethliel
74c70620b7 Add project parameter to print_repos
This is needed if the project differs from the current
working copy.

Fixes https://github.com/openSUSE/osc/issues/623
2019-08-30 10:32:02 +02:00
Marcus Huewe
e7397221b3 Add --change-password example to the help text of do_config
This should have been part of commit
cba4b58bbe ("Improve password
handling").
2019-08-29 16:42:09 +02:00
lethliel
cba4b58bbe Improve password handling
* Adapt do_config to use the new credentials manager implementation
  and add a --change-password option which can be used to change the
  password.
* Adapt config_set_option to follow the change in do_config.
* Split selection of the credentials manager descriptor to reuse it
  in do_config and interactive_config_setup.
* Introduce new ConfigMissingCredentialsError which is raised in case
  of missing credentials (user or password). In this case the user will
  be asked to enter the new credentials.
2019-08-29 16:11:17 +02:00
lethliel
428a81e451 Refactor config setup dialog
Move logic to conf module in new function interactive_config_setup
for new config file and missing apiurl section.

Dropped keyring code, because it was never used in write_initial_config()
2019-08-26 17:25:56 +02:00
Marcus Huewe
63c103770a Merge branch 'fix_600_osc-h_not_working_with_plugins' of https://github.com/lethliel/osc
python3 "workaround" for the quite fragile code in
RawCmdln._help_preprocess: It depends on the "non-deterministic" order
of preprocessor.items(). Hence, the results may differ on python2 and
python3. The real fix is probably to enforce a fixed iteration order.
See also the discussion in [1].

[1] https://github.com/openSUSE/osc/pull/604
2019-08-03 16:20:01 +02:00
lethliel
c78c8178e6 prevent plugins to break help
prevent call of preprocessor if ${cmd_name} marker is accidentaly set,
but cmdname is None.

Also for cmd_option_list and cmd_usage
overwrite _help_preprocess_* functions in Osc class
2019-08-02 20:02:14 +02:00
Marcus Huewe
6e95f8019d Merge branch 'fix_#607' of https://github.com/lethliel/osc
Do not apply the --target-package-filter pattern if there is no target
package.
2019-08-02 13:31:53 +02:00
Marco Strigl
d2de7ccc97
Merge branch 'master' into maint_enforce_branch 2019-07-25 13:46:18 +02:00
f465717668 allow implicit branch on maintenance request creation
via --enforce-branching option

This may be default by server side settings
2019-07-25 13:43:45 +02:00
Marcus Huewe
71ae93b35a Merge branch 'switch_diffs_to_bytes' of https://github.com/lethliel/osc
Since we do not know the files' encoding, the diff functions/methods
have to return bytes. Note: decoding the diff result is wrong in
general (see the discussion in [1]).

[1] https://github.com/openSUSE/osc/pull/554
2019-07-24 14:45:23 +02:00
lethliel
2b47be6b1e switch to difflib.diff_bytes in python3 case.
The files are now opened as rb for diffing. In python2 nothing changes.
In python3 the returned diff is bytes now.

The following changes were made:
  * commandline.py: The returned diff is now bytes
  * get_diff now returs the diff as a bytes-like object
  * run_pager writes with sys.stdout.buffer.write if message
    is not a string
  * for the commit message the returned diff needs to be decoded
    now. Otherwise it will just producce garbage. For the commit
    message the diff on decoded bytes-objects is ok. (nothing harmfull
    can happen here)
  * fixed submit_action_diff
  * fixed request_interactive_review
2019-07-24 13:48:39 +02:00
lethliel
0c0dca0b27 Fix package filtering for osc rq
Check if action.tgt_package is None.
2019-07-23 15:51:41 +02:00
lethliel
cc44dded85 Do not decode output from osc api calls
Do not guess the decoding of the returned output on osc api calls.
This could lead to unexptected behavior. Just use sys.stdout.buffer.write()
to print the bytes-like object in python3.
2019-07-19 08:44:57 +02:00
lethliel
49b0325ab0 fix error when f.size is None but f.mtime is not
The if statement just catches the case when both (f.size
and f.mtime) are None.

Added two elifs to catch the cases that just one of them is None.
2019-07-11 13:43:22 +02:00
lethliel
682452d914 [python3] fix osc lbl non utf8 encoding
data can contain non-utf8 chars. So passing data to
the decode_it function will solve this problem.
2019-06-21 10:13:31 +02:00
Marco Strigl
7df178b50b
Merge pull request #552 from lethliel/fix_unhandled_exception_on_empty_package
fix triggerreason on empty packages.
2019-06-12 13:07:16 +02:00
Marcus Huewe
a72d90a7af Merge branch 'priorize-command-typo' of https://github.com/sknorr/osc
Spelling and grammar fixes.
2019-05-29 23:13:27 +02:00
6eac27ec1c support different token operations (runservice, release and rebuild) (requires OBS 2.10) 2019-05-27 14:50:34 +02:00
Stefan Knorr
4c16177ada Random drive-by typo fixes for osc command-line messages 2019-05-27 11:54:42 +02:00
Marcus Huewe
0c9c616bd8 Merge branch 'master' of https://github.com/andreas-schwab/osc
Decode data in do_token before printing it.
2019-05-25 23:14:41 +02:00
Marcus Huewe
c4dd37936f Merge branch 'fix_offline_mode_for_build' of https://github.com/lethliel/osc
Do not make a http request if noinit is True in parse_repoarchdescr.
2019-05-25 23:10:49 +02:00
Stefan Knorr
b14c9cfd92 Add "prioritize" as (preferred) alias for "priorize" command
"priorize" is not an English word, "prioritize" is the correct
version:
* https://www.merriam-webster.com/dictionary/priorize
* https://www.merriam-webster.com/dictionary/prioritize

The "priorize" command will continue to exist after this commit, but the
documented  version will be "prioritize".
2019-05-24 13:22:30 +02:00
Andreas Schwab
7ed9ff32ad osc token: decode data from trigger url 2019-05-23 09:53:05 +02:00
lethliel
178dfd16c3 fix offline build mode
The offline mode does not really work offline since
parse_repoarchdescr() uses get_buildconfig to store the
buildconfig in a temporary file.

Solution:

Use the same logic as in build.py. If in offline mode(noinit = True)
try to use the local _buildconfig file. If not in offline mode just
download the buildconfig from the server via get_buildconfig
2019-05-22 13:58:46 +02:00
lethliel
260d5f585a fix outupt of status on attribute deletion
On osc meta attribute --attribue <name> --delete the returned
data is encoded. Therefore the sys.stdout.write(data) call fails.

Solution: Decode data

--> sys.stdout.write(decode_it(data))
2019-05-22 12:57:02 +02:00
lethliel
860548bc30 fix getbinaries in commandline (progress_meter)
change progress_meter = opts.quiet to
progress_meter = not opts.quiet
2019-05-16 15:21:16 +02:00
lethliel
877d5e50b6 fix triggerreason on empty packages.
When running osc triggerreason on newly created (empty) packages
the command failes with AttributeError: 'NoneType' object has no attribute 'text'
because root.find('explain') is NoneType.

Solution:

Check if root.find('explain') is None and print "No triggerreaseon found".
In this case also do not try to get the triggertime. It will result in the same error.
2019-05-15 11:45:20 +02:00
3886b95ae4 [python3] release command: fix exception on missing bytearray/str decode 2019-04-25 22:28:19 +02:00
Marco Strigl
fc8e6f8695
Merge pull request #529 from lethliel/python3_fix_bsc1131512
[python3] return value when adding attrs is bytes
2019-04-16 15:41:10 +02:00
lethliel
d10c9b4cea [python3] fix sorting when using osc se
osc se did not sort the output anymore. The logic
in the existing results.sort(key=...) was wrong. Now it is using
key=itemgetter(0,1) has two columns and key=itemgetter(0) if there
is only one column.
2019-04-16 15:18:04 +02:00
lethliel
b7dea9ddcd [python3] return value when adding attrs is bytes
When adding attribute with osc meta attribute <prj> -a <attr> -s '<val>'
the api call gets executed successfull but the return value needs to be
decoded to print it correctly.
2019-04-16 14:57:19 +02:00
lethliel
fe642db042 [python3] python3 support for commandline module
* use cmp_to_key from functools for python 2.7 and higer
* use self written cmp_to_key for python 2.6
* a lot of bytestring handling and decoding
2019-04-12 09:58:23 -05:00
Marcus Huewe
c39c3b8cae Cleanup the source services execution code in do_build
Always error out if the source services execution failed (the old
code only errored out if the local_service_run config option was
set (this behavior was probably unintentionally introduced in commit
d3dd8539d9 ('- fallback to "build
--local-package" if it does not exist instead of complaining'))).
Also, do not suppress all exceptions (if something failed in the
services execution code path, the user should be informed).

The bug was reported by darix.
2019-02-22 15:42:23 +01:00
lethliel
0ab8661a8b reworked deleterequest commit (add --all)
* removed superfluous parenthesis
* switched package == None to package is None
2019-02-04 14:56:20 +01:00
Marco Strigl
4b4774872e
Merge pull request #509 from adrianschroeter/deletereq
deleterequest for entire projects needs the --recursive option as add…
2019-02-04 14:52:25 +01:00
a760e2bd39 Return exitcode when "osc results" is falling through prjresults
Otherwise a failure from osc prjresults does not propagate
up.
2019-02-04 13:07:59 +01:00
677c741189 deleterequest for entire projects needs the --all option as additional protection
We had it two times this week that people dropped entire projects
(important ones)
2019-02-04 11:54:03 +01:00
Marcus Huewe
fefd7c1dea Move vc env exporting code into core.vc_export_env
This allows for reuse. In the future, these variables should also
be exported when executing source services.
2019-01-29 14:20:12 +01:00
lethliel
93d15fc83b reworked meter.py based on discussion
* new function create_text_meter with fallback selection
* NoPBTextMeter.start() will print the basename (if not stated otherise with
  basename = None)
* The callers that should use an alternare TextMeter class now call create_text_meter()
* The callers that should not use and alternate TextMeter (because of different handling,
  like build.py) call create_text_meter(use_pb_fallback=False)
* the warning 'Please install the progressbar module' is now only shown once

improvements
2019-01-16 11:39:40 +01:00
lethliel
8b3c2bd61a improve handling of missing progressbar module
With the NoPBTextMeter class the build view gets broken.
Old view:
1/11 (repo) filename

new view:
Please install the progressbar module...
Please install the progressbar module...
Please install the progressbar module...

With this commit the old behavior is restored.

The getbinaries call now lists the file he downloads instead of just
stating "Please install the progressbar module..." several times.
(but only if not called with the option quiet)
2019-01-11 10:16:02 +01:00
Andreas Schwab
51812b7e93 Don't crash if can_also_build does not contain hostarch 2019-01-04 19:39:18 +01:00
Marcus Huewe
aa88b6b795 Merge branch 'prjresults-watch' of https://github.com/JanZerebecki/osc
Add "--watch" option to "osc prjresults" ("--watch" can only be used
in combination with "--xml").
2018-11-06 16:44:50 +01:00
5e03ffcec9
Add --watch for osc prjresults --xml
Like: osc results --watch
2018-11-06 15:13:08 +01:00
Marcus Huewe
e5478e2ff6 Merge branch 'release-no-delay' of https://github.com/JanZerebecki/osc
Add --no-delay option to the "osc release" command.
2018-11-01 20:07:57 +01:00
Marcus Huewe
d5dd5708d5 Merge branch 'add_alternative_project_to_buildinfo' of https://github.com/lethliel/osc
Add --alternative-project option to the "osc buildinfo" command.
2018-11-01 20:04:04 +01:00
Marcus Huewe
bec52a7917 Merge branch 'python3_prep' of https://github.com/lethliel/osc
Get rid of the urlgrabber dependency. The current implementation of the
progress bar is quite "noisy" if the line length exceeds the size of
the terminal window, but that's something we could fix later. (The
superfluous error message will be fixed in a subsequent commit.)
2018-11-01 19:55:07 +01:00
fb80026651
Add --no-delay for osc release
This is useful so one can wait with a following osc prjresult until
everything done. Without this one can not know if a release job hasn't
started yet or is already finished.
2018-10-31 03:45:17 +01:00
Andreas Schwab
1fab61c875 Fix help for osc token 2018-10-25 10:20:16 +02:00
Marco Strigl
92d15b2d95 add --alternative-project option to buildinfo
to be consistent with osc build
2018-10-23 20:27:43 +02:00
lethliel
65b053abb3 replace urlgrabber to enable python3 compatibility
- new module grabber.py
  * OscMirrorGroup to keep urlgrabber.mirrorgroup behavior
  * OscFileGrabber moved here

- meter.py
  * reworked to use progressbar module instead of progressbar
    of urlgrabber and simplified the module.

- babysitter.py
  * removed URLGrabErrorr

- build.py
  * removed adding of url_local to urllist. (not needed anymore)
  * removed URLGrabError

- commandline.py
  * switched from urlgrabber.urlgrab to OscFileGrabber().urlgrab

- core.py
  * reworked progressbar behavior

- fetch.py
  * removed join_url (not needed anymore)
  * moved OscFileGrabber to grabber.py
  * removed failureReport (not needed anymore)
2018-10-19 09:31:37 +02:00
Marcus Huewe
f12c7747d0 Merge branch 'approver' of https://github.com/adrianschroeter/osc
Introduce "osc request approval..." and "osc request cancelapproval"
commands.
2018-10-18 15:23:06 +02:00
e1fd0b4ee9 add support for approved requests (requires OBS 2.10) 2018-10-18 13:26:39 +02:00
Marcus Huewe
25014c326f Merge branch 'fix_413_get_deleted_sources' of https://github.com/lethliel/osc
Introduce --deleted option to "osc co" for checking out the files of
a deleted package (no package wc is established).
2018-10-18 12:59:55 +02:00
lethliel
0123bb71db fixes 413 checkout deleted package
* altered command do_checkout
  new option -D | --deleted. Can only be used with PACKAGE and needs
  -o to work

* what happens:
  core function checkout_deleted_package fetches the file list of the deleted
  package and saves it to given destdir. If destdir is not existent it
  creates the destination directory. Otherwise the files will be written
  in the existing directory.
2018-10-18 08:59:05 +02:00
c5ec3ce807 support checkconstraints command without local checkout 2018-10-02 10:45:38 +02:00
lethliel
f643e37eb1 print error and exit if p.apiurl != -A <apiurl>
Print error and exit if osc -A <apiurl> sr is issued on a
package with a different apiurl in its working copy. This leads
to unexpected behavior, because the SR is created for the package
apiurl, not the apiurl given by the -A command line option.
2018-09-25 13:48:09 +02:00
Johannes Kastl
ba66a0bc1d change keep-link description to make it easier to understand 2018-09-17 20:50:27 +02:00
Marco Strigl
48e71b0255
Merge pull request #438 from andreas-schwab/token
Clarify use of osc token
2018-08-31 11:16:04 +02:00
Marcus Huewe
86e5757832 Refactor the do_vc code a bit
No functional changes.
2018-08-17 22:45:28 +02:00
Andreas Schwab
4eae5d9a45 Clarify use of osc token
Clarify the fact that the parameters of osc token -t and osc token -d are
of different types.
2018-08-12 13:36:24 +02:00
ef13d67208 Export a real name for vc to consume 2018-08-01 09:43:14 -04:00
4cc87b2c57 fix DISTURL checkout for package containers using a multibuild flavor 2018-06-27 10:25:45 +02:00
jonsger
6bd8572cf7
Fix typo in "osc revert" help 2018-05-03 16:16:38 +02:00
bfcfddb0da fix some commands when used with / syntax between arguments 2018-04-27 14:41:08 +02:00
628f7e2cf5 - support "addcontainers" command 2018-04-27 09:16:13 +02:00
lethliel
eb2647fd4f fix order of options valdiation. Now -P and -p is
honored if given by user.
2018-04-18 16:04:06 +02:00
fba9af7eee add new options to diff command:
--unexpand for local diffs only (bsc#1089025)
--meta for diffing meta files
2018-04-11 08:01:45 +02:00
Marcus Huewe
5341f3aae5 Merge branch 'fix_dod_get_binaries' of https://github.com/lethliel/osc
Support dod binaries in core.get_binarylist.
2018-03-14 14:06:13 +01:00
lethliel
9b42897413 fix getbinaries with DOD binaries
getbinaries of dod binaries do not have a size or mtime.
This will break. So just set to None and print unkown instead.
2018-03-14 13:45:38 +01:00
Marcus Huewe
a25209ac31 Merge branch 'improve_created_binaries_msg' of https://github.com/lethliel/osc
Improve message that is printed during "osc getbinaries...".
2018-03-13 15:16:12 +01:00
lethliel
e042c585c0 change output when creating binaries directory
was:
Creating binaries

is now:
Creating directory "binaries"
2018-03-13 15:00:46 +01:00
Björn Geuken
030c2a41f8 Fix typo in example for osc search 2018-02-18 21:27:22 +01:00
Marcus Huewe
8948a26ae4 Fix --multibuild-package option handling in do_sendsysrq
Concatenating a str and a list does not work.
2018-02-09 15:35:52 +01:00
7fc251d81e fix sendsysrq command description 2018-02-09 10:08:13 +01:00
80352cbfc7 add sendsysrq command 2018-02-09 08:50:21 +01:00
Marcus Huewe
9c4f0d5d30 Ignore "--alternative-project <prj>" if it is equal to the wc's project
Without this change, using "--alternative-project <prj>" in combination
with "--multibuild-package <flavor>" yields to unexpected results (from
a user's point of view). Note that this may break existing (artificial)
workflows (e.g., using --alternative-project to ignore the package
meta's debuginfo flag), but these workflows should be rare and there
are options to achieve the same.

Fixes: #376 ("osc build -M something does not work with
--alternative-project")
2018-02-07 14:35:35 +01:00
Andreas Schwab
50222810f0 osc chroot: also mount devpts
This is needed for running expect, for example.
2018-01-28 16:53:52 +01:00
Marco Strigl
2405134cbf fixes not working osc maintainer <prj>
The retrun at this point breaks the call, because in most
cases <prj> is not a binary. And the code always checks for the
binary first and then returns if no binary with the name <prj>
is found.
2018-01-11 11:57:22 +01:00
Marcus Huewe
b1d6d8347b Fix "osc buildinfo --prefer-pkgs <dir>..." (finally!)
This is a follow-up commit for commit ce9a6d0 ("Fixed
\"osc buildinfo --prefer-pkgs...\"").
2017-12-06 18:04:30 +01:00
Marcus Huewe
9116d8ff97 Support expansion/unexpansion of a link when updating to certain rev
There is no good reason why "--revision <rev>" and "--expand-link" or
"--revision <rev>" and "--unexpand-link" should be mutually exclusive
during an "osc up" of a package wc.
Introduce the new "--linkrev <rev>" option to specify a rev of the link
target that is used during link expansion.
2017-12-03 16:45:36 +01:00
Marcus Huewe
5791d1bb5c Merge branch 'mount_sysfs' of https://github.com/lethliel/osc
Mount sysfs during "osc chroot". The current implementation
of "osc chroot" is a major pain for plain "su" users, because the
root password has to be entered several times - we should fix this.

Fixes: #354 ("Mount sysfs in chroot")
2017-11-21 12:34:15 +01:00
lethliel
00b6a9fe27 in chroot also mount /sys in addition to proc 2017-11-21 10:52:40 +01:00
Marcus Huewe
0f9ab38948 Merge branch 'fix_#351' of https://github.com/lethliel/osc
Fix logic for finding disabled repos in do_repositories.

Fixes: #351 ("Not all options for osc getbinaries is listed")
2017-11-09 11:56:36 +01:00
marco
12b17cfc5d consider arch when checking the disabled repos
At the moment just repo.name is considered. So if
the repo is disabled for s390 all other repo / arch
combination are not shown in the repo list.

To be able to change this r is now a list of dicts
containing the name and arch of the disabled repo.

None for repo if a complete arch gets disabled
None for arch if a complete repo gets disabled
2017-11-08 14:02:20 +01:00
Marcus Huewe
cb376a1a34 Merge branch 'config_replace_issue_313' of https://github.com/lethliel/osc
Store a newly created config file in $XDG_CONFIG_HOME/osc/. For backward
compatibility, ~/.oscrc is used, if present.

Fixes: #313 ("oscrc should be stored in $XDG_CONFIG_HOME on linux")
2017-11-08 12:23:07 +01:00
marco
6bc2d3f939 use XDG_CONFIG_HOME/osc/oscrc as default config
write oscrc to the default location for user-specific configuration.
If XDG_CONFIG_HOME is not set use ~/.config/osc/oscrc which is basically the same.

If there is already a ~/.oscrc use this one (for compat reasons). Existing user
installations should not get affected by this commit.

The order is the following:

Given config with -c
config defined in OSC_CONFIG
existing ~/.oscrc
default XDG_CONFIG_HOME/osc/oscrc
2017-11-08 11:17:11 +01:00
Alexander Bergmann
690dbf42ab Small documentation fix to clarify attribute usage. 2017-11-08 10:55:38 +01:00
Marcus Huewe
760d4d65d7 Supersede existing requests if --yes is passed to "osc sr"
This basically reverts commit b2b59ca, because the old code performed
a "no" instead of a "yes" (see also the discussion in
https://github.com/openSUSE/osc/pull/269).

Fixes: #343 ("'osc sr --yes ...' doesn't supersede existing requests
       as promised")
2017-10-06 12:32:52 +02:00
Marcus Huewe
aea395a7e7 Document 'R' (replaced) file state
Fixes: #336 ("Missing explanation for status 'R'")
2017-10-03 22:05:41 +02:00
Marcus Huewe
f52cf7745a Take --repo/--arch options in "osc prjresults --xml..." into account
Fixes: #341 ("prjresults doesn't support repo/arch options")
2017-09-28 15:55:11 +02:00
Marcus Huewe
2d327df4e7 Allow multiple --repo and --arch options in "osc prjresults"
This harmonizes "osc prjresults --help" with osc's actual behavior.
Also, core.get_prj_results expects lists (or None) instead of strings
for the corresponding repo/arch parameters.
2017-09-28 15:29:48 +02:00