Skip to content

Commit a182327

Browse files
authored
Merge pull request #6027 from kit-ty-kate/improved-error-msg-rsync
Improve the error message when a directory is not available while fetching using rsync
2 parents ba40b36 + 656b860 commit a182327

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

master_changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ users)
1616

1717
## Global CLI
1818
* Add cli version 2.3 [#6045 #6151 @rjbou]
19+
* Improve the error message when a directory is not available while fetching using rsync [#6027 @kit-ty-kate]
1920

2021
## Plugins
2122

src/repository/opamLocal.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ module B = struct
168168
else
169169
OpamFilename.mkdir quarantine;
170170
pull_dir_quiet quarantine url) @@+ function
171-
| Not_available _ ->
171+
| Not_available (_, msg) ->
172172
finalise ();
173-
Done (OpamRepositoryBackend.Update_err (Failure "rsync failed"))
173+
Done (OpamRepositoryBackend.Update_err (Failure ("rsync error: " ^ msg)))
174174
| Up_to_date _ ->
175175
finalise (); Done OpamRepositoryBackend.Update_empty
176176
| Result _ ->

tests/reftests/repository.test

+8-8
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ first --
290290
### <OPER/packages/fantom/fantom.0/opam>
291291
opam-version: "2.0"
292292
### opam repository set-url oper ./OPER4
293-
[ERROR] Could not update repository "oper": rsync failed
293+
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
294294
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
295295
# Return code 40 #
296296
### opam list --available --repo=oper
@@ -329,7 +329,7 @@ first --
329329
# Name # Installed # Synopsis
330330
first --
331331
### opam repository set-url oper ./OPER4
332-
[ERROR] Could not update repository "oper": rsync failed
332+
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
333333
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to git+file://${BASEDIR}/OPER
334334
# Return code 40 #
335335
### opam list --available --repo=oper
@@ -369,15 +369,15 @@ first --
369369
[oper] Initialised
370370
### :: Simply failing urls ::
371371
### opam repository --this-switch add oper4 ./OPER4
372-
[ERROR] Could not update repository "oper4": rsync failed
372+
[ERROR] Could not update repository "oper4": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
373373
[ERROR] Initial repository fetch failed
374374
# Return code 40 #
375375
### opam repository --this-switch
376376

377377
<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
378378
1 oper file://${BASEDIR}/OPER
379379
### opam repository --this-switch set-url oper ./OPER4
380-
[ERROR] Could not update repository "oper": rsync failed
380+
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
381381
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
382382
# Return code 40 #
383383
### opam repository --this-switch
@@ -456,7 +456,7 @@ first --
456456
### <OPER/packages/fantom/fantom.0/opam>
457457
opam-version: "2.0"
458458
### opam repository set-url oper ./OPER4
459-
[ERROR] Could not update repository "oper": rsync failed
459+
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
460460
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
461461
# Return code 40 #
462462
### opam list --available --repo=oper
@@ -495,7 +495,7 @@ first --
495495
# Name # Installed # Synopsis
496496
first --
497497
### opam repository set-url oper ./OPER4
498-
[ERROR] Could not update repository "oper": rsync failed
498+
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
499499
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to git+file://${BASEDIR}/OPER
500500
# Return code 40 #
501501
### opam list --available --repo=oper
@@ -535,15 +535,15 @@ first --
535535
[oper] Initialised
536536
### ::: Simply failing urls :::
537537
### opam repository --this-switch add oper4 ./OPER4
538-
[ERROR] Could not update repository "oper4": rsync failed
538+
[ERROR] Could not update repository "oper4": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
539539
[ERROR] Initial repository fetch failed
540540
# Return code 40 #
541541
### opam repository --this-switch
542542

543543
<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
544544
1 oper file://${BASEDIR}/OPER
545545
### opam repository --this-switch set-url oper ./OPER4
546-
[ERROR] Could not update repository "oper": rsync failed
546+
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
547547
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
548548
# Return code 40 #
549549
### opam repository --this-switch

0 commit comments

Comments
 (0)