]> xenbits.xensource.com Git - pvdrivers/win/xencons.git/commit
Scripted replacement of Copyright notices in source
authorOwen Smith <owen.smith@citrix.com>
Thu, 23 Feb 2023 09:47:26 +0000 (09:47 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Thu, 23 Mar 2023 16:11:57 +0000 (16:11 +0000)
commit2bef7c630f20a2d3351cdb4b12f2cb021ec347d3
tree034f5d9f2605964e7fd6948d197555b90ddde5a4
parentda350782187920bdd7a11f54e18c9e1859407ad9
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>
48 files changed:
LICENSE
include/cache_interface.h
include/console_interface.h
include/debug_interface.h
include/evtchn_interface.h
include/gnttab_interface.h
include/store_interface.h
include/suspend_interface.h
include/xen-types.h
include/xen-version.h
include/xen-warnings.h
include/xen.h
include/xencons_device.h
src/coinst/coinst.c
src/coinst/xencons_coinst.def
src/coinst/xencons_coinst.rc
src/monitor/messages.mc
src/monitor/monitor.c
src/monitor/xencons_monitor.rc
src/tty/tty.c
src/tty/xencons_tty.rc
src/xencons.inf
src/xencons/assert.h
src/xencons/console.c
src/xencons/console.h
src/xencons/console_abi.h
src/xencons/dbg_print.h
src/xencons/driver.c
src/xencons/driver.h
src/xencons/fdo.c
src/xencons/fdo.h
src/xencons/frontend.c
src/xencons/frontend.h
src/xencons/mutex.h
src/xencons/names.h
src/xencons/pdo.c
src/xencons/pdo.h
src/xencons/registry.c
src/xencons/registry.h
src/xencons/ring.c
src/xencons/ring.h
src/xencons/stream.c
src/xencons/stream.h
src/xencons/thread.c
src/xencons/thread.h
src/xencons/types.h
src/xencons/util.h
src/xencons/xencons.rc