All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option
@ 2019-11-23 13:46 Niko Mauno
  2019-11-23 13:46 ` [meta-oe][warrior][PATCH 2/2] gitpkgv.bbclass: Support also lightweight tags Niko Mauno
  2019-11-24 16:46 ` [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option akuster808
  0 siblings, 2 replies; 4+ messages in thread
From: Niko Mauno @ 2019-11-23 13:46 UTC (permalink / raw)
  To: openembedded-devel

From: "niko.mauno@vaisala.com" <niko.mauno@vaisala.com>

Avoid redundant shell working directory change by resorting to
'--git-dir' option for git command instead.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta-oe/classes/gitpkgv.bbclass | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass
index 2d9680a35..22609f584 100644
--- a/meta-oe/classes/gitpkgv.bbclass
+++ b/meta-oe/classes/gitpkgv.bbclass
@@ -87,10 +87,8 @@ def get_git_pkgv(d, use_tags):
 
                 if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0:
                     commits = bb.fetch2.runfetchcmd(
-                        "cd %(repodir)s && "
-                        "git rev-list %(rev)s -- 2> /dev/null "
-                        "| wc -l" % vars,
-                        d, quiet=True).strip().lstrip('0')
+                        "git --git-dir=%(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l"
+                        % vars, d, quiet=True).strip().lstrip('0')
 
                     if commits != "":
                         oe.path.remove(rev_file, recurse=False)
