]> xenbits.xensource.com Git - pvdrivers/win/xennet.git/commit
Scripted replacement of Copyright notices in source
authorOwen Smith <owen.smith@citrix.com>
Thu, 23 Feb 2023 09:50:43 +0000 (09:50 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Thu, 23 Mar 2023 16:50:05 +0000 (16:50 +0000)
commit813f166e94d80fe26d46efe11e2481c718be2078
tree7487b86aa22cf5e1d996fd313ad8ca79ba1c57a8
parent593036dcb63b5bc2f01fd345884dcee45cb1792f
Scripted replacement of Copyright notices in source

Due to a transfer of copyright ownership from Citrix to Cloud Software Group,
the copyright notices in all source files should be updated.

Using the powershell script below replace "Copyright (c) Citrix Systems, Inc."
with "Copyright (c) Xen Project." and "Copyright (c) Cloud Software Group, Inc."

Function Multiline-Replace {
    param(
        [string]$Filename,
        [string]$ToReplace,
        [array]$ReplaceWith
    )

    $content = Get-Content $Filename
    $replace = $false
    $output = ""
    $content | ForEach {
        $line = $_
        if ($line.Contains($ToReplace)) {
            $replace = $true
            $ReplaceWith | ForEach {
                $output += $line.Replace($ToReplace, $_) + "`n"
            }
        } else {
            $output += $line + "`n"
        }
    }
    if ($replace) {
        Write-Host "Replacing: " $Filename
        $output | Set-Content $Filename
    } else {
        Write-Host "Ignoring:  " $Filename
    }
}

Function Replace-Filestrings {
    param(
        [array]$FilleTypes,
        [string]$ToReplace,
        [array]$Replacements,
        [array]$ExcludeList
    )

    $FileTypes | ForEach {
        Get-ChildItem $_ -Recurse | ForEach-Object {
            $filename = $_
            if (($ExcludeList | %{ $filename -Like $_ }) -Contains $True) {
                Write-Host "Excluding: " $filename
            } else {
                Multiline-Replace $_ $ToReplace $Replacements
            }
        }
    }
}

$ExcludeList = @("*include\xen\*", "*\obj\*")
$Replace = "Copyright (c) Citrix Systems Inc."

$Replacements = @("/* Copyright (c) Xen Project.", " * Copyright (c) Cloud Software Group, Inc.")
$FileTypes = @("*.c", "*.h", "*.rc")
Replace-Filestrings $FileTypes ('/* ' + $Replace) $Replacements $ExcludeList

$Replacements = @("; // Copyright (c) Xen Project.", "; // Copyright (c) Cloud Software Group, Inc.")
$FileTypes = @("*.mc")
Replace-Filestrings $FileTypes ('; // ' + $Replace) $Replacements $ExcludeList

$Replacements = @("; Copyright (c) Xen Project.", "; Copyright (c) Cloud Software Group, Inc.")
$FileTypes = @("*.inf", "*.def")
Replace-Filestrings $FileTypes ('; ' + $Replace) $Replacements $ExcludeList

$Replacements = @("Copyright (c) Xen Project.", "Copyright (c) Cloud Software Group, Inc.")
$FileTypes = @("LICENSE")
Replace-Filestrings $FileTypes $Replace $Replacements $ExcludeList

Signed-off-by: Owen Smith <owen.smith@citrix.com>
Amended commit comment. Fixed whitespace.

Signed-off-by: Paul Durrant <paul@xen.org>
30 files changed:
LICENSE
include/ethernet.h
include/store_interface.h
include/suspend_interface.h
include/tcpip.h
include/vif_interface.h
include/xen-types.h
include/xen-version.h
include/xen-warnings.h
include/xen.h
src/coinst/coinst.c
src/coinst/xennet_coinst.def
src/coinst/xennet_coinst.rc
src/xennet.inf
src/xennet/adapter.c
src/xennet/adapter.h
src/xennet/assert.h
src/xennet/dbg_print.h
src/xennet/driver.c
src/xennet/driver.h
src/xennet/miniport.c
src/xennet/miniport.h
src/xennet/receiver.c
src/xennet/receiver.h
src/xennet/string.c
src/xennet/string.h
src/xennet/transmitter.c
src/xennet/transmitter.h
src/xennet/util.h
src/xennet/xennet.rc