On 24.05.2018 13:06, Frédéric Fauberteau wrote:
> Hi folks,
>
> Imagine we would package the foo program hosted by the jsmith github
> account. Unfortunately, the repository is named foo-dev. I would to write:
> DISTNAME= foo-dev-1.2.3
> PKGNAME= ${DISTNAME:S/-dev//}
> MASTER_SITES= ${MASTER_SITE_GITHUB:=jsmith/}
>
> But it doesn't work because GITHUB_PROJECT?= ${PKGBASE}:
> Requesting https://github.com/jsmith/foo/archive/1.2.3.tar.gz
> ftp: Error retrieving file `404 Not Found'
>
> If I write the followings:
> DISTNAME= foo-1.2.3
> MASTER_SITES= ${MASTER_SITE_GITHUB:=jsmith/}
> GITHUB_PROJECT= ${PKGBASE}-dev
> It doesn't work because WRKSRC?=
> ${WRKDIR}/${DISTNAME:U${PKGNAME_NOREV}}. WRKSRC=work/foo-1.2.3 but
> actually, the extraction of archive produces work/foo-dev-1.2.3:
> patch: **** can't cd to /usr/pkgsrc/xxx/foo/work/foo-1.2.3: No such file
> or directory
>
> A working solution is:
> DISTNAME= foo-dev-1.2.3
> PKGNAME= ${DISTNAME:S/-dev//}
> MASTER_SITES= ${MASTER_SITE_GITHUB:=jsmith/}
> GITHUB_PROJECT= ${PKGBASE}-dev
>
> What about the following solution?
No. We can (and certainly will) break real packages with this assumption.
The proper approach is to define GITHUB_PROJECT.
> +++ fetch/github.mk 2018-05-24 12:56:25.000000000 +0200
> @@ -39,7 +39,7 @@
>
> .if defined(_USE_GITHUB) && !empty(_USE_GITHUB:M[yY][eE][sS])
>
> -GITHUB_PROJECT?= ${PKGBASE}
> +GITHUB_PROJECT?= ${DISTNAME:C/-[^-]*$//}
> GITHUB_TAG?= ${PKGVERSION_NOREV}
>
> . if !empty(GITHUB_TAG:Mmaster)
>
Attachment:
signature.asc
Description: OpenPGP digital signature