From owner-svn-ports-head@freebsd.org Wed Jul 19 14:00:18 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 332BAC7E103; Wed, 19 Jul 2017 14:00:18 +0000 (UTC) (envelope-from tobik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F7B4804DD; Wed, 19 Jul 2017 14:00:17 +0000 (UTC) (envelope-from tobik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6JE0Hpc057316; Wed, 19 Jul 2017 14:00:17 GMT (envelope-from tobik@FreeBSD.org) Received: (from tobik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6JE0HG8057315; Wed, 19 Jul 2017 14:00:17 GMT (envelope-from tobik@FreeBSD.org) Message-Id: <201707191400.v6JE0HG8057315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tobik set sender to tobik@FreeBSD.org using -f From: Tobias Kortkamp Date: Wed, 19 Jul 2017 14:00:17 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r446198 - head/Mk/Scripts X-SVN-Group: ports-head X-SVN-Commit-Author: tobik X-SVN-Commit-Paths: head/Mk/Scripts X-SVN-Commit-Revision: 446198 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jul 2017 14:00:18 -0000 Author: tobik Date: Wed Jul 19 14:00:16 2017 New Revision: 446198 URL: https://svnweb.freebsd.org/changeset/ports/446198 Log: When specifying Git dependencies in Cargo.toml developers can set 3 additional keys: rev, branch, tag [1]. These are reflected in a projects' Cargo.lock file as e.g. git+https://github.com/servo/angle?branch=servo#a1371e8a160128677af863d1d73f150862ba42b2 git+https://github.com/rust-lang/libc?tag=0.2.26#288942e6858a4b2f8ee56338da5386263b9c4b82 Currently cargo-crates.awk generates the wrong output in these cases: GH_TUPLE= servo:angle?branch=servo:a1371e8a160128677af863d1d73f150862ba42b2:angle \ rust-lang:libc?tag=0.2.26:288942e6858a4b2f8ee56338da5386263b9c4b82:libc Fix cargo-crates.awk to ignore the query string (except in the tag case) and generate GH_TUPLE= servo:angle:a1371e8a160128677af863d1d73f150862ba42b2:angle \ rust-lang:libc:0.2.26:libc instead. [1] https://github.com/rust-lang/cargo/blob/master/src/doc/specifying-dependencies.md#specifying-dependencies-from-git-repositories PR: 220548 Reported by: jbeich Reviewed by: jbeich, mat Differential Revision: https://reviews.freebsd.org/D11571 Modified: head/Mk/Scripts/cargo-crates.awk (contents, props changed) Modified: head/Mk/Scripts/cargo-crates.awk ============================================================================== --- head/Mk/Scripts/cargo-crates.awk Wed Jul 19 12:52:52 2017 (r446197) +++ head/Mk/Scripts/cargo-crates.awk Wed Jul 19 14:00:16 2017 (r446198) @@ -1,3 +1,6 @@ +# MAINTAINER: ports@FreeBSD.org +# $FreeBSD$ + BEGIN { gh_tuple_len = 0 crates_len = 0 @@ -17,18 +20,50 @@ BEGIN { gsub("[^a-zA-Z_]", "", package_name) } -/^source = "git\+(https|http|git):\/\/github.com\/.*#.*"/ { - split($3, url, "#") +function split_url(s) { + # scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment] + split(s, url_scheme, "://") + url["scheme"] = url_scheme[1] - gsub("^\"git\+", "", url[1]) - split(url[1], repourl, "/") - account = repourl[4] - project = repourl[5] - gsub("\.git$", "", project) + split(url_scheme[2], url_fragment, "#") + url["fragment"] = url_fragment[2] - tag = url[2] - gsub("\"$", "", tag) + split(url_fragment[1], url_query, "?") + url["query"] = url_query[2] + split(url_query[1], url_authority, "/") + url["path"] = substr(url_query[1], length(url_authority[1]) + 1) + + split(url_authority[1], url_auth, "@") + + if (length(url_auth) == 2) { + split(url_auth[1], url_user, ":") + url["user"] = url_user[1] + url["password"] = url_user[2] + split(url_auth[2], url_host, ":") + } else { + url["user"] = "" + url["password"] = "" + split(url_auth[1], url_host, ":") + } + url["host"] = url_host[1] + url["port"] = url_host[2] +} + +/^source = "git\+(https|http|git):\/\/github.com\/.*#.*"/ { + split_url(substr($3, 1, length($3) - 1)) + + split(url["path"], path, "/") + account = path[2] + project = path[3] + gsub("\.git$", "", project) + + if (match(url["query"], "^tag=")) { + split(url["query"], tag_, "=") + tag = tag_[2] + } else { + tag = url["fragment"] + } gh_tuple[gh_tuple_len++] = sprintf(\ "%s:%s:%s:%s", account, project, tag, package_name) }