tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GITHUB_PROJECT assignment



Frédéric Fauberteau <frederic.fauberteau%devinci.fr@localhost> writes:

> 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'

There are a few issues wrapped up in here.

One is that for a DISTNAME of foo-bar-x.y.z, what should be the PKGNAME?
Arguably it should be foo-bar, by default.  I don't really follow the
what -dev means here, but I think it normally would belong in PKGNAME.

A package with a DISTNAME of foo-bar-x.y.z should unpack into a WRKSRC
of foo-bar-x.y.z.

> 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

It seems like asking for trouble to retrieve a file from github (that
should be an actual file, but probably isn't) and rename it when storing
it locally.   So I advise against DISTNAME not matching GITHUB_PROJECT
in the obvious way.

> A working solution is:
> DISTNAME=       foo-dev-1.2.3
> PKGNAME=        ${DISTNAME:S/-dev//}

In other words, PKGNAME=foo?

> MASTER_SITES=   ${MASTER_SITE_GITHUB:=jsmith/}
> GITHUB_PROJECT= ${PKGBASE}-dev

That seems like a good solution, but you left out the comment explaining
that upsream is doing things wrong, specifically how, and how you are
working around it :-)  I'm serious about the comment, because it will
help the next maintainer.

You are having to set PKGNAME because the upstream is configured
incorrectly (PKGNAME != repo name), and GITHUB_PROJECT to compensate for
that prior accomodation.  What's the problem (other than upstream)?

Have you filed a bug with upstream about their naming?

> What about the following solution?
> +++ 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)

That seems like a kludge for one package with an incorrectly setup
upstream, duplicating the PKGBASE logic in a way that happens to work
with this package.


What I tend to do when running into upstreams with naming bugs is to
define a few variables and build up the PKGSRC variables I need from
them explicitly.   Often this is a baseneme foo-1.0 and then another
variable RC1 so that RC1 is treated as follows:
  DISTNAME: included
  PKGNAME: included
  WRKSRC: not included

Your case is different in details, but is similarly working around a
violation of the usual convention that DISTNAME==WRKSRC and DISTNAME
minus the version is PKGNAME.

So I too am opposed to the general change you are proposing.

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index