Set GITHUB_TAG unconditionally if found and avoid to use undef variables. Pointed out by coypu via: TODO: strictly this is not needed when GITHUB_TAG == PKGVERSION_NOREV TODO: So maybe a better idea is to instruct url2pkg to understand the TODO: PKGVERSION_NOREV in order to avoid that. Index: Makefile =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/url2pkg/Makefile,v retrieving revision 1.85 diff -u -p -r1.85 Makefile --- Makefile 10 Jul 2016 13:31:54 -0000 1.85 +++ Makefile 26 Jul 2016 15:10:10 -0000 @@ -1,7 +1,6 @@ # $NetBSD: Makefile,v 1.85 2016/07/10 13:31:54 rillig Exp $ -PKGNAME= url2pkg-2.27 -PKGREVISION= 1 +PKGNAME= url2pkg-2.28 CATEGORIES= pkgtools MAINTAINER= pkgsrc-users@NetBSD.org Index: files/url2pkg.pl =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/url2pkg/files/url2pkg.pl,v retrieving revision 1.33 diff -u -p -r1.33 url2pkg.pl --- files/url2pkg.pl 26 Jun 2016 19:03:33 -0000 1.33 +++ files/url2pkg.pl 26 Jul 2016 15:10:10 -0000 @@ -304,6 +304,7 @@ sub generate_initial_package($) { } if (!$found) { + $gh_project = $gh_release = $dist_subdir = ""; if ($url =~ qr"^https?://github\.com/") { if ($url =~ qr"^https?://github\.com/(.*)/(.*)/archive/(.*)(\.tar\.gz|\.zip)$") { $master_sites = "\${MASTER_SITE_GITHUB:=$1/}"; @@ -333,8 +334,6 @@ sub generate_initial_package($) { } else { print("$0: ERROR: Invalid GitHub URL: ${url}, handling as normal URL\n"); } - } else { - $gh_project = ""; $gh_release = ""; $dist_subdir = ""; } } @@ -374,6 +373,9 @@ sub generate_initial_package($) { (($gh_release ne "") ? ["GITHUB_RELEASE", $gh_release] : ()), + (($gh_tag ne "") + ? ["GITHUB_TAG", $gh_tag] + : ()), (($dist_sufx ne ".tar.gz" && $dist_sufx ne ".gem") ? ["EXTRACT_SUFX", $dist_sufx] : ()),