From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 53DDF3850402 for ; Thu, 3 Sep 2020 14:47:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 53DDF3850402 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-549-XMZ_QWE9NaiB5n7tKLc3Bg-1; Thu, 03 Sep 2020 10:47:13 -0400 X-MC-Unique: XMZ_QWE9NaiB5n7tKLc3Bg-1 Received: by mail-wr1-f69.google.com with SMTP id f18so1155479wrv.19 for ; Thu, 03 Sep 2020 07:47:13 -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:references:date :in-reply-to:message-id:user-agent:mime-version; bh=4F0Id1LrzDECvHhM/q3X7ooNx766JCS5zirhV8EXkuw=; b=Lo32n9gPhhKc2piVZCqWTDBQ3Ob8N91ZAWooSVuU+wtYCVna5xpKv7iARRkLnxg8e6 AueOer5g94VjL6qJ/XWL8DYuuXHcZNLOBGT4H13vgQwa86rj5TpRuDG+3aT4hBuGWNpn cCmqw8GNF9eqguBT8fodK7zy9hyHkLXpbDb/O6/vAVwhKH1MG4E6SpRbPI7zdrHXaRsA 9q5xmyrgxxLLYS2UOiAbK2NBmjJQc0vDuV8zy+6NxP5zkMfX/3qIB/9GBg3l56aPJZ5G oN4DOWQtzf0YLzQVEzJXfjc+fKVjF2Up/09GOZeoKV+g32dyStAvY2a8jmAY4z/AMDEw 8Rtw== X-Gm-Message-State: AOAM531o0BWhhxCYFXT2JKgPiugXffXzGtWqTCSTWmldCtWgKY9gOv/V Y7uILfKp1wkkCDFgFa2dX+3iRR2jbBIuI03y/3h5N7K9eOQgR+KOqdA1H+5RVA2psslEn9jk1s3 DuY5rm741FYhcPGGZCJRi X-Received: by 2002:a5d:4c90:: with SMTP id z16mr3052128wrs.170.1599144432451; Thu, 03 Sep 2020 07:47:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkNFm6nfpoJwKzkqm2xEJ447pD5FzUglcSm5wH8bTFbSnRE0dNncRBPfM7ITyLDBlcHmpvpg== X-Received: by 2002:a5d:4c90:: with SMTP id z16mr3052101wrs.170.1599144432158; Thu, 03 Sep 2020 07:47:12 -0700 (PDT) Received: from localhost (91-166-131-130.subs.proxad.net. [91.166.131.130]) by smtp.gmail.com with ESMTPSA id l9sm4791684wmh.1.2020.09.03.07.47.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2020 07:47:11 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 5A03718008A5; Thu, 3 Sep 2020 16:47:10 +0200 (CEST) From: Dodji Seketeli To: Giuliano Procida Cc: libabigail@sourceware.org Subject: Re: [PATCH 4/9 v2] Add replace-spdx-license.sh script Organization: Red Hat / France References: <87zh80lt38.fsf@redhat.com> <87d04wlsk8.fsf@redhat.com> X-Operating-System: Red Hat Enterprise Linux Workstation 7.8 Beta X-URL: http://www.redhat.com Date: Thu, 03 Sep 2020 16:47:10 +0200 In-Reply-To: (Giuliano Procida's message of "Thu, 3 Sep 2020 07:30:49 +0100") Message-ID: <87r1riudch.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.001 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2020 14:47:18 -0000 Giuliano Procida writes: > FTR > > Signed-off-by: Giuliano Procida Thanks Giuliano, I have updated the licensing branch accordingly! Cheers! > > On Wed, 15 Jul 2020 at 16:14, 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 >> Signed-off-by: Matthias Maennich >> --- >> 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 >> + >> +from_license_id= >> +to_license_id= >> +input_file= >> +prog=$0 >> + >> +display_usage() >> +{ >> + echo "$prog: [options] --from --to >> " >> + 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