Opened 3 years ago

Last modified 3 years ago

#64235 new defect

MacPorts base: patch_sites.mirror_subdir not getting appended to patch_sites URL

Reported by: jasonliu-- (Jason Liu) Owned by:
Priority: Normal Milestone:
Component: base Version: 2.7.1
Keywords: Cc:
Port:

Description

I'm working on a portfile where I would like to download a patch from GitHub. When I have the following code:

github.setup              Secretchronicles TSC 2.1.0 v
...
patch_sites               ${github.homepage}
patch_sites.mirror_subdir commit
patchfiles-append         48f981f3ff459f742d5f30596e7866ae4b9005f7.patch

MacPorts doesn't seem to be able to find the file, because the assembled URL is incorrect:

:info:fetch --->  48f981f3ff459f742d5f30596e7866ae4b9005f7.patch does not exist in
                  /opt/local/var/macports/distfiles/secretchronicles
:notice:fetch --->  Attempting to fetch 48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
                    from http://distfiles.macports.org/secretchronicles
:debug:fetch Fetching distfile failed: The requested URL returned error: 404 Not Found
:notice:fetch --->  Attempting to fetch 48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
                    from https://github.com/Secretchronicles/TSC
:debug:fetch Fetching distfile failed: The requested URL returned error: 404 Not Found
...
:error:fetch Failed to fetch secretchronicles:
             The requested URL returned error: 404 Not Found
:debug:fetch Error code: NONE
:debug:fetch Backtrace: The requested URL returned error: 404 Not Found

However, when I change the code to be

github.setup              Secretchronicles TSC 2.1.0 v
...
patch_sites.mirror_subdir commit
patch_sites               ${github.homepage}/${patch_sites.mirror_subdir}
patchfiles-append         48f981f3ff459f742d5f30596e7866ae4b9005f7.patch

it seems to download the patch file fine:

:info:fetch --->  48f981f3ff459f742d5f30596e7866ae4b9005f7.patch does not exist in
                  /opt/local/var/macports/distfiles/secretchronicles
:notice:fetch --->  Attempting to fetch 48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
                    from http://distfiles.macports.org/secretchronicles
:debug:fetch Fetching distfile failed: The requested URL returned error: 404 Not Found
:notice:fetch --->  Attempting to fetch 48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
                    from https://github.com/Secretchronicles/TSC/commit
:debug:fetch Executing proc-post-org.macports.fetch-fetch-0

I grepped through all of the portfiles in macports-ports, and it seems that no portfiles are currently using patch_sites.mirror_subdir.

Attachments (1)

Portfile (1.4 KB) - added by jasonliu-- (Jason Liu) 3 years ago.
Since I am still working on the portfile, I'm including a minimized version of the portfile that demonstrates the error

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by jasonliu-- (Jason Liu)

Attachment: Portfile added

Since I am still working on the portfile, I'm including a minimized version of the portfile that demonstrates the error

comment:1 Changed 3 years ago by jmroot (Joshua Root)

*_sites.mirror_subdir only applies to mirrors, i.e. the named groups of URLs defined in mirror_sites.tcl. For example, adding gnu to patch_sites gives:

% port distfiles
--->  Distfiles for secretchronicles
[48f981f3ff459f742d5f30596e7866ae4b9005f7.patch] /opt/local/var/macports/distfiles/secretchronicles/48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
  https://github.com/Secretchronicles/TSC/48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
  https://artfiles.org/gnu.org/commit/48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
  https://ftp.gnu.org/gnu/commit/48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
  https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/commit/48f981f3ff459f742d5f30596e7866ae4b9005f7.patch
…

comment:2 in reply to:  1 Changed 3 years ago by jasonliu-- (Jason Liu)

Replying to jmroot:

*_sites.mirror_subdir only applies to mirrors, i.e. the named groups of URLs defined in mirror_sites.tcl.

So you seem to be saying that mirror_subdir applies to the URLs in mirror_sites.tcl, but not master_sites or patch_sites. If that's the case, the documentation doesn't really make that clear, at least from my reading.

comment:3 Changed 3 years ago by jmroot (Joshua Root)

Only the predefined mirror lists have any need to append a subdir, because they are used by many different ports. If you specify a URL in the Portfile, you can simply include the subdir in it.

The docs for the mirror_subdir options do assume that you read the entry for master_sites and remember that "mirror" has a specific meaning in this context. Improvements are always welcome.

comment:4 Changed 3 years ago by jasonliu-- (Jason Liu)

Could you point me in the direction of how I go about making changes to the documentation? Or is that something that one of the council elders has to do?

comment:5 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Anyone can improve the documentation. The guide source code is here: https://github.com/macports/macports-guide

comment:6 Changed 3 years ago by jasonliu-- (Jason Liu)

So, my thought is to add the following sentences in the master_sites.mirror_subdir and patch_sites.mirror_subdir entries in the Port Phases doc page:

Keep in mind that that mirror_subdir will only get appended to the list of mirrors in mirror_sites.tcl, and will not affect the path of (${master_sites} |${patch_sites} ) itself. If you want to download the (distfile|patchfile) from a subdirectory, you should add the subdirectory to (${master_sites} |${patch_sites} ) directly.

What does everyone think? Perhaps a bit pedantic, but it feels a bit more clear, at least to a relative newbie like me.

If everyone thinks it would be helpful, I can put together a PR.

Note: See TracTickets for help on using tickets.