From 5a6fee91baa48529e1362271755171c10c69b5c8 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 3 Dec 2012 12:44:43 +0200 Subject: [PATCH] export: update 'VCS:' tag in spec Updates/inserts a 'VCS:' tag to the spec file, after exporting the sources. The format of the tag is 'repopath#tagname'. Signed-off-by: Markus Lehtonen --- gitbuildsys/cmd_export.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gitbuildsys/cmd_export.py b/gitbuildsys/cmd_export.py index 71d878a..d9a75a4 100644 --- a/gitbuildsys/cmd_export.py +++ b/gitbuildsys/cmd_export.py @@ -23,6 +23,7 @@ import os import re import shutil import errno +from urlparse import urlparse from gitbuildsys import msger, utils, errors from gitbuildsys.conf import configmgr @@ -120,6 +121,20 @@ def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args, else: squash_patches_until = configmgr.get('squash_patches_until', 'general') + # Determine the remote repourl + reponame = "" + remotes = repo.get_remote_repos() + if remotes: + remotename = 'origin' if 'origin' in remotes else remotes.keys()[0] + # Take the remote repo of current branch, if available + try: + upstream_branch = repo.get_upstream_branch(repo.branch) + if upstream_branch: + remotename = upstream_branch.split("/")[0] + except GitRepositoryError: + pass + reponame = urlparse(remotes[remotename][0]).path[1:] + packaging_dir = get_packaging_dir(args) # Now, start constructing the argument list argv = ["argv[0] placeholder", @@ -132,7 +147,8 @@ def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args, "--git-spec-file=%s" % spec, "--git-export=%s" % commit, "--git-upstream-branch=%s" % upstream_branch, - "--git-upstream-tag=%s" % upstream_tag] + "--git-upstream-tag=%s" % upstream_tag, + "--git-spec-vcs-tag=%s#%%(tagname)s" % reponame] if force_native or is_native_pkg(repo, args): argv.extend(["--git-no-patch-export", -- 2.7.4