Skip to content

Commit

Permalink
Merge all upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
glebarez committed Jan 28, 2023
1 parent 4143dc8 commit b8c64c3
Show file tree
Hide file tree
Showing 15 changed files with 791 additions and 67 deletions.
5 changes: 4 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@

Artyom Pervukhin <[email protected]>
Dan Peterson <[email protected]>
David Walton <[email protected]>
Davsk Ltd Co <[email protected]>
Jaap Aarts <[email protected]>
Jan Mercl <[email protected]>
Josh Bleecher Snyder <[email protected]>
Logan Snow <[email protected]>
Michael Hoffmann <[email protected]>
Ross Light <[email protected]>
Steffen Butzer <steffen(dot)[email protected]>
Saed SayedAhmed <[email protected]>
Steffen Butzer <steffen(dot)[email protected]>
Michael Rykov <[email protected]>
6 changes: 6 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ Alexander Menzhinsky <[email protected]>
Artyom Pervukhin <[email protected]>
Dan Peterson <[email protected]>
David Skinner <[email protected]>
David Walton <[email protected]>
Elle Mouton <[email protected]>
FlyingOnion <[email protected]>
Gleb Sakhnov <[email protected]>
Jaap Aarts <[email protected]>
Jan Mercl <[email protected]>
Josh Bleecher Snyder <[email protected]>
Logan Snow <[email protected]>
Matthew Gabeler-Lee <[email protected]>
Michael Hoffmann <[email protected]>
Ross Light <[email protected]>
Saed SayedAhmed <[email protected]>
Steffen Butzer <steffen(dot)[email protected]>
Yaacov Akiba Slama <[email protected]>
Saed SayedAhmed <[email protected]>
Michael Rykov <[email protected]>
64 changes: 64 additions & 0 deletions addport.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2022 The Sqlite Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build ignore
// +build ignore

package main

import (
"fmt"
"os"
"path/filepath"
"strings"
)

func fail(rc int, msg string, args ...interface{}) {
fmt.Fprintf(os.Stderr, msg, args...)
os.Exit(rc)
}

func main() {
if len(os.Args) != 3 {
fail(1, "expected 2 args: pattern and replacement\n")
}

pattern := os.Args[1]
replacement := os.Args[2]
if err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}

if info.IsDir() {
return nil
}

dir, file := filepath.Split(path)
if x := strings.Index(file, pattern); x >= 0 {
// pattern freebsd
// replacement netbsd
// file libc_freebsd_amd64.go
// replaced libc_netbsd_amd64.go
// 01234567890123456789
// 1
// x 5
file = file[:x] + replacement + file[x+len(pattern):]
dst := filepath.Join(dir, file)
b, err := os.ReadFile(path)
if err != nil {
return fmt.Errorf("reading %s: %v", path, err)
}

if err := os.WriteFile(dst, b, 0640); err != nil {
return fmt.Errorf("writing %s: %v", dst, err)
}
fmt.Printf("%s -> %s\n", path, dst)
}

return nil
}); err != nil {
fail(1, "%s", err)
}
}
Loading

0 comments on commit b8c64c3

Please sign in to comment.