tarides / dune-release

Streamlining the release of dune packages to opam
ISC License
115 stars 36 forks source link

dune-release publish distrib fails because of missing package delegate #206

Open ghost opened 4 years ago

ghost commented 4 years ago

Running dune-release publish distrib in the dune repo fails as follow:

$ dune-release publish distrib --verbose -n dune
dune-release: [INFO] dune-release 1.3.3 running
[-] Publishing distribution
dune-release: [INFO] Parsing opam file dune.opam
dune-release: [ERROR] readthedocs-dune-release-delegate: package delegate
                      cannot be found. Try `dune-release help delegate` for
                      more information.

Can I force dune-release to consider the project as a normal github project?

ghost commented 4 years ago

According to the doc, I can do it by passing --delegate github-dune-release-delegate, however that doesn't seem to work:

$ dune-release publish distrib  --verbose -n dune --delegate github-dune-release-delegate
dune-release: [INFO] dune-release 1.3.3 running
[-] Publishing distribution
[-] Using delegate github-dune-release-delegate
dune-release: [INFO] Parsing opam file dune.opam
dune-release: [ERROR] Delegate github-dune-release-delegate errored with 127
ghost commented 4 years ago

Ah, after reading the code I found that it works if you set the environment variable instead:

$ DUNE_RELEASE_DELEGATE=github-dune-release-delegate dune-release publish distrib  --verbose -n dune
[...]
ghost commented 4 years ago

I guess the doc and code are not in sync and one of them needs to be updated.

NathanReb commented 4 years ago

Yeah we definitely need to do something about this, in particular it should fallback to github if the dev-repo is on github

ghost commented 4 years ago

Indeed. From a user point of view, the current behaviour is a bit surprising. Indeed, delegates seems like an advanced feature while changing the documentation page is a basic feature. The user shouldn't be confronted with advanced features problems when they only did basic things. So it seems to me that setting a delegate should be done explicitly, not guessed implicitly.

NathanReb commented 4 years ago

I totally agree, we have a plan to get rid of delegates by the way so this should soon be a problem of the past: https://github.com/ocamllabs/dune-release/issues/188

Drup commented 4 years ago

An extension of this: I you have 2 packages in the same repository, and you go through what @diml describes, the opam file generated by the "main" package is correct, but not the other, they fallback to something like $HOMEPAGE/$TARBALL instead of $GITHUB/.../$TARBALL as they should.

talex5 commented 4 years ago

For others with this problem, this seems to work:

  1. Do everything up to and including the dune-release distrib step as usual.
  2. Edit your main opam file to set homepage: "https://github.com/ORG/REPO" (but don't commit).
  3. Run dune-release publish.
  4. Undo the homepage change.
  5. Copy _build/$main.url as _build/$other-pkg.url for each sub-package.
  6. Run dune-release opam pkg.
  7. Run dune-release opam submit.
ghost commented 4 years ago

FTR, that's what we have in the Makefile of dune:

opam-release:
    dune-release distrib --skip-build --skip-lint --skip-tests -n dune
    # See https://github.com/ocamllabs/dune-release/issues/206
    DUNE_RELEASE_DELEGATE=github-dune-release-delegate dune-release publish distrib --verbose -n dune
    dune-release opam pkg -n dune
    dune-release opam submit -n dune
mbarbin commented 2 months ago

I found a link to this issue in pp's release script. I was able to run it without the delegate env variable. Seeing as #188 is closed, shall we close this issue as well as resolved?

In this PR I am proposing to simplify pp's release script: https://github.com/ocaml-dune/pp/pull/22