@@ -105,9 +103,8 @@ def get_git_pkgv(d, use_tags):
                 if use_tags:
                     try:
                         output = bb.fetch2.runfetchcmd(
-                            "cd %(repodir)s && "
-                            "git describe %(rev)s 2>/dev/null" % vars,
-                            d, quiet=True).strip()
+                            "git --git-dir=%(repodir)s describe %(rev)s 2>/dev/null"
+                            % vars, d, quiet=True).strip()
                         ver = gitpkgv_drop_tag_prefix(output)
                     except Exception:
                         ver = "0.0-%s-g%s" % (commits, vars['rev'][:7])
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [meta-oe][warrior][PATCH 2/2] gitpkgv.bbclass: Support also lightweight tags
  2019-11-23 13:46 [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option Niko Mauno
@ 2019-11-23 13:46 ` Niko Mauno
  2019-11-24 16:46 ` [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option akuster808
  1 sibling, 0 replies; 4+ messages in thread
From: Niko Mauno @ 2019-11-23 13:46 UTC (permalink / raw)
  To: openembedded-devel

From: "niko.mauno@vaisala.com" <niko.mauno@vaisala.com>

When checking for commit specific tags during GITPKGVTAG resolution, use
additional '--tags' and '--exact-match' options for 'git describe'
command.

This changes the behaviour so that in case an annotated tag does not
exist for the particular commit, then the latest lightweight
(non-annotated) tag is used instead, in case that commit has at least
one such tag.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta-oe/classes/gitpkgv.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass
index 22609f584..ab591bd45 100644
--- a/meta-oe/classes/gitpkgv.bbclass
+++ b/meta-oe/classes/gitpkgv.bbclass
@@ -7,8 +7,8 @@
 #   NN equals the total number of revs up to SRCREV
 #   GITHASH is SRCREV's (full) hash
 #
-# - GITPKGVTAG which is the output of 'git describe' allowing for
-#   automatic versioning
+# - GITPKGVTAG which is the output of 'git describe --tags --exact-match'
+#   allowing for automatic versioning
 #
 # gitpkgv.bbclass assumes the git repository has been cloned, and
 # contains SRCREV. So ${GITPKGV} and ${GITPKGVTAG} should never be
@@ -103,7 +103,7 @@ def get_git_pkgv(d, use_tags):
                 if use_tags:
                     try:
                         output = bb.fetch2.runfetchcmd(
-                            "git --git-dir=%(repodir)s describe %(rev)s 2>/dev/null"
+                            "git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null"
                             % vars, d, quiet=True).strip()
                         ver = gitpkgv_drop_tag_prefix(output)
                     except Exception:
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option
  2019-11-23 13:46 [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option Niko Mauno
  2019-11-23 13:46 ` [meta-oe][warrior][PATCH 2/2] gitpkgv.bbclass: Support also lightweight tags Niko Mauno
@ 2019-11-24 16:46 ` akuster808
  2019-11-25 13:59   ` Peter Kjellerstedt
  1 sibling, 1 reply; 4+ messages in thread
From: akuster808 @ 2019-11-24 16:46 UTC (permalink / raw)
  To: Niko Mauno, openembedded-devel

wrong ml

On 11/23/19 5:46 AM, Niko Mauno wrote:
> From: "niko.mauno@vaisala.com" <niko.mauno@vaisala.com>
>
> Avoid redundant shell working directory change by resorting to
> '--git-dir' option for git command instead.
>
> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta-oe/classes/gitpkgv.bbclass | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass
> index 2d9680a35..22609f584 100644
> --- a/meta-oe/classes/gitpkgv.bbclass
> +++ b/meta-oe/classes/gitpkgv.bbclass
> @@ -87,10 +87,8 @@ def get_git_pkgv(d, use_tags):
>  
>                  if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0:
>                      commits = bb.fetch2.runfetchcmd(
> -                        "cd %(repodir)s && "
> -                        "git rev-list %(rev)s -- 2> /dev/null "
> -                        "| wc -l" % vars,
> -                        d, quiet=True).strip().lstrip('0')
> +                        "git --git-dir=%(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l"
> +                        % vars, d, quiet=True).strip().lstrip('0')
>  
>                      if commits != "":
>                          oe.path.remove(rev_file, recurse=False)
> @@ -105,9 +103,8 @@ def get_git_pkgv(d, use_tags):
>                  if use_tags:
>                      try:
>                          output = bb.fetch2.runfetchcmd(
> -                            "cd %(repodir)s && "
> -                            "git describe %(rev)s 2>/dev/null" % vars,
> -                            d, quiet=True).strip()
> +                            "git --git-dir=%(repodir)s describe %(rev)s 2>/dev/null"
> +                            % vars, d, quiet=True).strip()
>                          ver = gitpkgv_drop_tag_prefix(output)
>                      except Exception:
>                          ver = "0.0-%s-g%s" % (commits, vars['rev'][:7])



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option
  2019-11-24 16:46 ` [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option akuster808
@ 2019-11-25 13:59   ` Peter Kjellerstedt
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2019-11-25 13:59 UTC (permalink / raw)
  To: akuster808, Niko Mauno, openembedded-devel

Uhm, what do you mean with "wrong ml"? Given that the 
gitpkgpv.bbclass is in meta-oe, this should be the correct 
mailing list for at patch to it...

//Peter

> -----Original Message-----
> From: openembedded-devel-bounces@lists.openembedded.org <openembedded-
> devel-bounces@lists.openembedded.org> On Behalf Of akuster808
> Sent: den 24 november 2019 17:46
> To: Niko Mauno <niko.mauno@iki.fi>; openembedded-
> devel@lists.openembedded.org
> Subject: Re: [oe] [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --
> git-dir option
> 
> wrong ml
> 
> On 11/23/19 5:46 AM, Niko Mauno wrote:
> > From: "niko.mauno@vaisala.com" <niko.mauno@vaisala.com>
> >
> > Avoid redundant shell working directory change by resorting to
> > '--git-dir' option for git command instead.
> >
> > Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta-oe/classes/gitpkgv.bbclass | 11 ++++-------
> >  1 file changed, 4 insertions(+), 7 deletions(-)
> >
> > diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-
> oe/classes/gitpkgv.bbclass
> > index 2d9680a35..22609f584 100644
> > --- a/meta-oe/classes/gitpkgv.bbclass
> > +++ b/meta-oe/classes/gitpkgv.bbclass
> > @@ -87,10 +87,8 @@ def get_git_pkgv(d, use_tags):
> >
> >                  if not os.path.exists(rev_file) or
> os.path.getsize(rev_file)==0:
> >                      commits = bb.fetch2.runfetchcmd(
> > -                        "cd %(repodir)s && "
> > -                        "git rev-list %(rev)s -- 2> /dev/null "
> > -                        "| wc -l" % vars,
> > -                        d, quiet=True).strip().lstrip('0')
> > +                        "git --git-dir=%(repodir)s rev-list %(rev)s --
> 2>/dev/null | wc -l"
> > +                        % vars, d, quiet=True).strip().lstrip('0')
> >
> >                      if commits != "":
> >                          oe.path.remove(rev_file, recurse=False)
> > @@ -105,9 +103,8 @@ def get_git_pkgv(d, use_tags):
> >                  if use_tags:
> >                      try:
> >                          output = bb.fetch2.runfetchcmd(
> > -                            "cd %(repodir)s && "
> > -                            "git describe %(rev)s 2>/dev/null" % vars,
> > -                            d, quiet=True).strip()
> > +                            "git --git-dir=%(repodir)s describe %(rev)s
> 2>/dev/null"
> > +                            % vars, d, quiet=True).strip()
> >                          ver = gitpkgv_drop_tag_prefix(output)
> >                      except Exception:
> >                          ver = "0.0-%s-g%s" % (commits, vars['rev'][:7])
> 
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-25 13:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-23 13:46 [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option Niko Mauno
2019-11-23 13:46 ` [meta-oe][warrior][PATCH 2/2] gitpkgv.bbclass: Support also lightweight tags Niko Mauno
2019-11-24 16:46 ` [meta-oe][warrior][PATCH 1/2] gitpkgv.bbclass: Use --git-dir option akuster808
2019-11-25 13:59   ` Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.