Message ID | 87o8ono43a.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 319B73870924; Fri, 10 Jul 2020 14:08:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 319B73870924 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594390103; bh=p4cKw89ZEPEFe0i7Gyc3fGiMQnjeotvgx7klEEcj6uM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:Cc:From; b=JipltKxF/MxYXkaXyVdQiwFK6/YqNKnD18msqk1D4BgKCRH3bVtkpWwsLDzHtxBik nYUbL4ijpLfkVrc6MsHz+0jPb+mUYr2SxYc1+gVVTdWmXZcH5GVHLnlmrzWEPHDaR9 jORWDZ23SM1F/CdBstSKsZbldSCRfqUPPN1qWTsI= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 893F43870924 for <libabigail@sourceware.org>; Fri, 10 Jul 2020 14:08:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 893F43870924 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-KtRvWF5pPOKq1Gi-QUmr3A-1; Fri, 10 Jul 2020 10:08:13 -0400 X-MC-Unique: KtRvWF5pPOKq1Gi-QUmr3A-1 Received: by mail-wr1-f72.google.com with SMTP id c6so6155669wru.7 for <libabigail@sourceware.org>; Fri, 10 Jul 2020 07:08:12 -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=p4cKw89ZEPEFe0i7Gyc3fGiMQnjeotvgx7klEEcj6uM=; b=PQb6uUqw0QS/0cYGCSi8LXE9PAJTqtEbiz68KaC2IfONhBnUGMcydqHAyNnu/NWu9g bWbALQQVqGCnr+Vn2Ttgmp2z3KJh47glbZxrrWDOIlCjJnQ72lubRCuUNZ5c7BykpDFX H9v8iKdQR87eTBVDDMCJlNwSU3Fq9D9oeIeIIcYobR2RHiXFj7PTNmH9x9ybgTMP2a+p X+YqVqkzW1arrt/XxZ3UAMMDkF9nDgtuzoTOGC0I/hehHs4AoeT+h4IsaiK8zVDkPkwl w3tuZeQ/m9TkR76WA58NKoIM+I1yyRzkkhSLlCK+KPm4pELCobt7eQbW949lp60+XMow 9gfQ== X-Gm-Message-State: AOAM533RkkcS6rul/ir9lKNSYcL8pHOQC7FFYJvqVhq8DjY/WlW06HFO ZD9xpxHuiYJ/DugGDTrDrhQ1+wJHvig9IM5mXsXZXd/pkw/jwtS8Kzk4Yl2G3KBXS5CAgrIlw6q +BjncE2jJXzxyuzqP8sx2 X-Received: by 2002:a5d:4710:: with SMTP id y16mr70588806wrq.189.1594390091890; Fri, 10 Jul 2020 07:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQzi06uJyJ1ihRCB27gyvVaatShTV3WwWy1kI5Eze8RX9gQ2eF2AzMboCNFHFPqO6LAfmVZQ== X-Received: by 2002:a5d:4710:: with SMTP id y16mr70588780wrq.189.1594390091588; Fri, 10 Jul 2020 07:08:11 -0700 (PDT) Received: from localhost (91-166-131-130.subs.proxad.net. [91.166.131.130]) by smtp.gmail.com with ESMTPSA id 190sm10479921wmb.15.2020.07.10.07.08.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jul 2020 07:08:10 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 9EB3A180097F; Fri, 10 Jul 2020 16:08:09 +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 4/9] Add replace-spdx-license.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:08:09 +0200 Message-ID: <87o8ono43a.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.4 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:08 p.m. UTC
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>
---
relicensing-scripts/replace-spdx-license.sh | 75 +++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
create mode 100755 relicensing-scripts/replace-spdx-license.sh
Comments
On 10/07/20 16:08 +0200, Dodji Seketeli 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> >--- > 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..5fdbc91 >--- /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 >+ display_usage >+ exit 1 >+fi >+ >+# Parse parameters >+while test $# -gt 1; do >+ case "$1" in >+ -h|--h) >+ display_usage >+ exit 1 Same comment again. I'd exit 0 for --help, and redirect the display_usage output to stderr for the other cases where it really is incorrect usage. >+ ;; >+ >+ -f|--from) >+ from_license_id=$2 >+ shift >+ ;; >+ >+ -t|--to) >+ to_license_id=$2 >+ shift >+ ;; >+ >+ -*) >+ display_usage >+ exit 1 >+ ;; >+ >+ *) >+ input_file="$1" >+ ;; >+ esac >+ shift >+done >+ >+if test $# -lt 1; then >+ display_usage >+ exit 1 >+fi >+ >+input_file=$1 >+ >+main >-- >1.8.3.1 > > >-- > Dodji >
Jonathan Wakely <jwakely@redhat.com> writes: [...] >>+# Parse parameters >>+while test $# -gt 1; do >>+ case "$1" in >>+ -h|--h) >>+ display_usage >>+ exit 1 > > Same comment again. I'd exit 0 for --help, and redirect the > display_usage output to stderr for the other cases where it really is > incorrect usage. Fixed. Here is the updated patch that is going to be part of a v2 series that I'll send out shortly. Cheers, From 67c937cc936a46e0952fd683ff57f50ed605d0ba Mon Sep 17 00:00:00 2001 From: Dodji Seketeli <dodji@redhat.com> Date: Fri, 29 May 2020 10:45:34 +0200 Subject: [PATCH 4/9] Add replace-spdx-license.sh script 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
diff --git a/relicensing-scripts/replace-spdx-license.sh b/relicensing-scripts/replace-spdx-license.sh new file mode 100755 index 0000000..5fdbc91 --- /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 + display_usage + exit 1 +fi + +# Parse parameters +while test $# -gt 1; do + case "$1" in + -h|--h) + display_usage + exit 1 + ;; + + -f|--from) + from_license_id=$2 + shift + ;; + + -t|--to) + to_license_id=$2 + shift + ;; + + -*) + display_usage + exit 1 + ;; + + *) + input_file="$1" + ;; + esac + shift +done + +if test $# -lt 1; then + display_usage + exit 1 +fi + +input_file=$1 + +main