Message ID | 87sgdzo447.fsf@redhat.com |
---|---|
State | Superseded |
Headers |
Return-Path: <libabigail-bounces@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D6B3B3870924; Fri, 10 Jul 2020 14:07:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6B3B3870924 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594390064; bh=ZjaNHrch1TcVXhhpZiJIc4L+Ci4knwVIgPpjQBWVAgY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:Cc:From; b=WIyWKdMeLQdB4s/Ig3YqNaS9kD3Fe/C7g8RwSRqZwnhB+IiKlsuEKL66iMOBKlNOi id6QfDeiVlrTz37hHRegttSZb21bh7R1gknqOkDIqtFaeK23Z0q7HfMkuwHsVrlkdB MbdAwnk1tvMu4IcsFkBROpqzJz8z418UVPagCR8c= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id D42B13870924 for <libabigail@sourceware.org>; Fri, 10 Jul 2020 14:07:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D42B13870924 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-5dbbrIrSOjquL8VPKGJO0A-1; Fri, 10 Jul 2020 10:07:39 -0400 X-MC-Unique: 5dbbrIrSOjquL8VPKGJO0A-1 Received: by mail-wr1-f70.google.com with SMTP id i10so6135771wrn.21 for <libabigail@sourceware.org>; Fri, 10 Jul 2020 07:07:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:organization:date:message-id :user-agent:mime-version; bh=ZjaNHrch1TcVXhhpZiJIc4L+Ci4knwVIgPpjQBWVAgY=; b=GVlhkF6jv0JYL+3Dx2hk345Gnr2q8sxx3E4rZIye3eqCskXZSk4i5031T9/5TeO/aS omxVklyjT9f/qT7KntmEarAqAD8ZbNFXNSnsaMXtIS+NHXnPRSKKGWt/IGN4dSjT9QZM a6IbjmSdGl9apNI+h2zuPbWiomgLbtQgUP+TC4vUKGMel25JZBP8EotR1T+XL3OPCZKC txMmLK9Jq5R/aBFpICZqBbDOaR6Wkain0FhElzUGfJ3wIvAX3o14irMTqAv7ulOF9cKo ciRStvzfV0HrQwu0ZSZUe7UbvJs6fp3r2otbXctsU+E+yrQt6RcB4i/j4OMkhMMoZCBE peaw== X-Gm-Message-State: AOAM532tGyef+FSK26feMXpRLET2JCuBK1uFVkuPqz/s3DLH90vz0Avz swMGej161Alcyxd7nsgnio9mcX5+RgmD+UDa17JRrrXmViyQz7X2Zo1PYm4c28cNWoadtQPbPgH 0Tl2ft4NXIss5bCUQa9ML X-Received: by 2002:a05:600c:2209:: with SMTP id z9mr5264763wml.178.1594390058464; Fri, 10 Jul 2020 07:07:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhaXf3LOouUdcd9Tk5SNow3QgfymJZqJ7/mktape3etJauwFsvQBgWy5SDGFPB/2VkmomORA== X-Received: by 2002:a05:600c:2209:: with SMTP id z9mr5264738wml.178.1594390058218; Fri, 10 Jul 2020 07:07:38 -0700 (PDT) Received: from localhost (91-166-131-130.subs.proxad.net. [91.166.131.130]) by smtp.gmail.com with ESMTPSA id y77sm10723311wmd.36.2020.07.10.07.07.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jul 2020 07:07:37 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 654371800867; Fri, 10 Jul 2020 16:07:36 +0200 (CEST) To: Benjamin Kosnik <b.dekosnik@gmail.com>, Ben Woodard <woodard@redhat.com>, Chenxiong Qi <cqi@redhat.com>, Dodji Seketeli <dodji@redhat.com>, Giuliano Procida <gprocida@google.com>, Jan Engelhardt <jengelh@inai.de>, Jessica Yu <jeyu@kernel.org>, Jonathan Wakely <jwakely@redhat.com>, Mark Wielaard <mark@klomp.org>, Matthias Klose <doko@debian.org>, Matthias Maennich <maennich@google.com>, Ondrej Oprala <ondrej.oprala@gmail.com>, Roland McGrath <roland@hack.frob.com>, Sinny Kumari <skumari@redhat.com>, Slava Barinov <v.barinov@samsung.com> Subject: [PATCH 3/9] Add has-spdx-header.sh script Organization: Red Hat / France X-Operating-System: Red Hat Enterprise Linux Workstation 7.8 Beta X-URL: http://www.redhat.com Date: Fri, 10 Jul 2020 16:07:36 +0200 Message-ID: <87sgdzo447.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_MANYTO, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project <libabigail.sourceware.org> List-Unsubscribe: <http://sourceware.org/mailman/options/libabigail>, <mailto:libabigail-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libabigail/> List-Help: <mailto:libabigail-request@sourceware.org?subject=help> List-Subscribe: <http://sourceware.org/mailman/listinfo/libabigail>, <mailto:libabigail-request@sourceware.org?subject=subscribe> From: Dodji Seketeli via Libabigail <libabigail@sourceware.org> Reply-To: Dodji Seketeli <dodji@redhat.com> Cc: libabigail@sourceware.org Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" <libabigail-bounces@sourceware.org> |
Series |
Relicensing Libabigail to Apache 2.0 + LLVM Exception
|
|
Commit Message
Dodji Seketeli
July 10, 2020, 2:07 p.m. UTC
Add a script to detect if a file has a SPDX header and what the
advertised license is.
* relicensing-scripts/has-spdx-header.sh: New script.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
relicensing-scripts/has-spdx-header.sh | 102 +++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
create mode 100755 relicensing-scripts/has-spdx-header.sh
Comments
Do I really need to reply to all 9 patches and sign off on them? That means I have to actually review things like the script below, which isn't code I've contributed to, so I have no concerns about you adding this script under whatever license you want. But since you asked for it ... On 10/07/20 16:07 +0200, Dodji Seketeli wrote: >Add a script to detect if a file has a SPDX header and what the >advertised license is. > > * relicensing-scripts/has-spdx-header.sh: New script. > >Signed-off-by: Dodji Seketeli <dodji@redhat.com> >--- > relicensing-scripts/has-spdx-header.sh | 102 +++++++++++++++++++++++++++++++++ > 1 file changed, 102 insertions(+) > create mode 100755 relicensing-scripts/has-spdx-header.sh > >diff --git a/relicensing-scripts/has-spdx-header.sh b/relicensing-scripts/has-spdx-header.sh >new file mode 100755 >index 0000000..c2b0eca >--- /dev/null >+++ b/relicensing-scripts/has-spdx-header.sh >@@ -0,0 +1,102 @@ >+#!/bin/sh >+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception >+# Author: Dodji Seketeli <dodji@redhat.com> >+ >+file= >+prog=$0 >+display_file_name= >+be_quiet= >+show_no_spdx= >+ >+display_usage() >+{ >+ echo "$prog: [options] file" >+ echo " where options can be:" >+ echo " -h|--help display this help" >+ echo " -f|--file prefix output with file name" >+ echo " -q|--quiet emit no output if no license was found" >+ echo " --show-no-spdx show file name if it has no spdx header" >+} >+ >+emit_output_no_license() >+{ >+ if test x$show_no_spdx != x; then >+ echo $display_file_name >+ elif test x$be_quiet = x; then >+ if test "x$display_file_name" = x; then >+ echo "NO-LICENSE" >+ else >+ echo "$display_file_name: NO-LICENSE" >+ fi >+ fi >+ >+ exit 1 >+} >+ >+emit_output_with_license() >+{ >+ license=$1 >+ if test x$show_no_spdx != x; then >+ : >+ elif test "x$display_file_name" = x; then >+ echo "$license" >+ else >+ echo "$display_file_name: $license" >+ fi >+ exit 0 >+} >+ >+main() >+{ >+ header=$(head --lines=5 $file | grep "SPDX-License-Identifier:") >+ if test "x$header" != x; then >+ license=$(echo "$header" | sed -r "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/") >+ fi The separate grep seems unnecessary. license=$(head --lines=5 $file | sed -n -E "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/p") The -E option is the POSIX version of -r. The -n option and the 'p' suffix means only the matching line will be printed. >+ >+ if test "x$license" = x; then >+ emit_output_no_license >+ else >+ emit_output_with_license "$license" >+ fi >+} >+ >+while test $# -ge 1 >+do >+ case "$1" in >+ -h|--help) >+ display_usage >+ exit 1 Shouldn't it exit with status 0 when asked to print the usage? >+ ;; >+ >+ -f|--file) >+ if test x$2 = x; then >+ display_usage Should usage be printed to stderr when exiting with an error? >+ exit 1 >+ fi >+ display_file_name=$2 >+ ;; >+ >+ -q|--quiet) >+ be_quiet=yes >+ ;; >+ >+ --show-no-spdx) >+ if test x$2 = x; then >+ display_usage >+ exit 1 >+ fi >+ show_no_spdx=yes >+ display_file_name=$2 >+ ;; >+ esac >+ shift >+done >+ >+if test $# -lt 1; then >+ display_usage >+ exit 1 >+fi >+ >+file=$1 >+ >+main >-- >1.8.3.1 > > >-- > Dodji >
Jonathan Wakely <jwakely@redhat.com> writes: > Do I really need to reply to all 9 patches and sign off on them? Well, I guess you could have just responded to the cover letter with a blanket signoff, but I am glad you haven't, since you've caught lots of issues in your review and I am grateful for that. Thanks a lot. [...] >>+main() >>+{ >>+ header=$(head --lines=5 $file | grep "SPDX-License-Identifier:") >>+ if test "x$header" != x; then >>+ license=$(echo "$header" | sed -r "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/") >>+ fi > > The separate grep seems unnecessary. > > license=$(head --lines=5 $file | sed -n -E "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/p") > > The -E option is the POSIX version of -r. > > The -n option and the 'p' suffix means only the matching line will be > printed. You are right. Fixed. [...] >>+ >>+ if test "x$license" = x; then >>+ emit_output_no_license >>+ else >>+ emit_output_with_license "$license" >>+ fi >>+} >>+ >>+while test $# -ge 1 >>+do >>+ case "$1" in >>+ -h|--help) >>+ display_usage >>+ exit 1 > > Shouldn't it exit with status 0 when asked to print the usage? Done. > >>+ ;; >>+ >>+ -f|--file) >>+ if test x$2 = x; then >>+ display_usage > > Should usage be printed to stderr when exiting with an error? Done. [...] Here is the updated version of this patch. It'll be part of the v2 of the series that I'll be sending out shortly. Thanks! From d6822cba1036405e52a4eb6e53394bc46d6a4987 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli <dodji@redhat.com> Date: Wed, 27 May 2020 18:40:17 +0200 Subject: [PATCH 3/9] Add has-spdx-header.sh script Add a script to detect if a file has a SPDX header and what the advertised license is. * relicensing-scripts/has-spdx-header.sh: New script. Signed-off-by: Dodji Seketeli <dodji@redhat.com> Signed-off-by: Matthias Maennich <maennich@google.com> --- relicensing-scripts/has-spdx-header.sh | 105 +++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 relicensing-scripts/has-spdx-header.sh diff --git a/relicensing-scripts/has-spdx-header.sh b/relicensing-scripts/has-spdx-header.sh new file mode 100755 index 0000000..d4b7e08 --- /dev/null +++ b/relicensing-scripts/has-spdx-header.sh @@ -0,0 +1,105 @@ +#!/bin/sh +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Author: Dodji Seketeli <dodji@redhat.com> + +file= +prog=$0 +display_file_name= +be_quiet= +show_no_spdx= + +display_usage() +{ + echo "$prog: [options] file" + echo " where options can be:" + echo " -h|--help display this help" + echo " -f|--file prefix output with file name" + echo " -q|--quiet emit no output if no license was found" + echo " --show-no-spdx show file name if it has no spdx header" +} + +emit_output_no_license() +{ + if test x$show_no_spdx != x; then + echo $display_file_name + elif test x$be_quiet = x; then + if test "x$display_file_name" = x; then + echo "NO-LICENSE" + else + echo "$display_file_name: NO-LICENSE" + fi + fi + + exit 1 +} + +emit_output_with_license() +{ + license=$1 + if test x$show_no_spdx != x; then + : + elif test "x$display_file_name" = x; then + echo "$license" + else + echo "$display_file_name: $license" + fi + exit 0 +} + +main() +{ + license=$(head --lines=5 $file | sed -n -E "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/p") + + if test "x$license" = x; then + emit_output_no_license + else + emit_output_with_license "$license" + fi +} + +while test $# -ge 1 +do + case "$1" in + -h|--help) + display_usage + exit 0 + ;; + + -f|--file) + if test x$2 = x; then + >&2 display_usage + exit 1 + fi + display_file_name=$2 + shift + ;; + + -q|--quiet) + be_quiet=yes + shift + ;; + + --show-no-spdx) + if test x$2 = x; then + >&2 display_usage + exit 1 + fi + show_no_spdx=yes + display_file_name=$2 + shift + ;; + + *) + break + ;; + esac +done + +if test $# -lt 1; then + >&2 display_usage + exit 1 +fi + +file=$1 + +main
Hi. For 3/9, 4/9 and 5/9. On Mon, 13 Jul 2020 at 12:09, Dodji Seketeli <dodji@redhat.com> wrote: > > Jonathan Wakely <jwakely@redhat.com> writes: > > > Do I really need to reply to all 9 patches and sign off on them? > > Well, I guess you could have just responded to the cover letter with a > blanket signoff, but I am glad you haven't, since you've caught lots of > issues in your review and I am grateful for that. Thanks a lot. > > > [...] > > > >>+main() > >>+{ > >>+ header=$(head --lines=5 $file | grep "SPDX-License-Identifier:") > >>+ if test "x$header" != x; then > >>+ license=$(echo "$header" | sed -r "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/") > >>+ fi > > > > The separate grep seems unnecessary. > > > > license=$(head --lines=5 $file | sed -n -E "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/p") > > > > The -E option is the POSIX version of -r. > > > > The -n option and the 'p' suffix means only the matching line will be > > printed. > > You are right. Fixed. > > [...] > > >>+ > >>+ if test "x$license" = x; then > >>+ emit_output_no_license > >>+ else > >>+ emit_output_with_license "$license" > >>+ fi > >>+} > >>+ > >>+while test $# -ge 1 > >>+do > >>+ case "$1" in > >>+ -h|--help) > >>+ display_usage > >>+ exit 1 > > > > Shouldn't it exit with status 0 when asked to print the usage? > > Done. > > > > >>+ ;; > >>+ > >>+ -f|--file) > >>+ if test x$2 = x; then > >>+ display_usage > > > > Should usage be printed to stderr when exiting with an error? > > Done. > > [...] > > Here is the updated version of this patch. It'll be part of the v2 of > the series that I'll be sending out shortly. > > Thanks! > > > From d6822cba1036405e52a4eb6e53394bc46d6a4987 Mon Sep 17 00:00:00 2001 > From: Dodji Seketeli <dodji@redhat.com> > Date: Wed, 27 May 2020 18:40:17 +0200 > Subject: [PATCH 3/9] Add has-spdx-header.sh script > > Add a script to detect if a file has a SPDX header and what the > advertised license is. > > * relicensing-scripts/has-spdx-header.sh: New script. > > Signed-off-by: Dodji Seketeli <dodji@redhat.com> > Signed-off-by: Matthias Maennich <maennich@google.com> > --- > relicensing-scripts/has-spdx-header.sh | 105 +++++++++++++++++++++++++++++++++ > 1 file changed, 105 insertions(+) > create mode 100755 relicensing-scripts/has-spdx-header.sh > > diff --git a/relicensing-scripts/has-spdx-header.sh b/relicensing-scripts/has-spdx-header.sh > new file mode 100755 > index 0000000..d4b7e08 > --- /dev/null > +++ b/relicensing-scripts/has-spdx-header.sh > @@ -0,0 +1,105 @@ > +#!/bin/sh > +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception > +# Author: Dodji Seketeli <dodji@redhat.com> > + > +file= > +prog=$0 > +display_file_name= > +be_quiet= > +show_no_spdx= > + > +display_usage() > +{ > + echo "$prog: [options] file" > + echo " where options can be:" > + echo " -h|--help display this help" > + echo " -f|--file prefix output with file name" > + echo " -q|--quiet emit no output if no license was found" > + echo " --show-no-spdx show file name if it has no spdx header" > +} > + > +emit_output_no_license() > +{ > + if test x$show_no_spdx != x; then > + echo $display_file_name > + elif test x$be_quiet = x; then > + if test "x$display_file_name" = x; then > + echo "NO-LICENSE" > + else > + echo "$display_file_name: NO-LICENSE" > + fi > + fi > + > + exit 1 > +} > + > +emit_output_with_license() > +{ > + license=$1 > + if test x$show_no_spdx != x; then > + : > + elif test "x$display_file_name" = x; then > + echo "$license" > + else > + echo "$display_file_name: $license" > + fi > + exit 0 > +} > + > +main() > +{ > + license=$(head --lines=5 $file | sed -n -E "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/p") > + > + if test "x$license" = x; then > + emit_output_no_license > + else > + emit_output_with_license "$license" > + fi > +} > + > +while test $# -ge 1 > +do > + case "$1" in > + -h|--help) > + display_usage > + exit 0 > + ;; > + > + -f|--file) > + if test x$2 = x; then > + >&2 display_usage > + exit 1 > + fi > + display_file_name=$2 > + shift > + ;; > + > + -q|--quiet) > + be_quiet=yes > + shift > + ;; > + > + --show-no-spdx) > + if test x$2 = x; then > + >&2 display_usage > + exit 1 > + fi > + show_no_spdx=yes > + display_file_name=$2 > + shift > + ;; > + > + *) > + break > + ;; > + esac > +done > + > +if test $# -lt 1; then > + >&2 display_usage > + exit 1 > +fi > + > +file=$1 > + > +main > -- > 1.8.3.1 > > > -- > Dodji > Signed-off-by: Giuliano Procida <gprocida@google.com>
diff --git a/relicensing-scripts/has-spdx-header.sh b/relicensing-scripts/has-spdx-header.sh new file mode 100755 index 0000000..c2b0eca --- /dev/null +++ b/relicensing-scripts/has-spdx-header.sh @@ -0,0 +1,102 @@ +#!/bin/sh +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Author: Dodji Seketeli <dodji@redhat.com> + +file= +prog=$0 +display_file_name= +be_quiet= +show_no_spdx= + +display_usage() +{ + echo "$prog: [options] file" + echo " where options can be:" + echo " -h|--help display this help" + echo " -f|--file prefix output with file name" + echo " -q|--quiet emit no output if no license was found" + echo " --show-no-spdx show file name if it has no spdx header" +} + +emit_output_no_license() +{ + if test x$show_no_spdx != x; then + echo $display_file_name + elif test x$be_quiet = x; then + if test "x$display_file_name" = x; then + echo "NO-LICENSE" + else + echo "$display_file_name: NO-LICENSE" + fi + fi + + exit 1 +} + +emit_output_with_license() +{ + license=$1 + if test x$show_no_spdx != x; then + : + elif test "x$display_file_name" = x; then + echo "$license" + else + echo "$display_file_name: $license" + fi + exit 0 +} + +main() +{ + header=$(head --lines=5 $file | grep "SPDX-License-Identifier:") + if test "x$header" != x; then + license=$(echo "$header" | sed -r "s/^.*(SPDX-License-Identifier:)[ ]*([^*/]+).*$/\2/") + fi + + if test "x$license" = x; then + emit_output_no_license + else + emit_output_with_license "$license" + fi +} + +while test $# -ge 1 +do + case "$1" in + -h|--help) + display_usage + exit 1 + ;; + + -f|--file) + if test x$2 = x; then + display_usage + exit 1 + fi + display_file_name=$2 + ;; + + -q|--quiet) + be_quiet=yes + ;; + + --show-no-spdx) + if test x$2 = x; then + display_usage + exit 1 + fi + show_no_spdx=yes + display_file_name=$2 + ;; + esac + shift +done + +if test $# -lt 1; then + display_usage + exit 1 +fi + +file=$1 + +main