public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: Giuliano Procida <gprocida@google.com>
Cc: libabigail@sourceware.org
Subject: Re: [PATCH 4/9 v2] Add replace-spdx-license.sh script
Date: Thu, 03 Sep 2020 16:47:10 +0200	[thread overview]
Message-ID: <87r1riudch.fsf@redhat.com> (raw)
In-Reply-To: <CAGvU0Hnxmptf3irjhOV1SJcfXfQtas8+ttj3kvFyCWzCBFETPw@mail.gmail.com> (Giuliano Procida's message of "Thu, 3 Sep 2020 07:30:49 +0100")

Giuliano Procida <gprocida@google.com> writes:

> FTR
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>

Thanks Giuliano,

I have updated the licensing branch accordingly!

Cheers!

>
> On Wed, 15 Jul 2020 at 16:14, Dodji Seketeli <dodji@redhat.com> wrote:
>
>> This script is to replace an SPDX license ID by another one.
>> I.e, it's to perform an actual re-licensing of a given file.
>>
>> A way to use the script is this:
>>
>>     replace-spdx-license.sh  --from LGPL-3.0-or-later \
>>                               --to  "Apache-2.0 WITH LLVM-exception" \
>>                               some-file-to-relicense.cc
>>
>>         * relicensing-scripts/replace-spdx-license.sh: New script.
>>
>> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
>> Signed-off-by: Matthias Maennich <maennich@google.com>
>> ---
>>  relicensing-scripts/replace-spdx-license.sh | 75
>> +++++++++++++++++++++++++++++
>>  1 file changed, 75 insertions(+)
>>  create mode 100755 relicensing-scripts/replace-spdx-license.sh
>>
>> diff --git a/relicensing-scripts/replace-spdx-license.sh
>> b/relicensing-scripts/replace-spdx-license.sh
>> new file mode 100755
>> index 0000000..f634528
>> --- /dev/null
>> +++ b/relicensing-scripts/replace-spdx-license.sh
>> @@ -0,0 +1,75 @@
>> +#!/bin/sh
>> +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
>> +# Author: Dodji Seketeli <dodji@redhat.com>
>> +
>> +from_license_id=
>> +to_license_id=
>> +input_file=
>> +prog=$0
>> +
>> +display_usage()
>> +{
>> +    echo "$prog: [options] --from <from-spdx-license-id> --to
>> <to-spdx-license-id> <file>"
>> +    echo "  where options can be:"
>> +    echo "   -h|--h            display this help"
>> +}
>> +
>> +main()
>> +{
>> +    header=$(head --lines=5 $input_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 -a "$license" = "$from_license_id"; then
>> +       sed -i -r "s/$from_license_id/$to_license_id/" $input_file
>> +       exit 0
>> +    fi
>> +
>> +    exit 1
>> +}
>> +
>> +# This program takes at least 5 arguments
>> +if test $# -lt 5; then
>> +    >&2 display_usage
>> +    exit 1
>> +fi
>> +
>> +# Parse parameters
>> +while test $# -gt 1; do
>> +    case "$1" in
>> +       -h|--h)
>> +           display_usage
>> +           exit 0
>> +           ;;
>> +
>> +       -f|--from)
>> +           from_license_id=$2
>> +           shift
>> +           ;;
>> +
>> +       -t|--to)
>> +           to_license_id=$2
>> +           shift
>> +           ;;
>> +
>> +       -*)
>> +           >&2 display_usage
>> +           exit 1
>> +           ;;
>> +
>> +       *)
>> +           input_file="$1"
>> +           ;;
>> +    esac
>> +    shift
>> +done
>> +
>> +if test $# -lt 1; then
>> +    >&2 display_usage
>> +    exit 1
>> +fi
>> +
>> +input_file=$1
>> +
>> +main
>> --
>> 1.8.3.1
>>
>>
>> --
>>                 Dodji
>>
>>

