-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix lint W59 with a local path that is not an archive #6219
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -852,6 +852,7 @@ ${BASEDIR}/lint.opam: Warnings. | |
### opam lint ./lint.opam --check-upstream | ||
${BASEDIR}/lint.opam: Warnings. | ||
warning 59: url doesn't contain a checksum | ||
### # package with conf flag | ||
### <lint.opam> | ||
opam-version: "2.0" | ||
synopsis: "A word" | ||
|
@@ -864,7 +865,6 @@ dev-repo: "hg+https://to@li.nt" | |
bug-reports: "https://nobug" | ||
url { src:"an-archive.tgz" } | ||
flags: conf | ||
### # package with conf flag | ||
### opam lint ./lint.opam | ||
${BASEDIR}/lint.opam: Errors. | ||
error 46: Package is flagged "conf" but has source, install or remove instructions | ||
|
@@ -873,6 +873,7 @@ ${BASEDIR}/lint.opam: Errors. | |
${BASEDIR}/lint.opam: Errors. | ||
error 46: Package is flagged "conf" but has source, install or remove instructions | ||
# Return code 1 # | ||
### # package with git url | ||
### <lint.opam> | ||
opam-version: "2.0" | ||
synopsis: "A word" | ||
|
@@ -884,7 +885,53 @@ license: "ISC" | |
dev-repo: "hg+https://to@li.nt" | ||
bug-reports: "https://nobug" | ||
url { src:"git+https://a/repo" } | ||
### # package with git url | ||
### opam lint ./lint.opam | ||
${BASEDIR}/lint.opam: Passed. | ||
### opam lint ./lint.opam --check-upstream | ||
${BASEDIR}/lint.opam: Passed. | ||
### # package with local url | ||
### <repo/stuff> | ||
something | ||
### <lint.opam> | ||
opam-version: "2.0" | ||
synopsis: "A word" | ||
description: "Two words." | ||
authors: "the testing team" | ||
homepage: "egapemoh" | ||
maintainer: "maint@tain.er" | ||
license: "ISC" | ||
dev-repo: "hg+https://to@li.nt" | ||
bug-reports: "https://nobug" | ||
### <add-url.sh> | ||
basedir=$(echo "$BASEDIR" | sed "s/\\\\\\\\/\\\\\\\\\\\\\\\\/g") | ||
cat << EOF >> lint.opam | ||
url { src:"file://$basedir/an-archive" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure to understand the issue. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, linting should only check the content of the file and what is required in an opam file. If we want to check things on disk, it should be another option, as for |
||
EOF | ||
### sh add-url.sh | ||
### opam lint ./lint.opam | ||
${BASEDIR}/lint.opam: Passed. | ||
### opam lint ./lint.opam --check-upstream | ||
${BASEDIR}/lint.opam: Passed. | ||
### # package with local archive url | ||
### <lint.opam> | ||
opam-version: "2.0" | ||
synopsis: "A word" | ||
description: "Two words." | ||
authors: "the testing team" | ||
homepage: "egapemoh" | ||
maintainer: "maint@tain.er" | ||
license: "ISC" | ||
dev-repo: "hg+https://to@li.nt" | ||
bug-reports: "https://nobug" | ||
### <add-url.sh> | ||
basedir=$(echo "$BASEDIR" | sed "s/\\\\\\\\/\\\\\\\\\\\\\\\\/g") | ||
cat << EOF >> lint.opam | ||
url { | ||
src:"file://$basedir/an-archive.tgz" | ||
checksum: "md5=$(openssl md5 an-archive.tgz | cut -f2 -d' ')" | ||
} | ||
EOF | ||
### sh add-url.sh | ||
### opam lint ./lint.opam | ||
${BASEDIR}/lint.opam: Passed. | ||
### opam lint ./lint.opam --check-upstream | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think that's right.
is_archive
will look up the file locally. If you have an url likehttps:///etc/fstab
, the path will be looked up.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, we should then add a function that checks if a path looks like an archive, like
looks_like_ssh_path
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure we need a new function. Something like that would work just fine i think:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to check file existence on disk (which does
OpamUrl.local_file
). We want to know if given string seems like an archive path.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adding a function similar to
OpamUrl.kind
from #5979?