pkgsrc-Users archive

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

Re: github & url2pkg



Am 28.05.2018 um 01:24 schrieb MLH:
> I was hoping that url2pkg would understand more github projects
> and wanted to try to bring in goldencheetach via
> https://github.com/GoldenCheetah/GoldenCheetah/archive/v3.5-DEV1710.tar.gz
> but it still misfires on building the url:
> 
>  Can't lookup
>  `v3.5-DEV1710.tar.gz:https://github.com/GoldenCheetah/GoldenCheetah/archive/DEV1710.tar.gz':
>  servname not supported for ai_socktype

I don't understand why this URL starts with "v3.5". The part before the
"https" might explain the strange "servname not supported" error message.

> I can't find instructions or examples to understand how one is
> supposed to set variables to build the url correctly for a case
> like this.


> GITHUB_PROJECT= GoldenCheetah
> DISTNAME=       v3.5-DEV1710

Url2pkg did a bad job here. If DISTNAME were only for downloading the
distfile, this would be ok, but DISTNAME is also used in two other
places (see "make help topic=distname").

DISTNAME is the default for PKGNAME, and this is the wrong part. It
really should be:

PKGNAME=          GoldenCheetah-3.5-DEV1710

But even adding this line doesn't fix the URL generation (see "make
show-all-github"). Running "make show-all-pkgname" gives a hint:

pkgname:
  def   PKGBASE = GoldenCheetah-3.5
  def   PKGVERSION = DEV1710
  def   PKGNAME_NOREV = GoldenCheetah-3.5-DEV1710
  def   PKGNAME = GoldenCheetah-3.5-DEV1710
  def   PKGVERSION_NOREV = DEV1710

PKGBASE should not contain a version number, but it does in this case,
which seems weird. Maybe the package definition is wrong. In that case,
pkglint should complain loudly:

...
WARN: Makefile:5: "GoldenCheetah-3.5-DEV1710" is not a valid package
name. A valid package name has the form packagename-version, where
version consists only of digits, letters and dots.
...

Ah, it is the additional dash in the package version that confuses
pkgsrc. Replacing the dash with a dot solves all problems:

PKGNAME=        GoldenCheetah-3.5.DEV1710

$ make show-all-pkgname

pkgname:
  def   PKGBASE = GoldenCheetah
  def   PKGVERSION = 3.5.DEV1710
  def   PKGNAME_NOREV = GoldenCheetah-3.5.DEV1710
  def   PKGNAME = GoldenCheetah-3.5.DEV1710
  def   PKGVERSION_NOREV = 3.5.DEV1710

$ bmake show-all-github
github:
  pkg   GITHUB_PROJECT = GoldenCheetah
  pkg   GITHUB_TAG = 3.5.DEV1710
  pkg   GITHUB_TYPE = tag
  def   _USE_GITHUB = YES
  def   _GITHUB_DEFAULT_DISTFILES = v3.5-DEV1710.tar.gz
  def   SITES.v3.5-DEV1710.tar.gz =
-https://github.com/GoldenCheetah/GoldenCheetah/archive/3.5.DEV1710.tar.gz

Well, maybe not all problems are solved by defining PKGNAME. GITHUB_TAG
is still wrong, so the package Makefile needs to define it.

GITHUB_TAG=     v3.5-DEV1710

$ make fetch
$ make distinfo
$ make extract
$ make show-all-dirs

dirs:
...
  pkg   WRKSRC =
/home/rillig/proj/pkgsrc/wip/GoldenCheetah/work/GoldenCheetah-3.5-DEV1710
...

It's a little strange that WRKSRC doesn't contain the "v" from "v3.5",
but that's explained in mk/bsd.pkg.mk:

WRKSRC?=                ${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG:C/^v//}

In summary, it's a whole lot of magic that happens here, and it took me
about an hour to research all this. That should definitely be made a
little simpler.

Best,
Roland


Home | Main Index | Thread Index | Old Index