-- 
		Dodji


  parent reply	other threads:[~2020-09-03 14:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 15:02 [PATCH 0/9 v2] Relicensing Libabigail to Apache 2.0 + LLVM Exception Dodji Seketeli
2020-07-15 15:11 ` [PATCH 1/9 v2] Replace individual license references with SPDX Identifiers Dodji Seketeli
2020-09-24 10:09   ` Jonathan Wakely
2020-09-24 10:14     ` Jonathan Wakely
2020-09-25  8:38     ` Dodji Seketeli
2020-09-25 10:06       ` Jonathan Wakely
2020-09-25 12:30         ` Dodji Seketeli
2020-07-15 15:11 ` [PATCH 2/9 v2] Add missing SPDX headers to source files not specifying any license Dodji Seketeli
2020-07-15 15:13 ` [PATCH 3/9 v2] Add has-spdx-header.sh script Dodji Seketeli
2020-07-16 10:26   ` Jonathan Wakely
2020-07-16 16:20     ` Dodji Seketeli
2020-07-15 15:13 ` [PATCH 4/9 v2] Add replace-spdx-license.sh script Dodji Seketeli
2020-07-16 10:27   ` Jonathan Wakely
2020-07-16 16:20     ` Dodji Seketeli
     [not found]   ` <CAGvU0Hnxmptf3irjhOV1SJcfXfQtas8+ttj3kvFyCWzCBFETPw@mail.gmail.com>
2020-09-03 14:47     ` Dodji Seketeli [this message]
2020-07-15 15:14 ` [PATCH 5/9 v2] Add helper files to perform the re-licensing Dodji Seketeli
     [not found]   ` <20200716103259.GZ4137376@redhat.com>
     [not found]     ` <874kq7jup5.fsf@redhat.com>
2020-09-24 10:12       ` Jonathan Wakely
2020-07-15 15:15 ` [PATCH 6/9 v2] Re-license the project to Apache v2 With LLVM Exception Dodji Seketeli
2020-07-16 10:33   ` Jonathan Wakely
2020-07-16 16:23     ` Dodji Seketeli
2020-07-15 15:16 ` [PATCH 7/9 v2] Add the LICENSE.txt file Dodji Seketeli
2020-07-15 15:17 ` [PATCH 8/9 v2] Delete COPYING* files Dodji Seketeli
2020-07-16 10:34   ` Jonathan Wakely
2020-07-16 16:23     ` Dodji Seketeli
2020-07-15 15:17 ` [PATCH 9/9 v2] Add a license-change-2020.txt file Dodji Seketeli
2020-07-16 10:35   ` Jonathan Wakely
2020-07-16 16:23     ` Dodji Seketeli
2020-07-16 16:01 ` [PATCH 0/9 v2] Relicensing Libabigail to Apache 2.0 + LLVM Exception Jessica Yu
2020-07-17 11:43   ` Dodji Seketeli
     [not found] <CGME20200903075248eucas1p2dcc11b3b1b24390a5da8bdc676bfd6b3@eucas1p2.samsung.com>
     [not found] ` <878sdruwk7.fsf@redhat.com>
2020-09-03  8:18   ` Please signoff libabigail relicensing. Was "[PATCH 0/9 v2] Relicensing Libabigail to Apache 2.0 + LLVM Exception" Vyacheslav Barinov
2020-09-03 14:40     ` Dodji Seketeli
2020-09-03  9:48   ` [PATCH 0/9 v2] Relicensing Libabigail to Apache 2.0 + LLVM Exception Jan Engelhardt
2020-09-03 14:39     ` Dodji Seketeli
     [not found]   ` <CAJxw1w=7C_MhOQ5E6dns9-7yD4qOcsBG52BtupCu3nv-L82Jiw@mail.gmail.com>
2020-09-03 14:39     ` Please signoff libabigail relicensing. Was "[PATCH 0/9 v2] Relicensing Libabigail to Apache 2.0 + LLVM Exception" Dodji Seketeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1riudch.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=gprocida@google.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).