Skip to content

Commit

Permalink
update copyright headers (#511)
Browse files Browse the repository at this point in the history
update copyright headers
  • Loading branch information
eeeebbbbrrrr authored Mar 28, 2022
1 parent 0a473d2 commit 4d3a9a7
Show file tree
Hide file tree
Showing 199 changed files with 1,848 additions and 339 deletions.
59 changes: 51 additions & 8 deletions .licensure.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,57 @@
author: ZomboDB, LLC
ident: MIT
email: [email protected]
change_in_place: true
excludes:
- Cargo.toml
- ".*\\.h"
- "\\.cargo/config"
- Cargo.lock
- LICENSE
- pgx-utils/assets/ansi.tmTheme
- ".envrc"
- ".gitignore"
- "flake\\..*"
- "logo.*"
- ".github/**/*"
- ".cargo/config"
- "cargo-pgx/src/templates/*"
- ".github/workflows/*"
- ".*\\.control"
- ".*\\.md"
- ".*\\.nix"
- ".*\\.yml"
- ".*\\.sh"
- load-order.txt
licenses:
- files: any
ident: MIT
authors:
- name: Technology Concepts & Design, Inc.
email: [email protected]
template: |
Portions Copyright 2019-2021 ZomboDB, LLC.
Portions Copyright 2021-[year] [name of author]
All rights reserved.
Use of this source code is governed by the [ident] license that can be found in the LICENSE file.
comments:
- columns: 120
extensions:
- rs
- c
- h
- sql
commenter:
type: block
start_block_char: "/*\n"
end_block_char: "\n*/\n"
- columns: 120
extension: html
commenter:
type: block
start_block_char: "<!--\n"
end_block_char: "-->"
- columns: 80
extension: any
commenter:
type: line
comment_char: "#"
trailing_lines: 0

4 changes: 3 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
MIT License

Copyright (c) 2020 ZomboDB, LLC
Portions Copyright 2019-2021 ZomboDB, LLC.
Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <[email protected]>.
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ time goes on. Your feedback about what you'd like to be able to do with `pgx` i
## License

```
Copyright 2020 ZomboDB, LLC <[email protected]>. All rights reserved.
Portions Copyright 2019-2021 ZomboDB, LLC.
Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <[email protected]>.
All rights reserved.
Use of this source code is governed by the MIT license that can be found in the LICENSE file.
```
42 changes: 27 additions & 15 deletions cargo-pgx/src/command/connect.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// Copyright 2020 ZomboDB, LLC <[email protected]>. All rights reserved. Use of this source code is
// governed by the MIT license that can be found in the LICENSE file.
/*
Portions Copyright 2019-2021 ZomboDB, LLC.
Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <[email protected]>
All rights reserved.
Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

use crate::{
command::{get::get_property, run::exec_psql, start::start_postgres},
Expand Down Expand Up @@ -47,11 +53,13 @@ impl CommandExecute for Connect {
// It's actually the dbname! We should infer from the manifest.
self.dbname = Some(pg_version);

let metadata = crate::metadata::metadata(&Default::default(), self.manifest_path.as_ref())
.wrap_err("couldn't get cargo metadata")?;
let metadata =
crate::metadata::metadata(&Default::default(), self.manifest_path.as_ref())
.wrap_err("couldn't get cargo metadata")?;
crate::metadata::validate(&metadata)?;
let package_manifest_path = crate::manifest::manifest_path(&metadata, self.package.as_ref())
.wrap_err("Couldn't get manifest path")?;
let package_manifest_path =
crate::manifest::manifest_path(&metadata, self.package.as_ref())
.wrap_err("Couldn't get manifest path")?;
let package_manifest = Manifest::from_path(&package_manifest_path)
.wrap_err("Couldn't parse manifest")?;

Expand All @@ -62,11 +70,13 @@ impl CommandExecute for Connect {
},
None => {
// We should infer from the manifest.
let metadata = crate::metadata::metadata(&Default::default(), self.manifest_path.as_ref())
.wrap_err("couldn't get cargo metadata")?;
let metadata =
crate::metadata::metadata(&Default::default(), self.manifest_path.as_ref())
.wrap_err("couldn't get cargo metadata")?;
crate::metadata::validate(&metadata)?;
let package_manifest_path = crate::manifest::manifest_path(&metadata, self.package.as_ref())
.wrap_err("Couldn't get manifest path")?;
let package_manifest_path =
crate::manifest::manifest_path(&metadata, self.package.as_ref())
.wrap_err("Couldn't get manifest path")?;
let package_manifest = Manifest::from_path(&package_manifest_path)
.wrap_err("Couldn't parse manifest")?;

Expand All @@ -80,16 +90,18 @@ impl CommandExecute for Connect {
Some(dbname) => dbname,
None => {
// We should infer from package
let metadata = crate::metadata::metadata(&Default::default(), self.manifest_path.as_ref())
.wrap_err("couldn't get cargo metadata")?;
let metadata =
crate::metadata::metadata(&Default::default(), self.manifest_path.as_ref())
.wrap_err("couldn't get cargo metadata")?;
crate::metadata::validate(&metadata)?;
let package_manifest_path = crate::manifest::manifest_path(&metadata, self.package.as_ref())
.wrap_err("Couldn't get manifest path")?;
let package_manifest_path =
crate::manifest::manifest_path(&metadata, self.package.as_ref())
.wrap_err("Couldn't get manifest path")?;

get_property(&package_manifest_path, "extname")
.wrap_err("could not determine extension name")?
.ok_or(eyre!("extname not found in control file"))?
},
}
};

connect_psql(Pgx::from_config()?.get(&pg_version)?, &dbname)
Expand Down
61 changes: 43 additions & 18 deletions cargo-pgx/src/command/get.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
// Copyright 2020 ZomboDB, LLC <[email protected]>. All rights reserved. Use of this source code is
// governed by the MIT license that can be found in the LICENSE file.
/*
Portions Copyright 2019-2021 ZomboDB, LLC.
Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <[email protected]>
All rights reserved.
Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

use crate::CommandExecute;
use eyre::{eyre, WrapErr};
use std::{
fs::File,
io::{BufRead, BufReader},
path::{Path, PathBuf},
process::Command,
};
use crate::CommandExecute;

/// Get a property from the extension control file
#[derive(clap::Args, Debug)]
Expand All @@ -32,8 +38,9 @@ impl CommandExecute for Get {
let metadata = crate::metadata::metadata(&Default::default(), self.manifest_path.as_ref())
.wrap_err("couldn't get cargo metadata")?;
crate::metadata::validate(&metadata)?;
let package_manifest_path = crate::manifest::manifest_path(&metadata, self.package.as_ref())
.wrap_err("Couldn't get manifest path")?;
let package_manifest_path =
crate::manifest::manifest_path(&metadata, self.package.as_ref())
.wrap_err("Couldn't get manifest path")?;

if let Some(value) = get_property(&package_manifest_path, &self.name)? {
println!("{}", value);
Expand Down Expand Up @@ -79,30 +86,48 @@ pub fn get_property(manifest_path: impl AsRef<Path>, name: &str) -> eyre::Result
Ok(None)
}

pub(crate) fn find_control_file(manifest_path: impl AsRef<Path>) -> eyre::Result<(PathBuf, String)> {
let parent = manifest_path
.as_ref()
.parent()
.ok_or_else(|| eyre!("could not get parent of `{}`", manifest_path.as_ref().display()))?;

for f in std::fs::read_dir(parent)
.wrap_err_with(|| eyre!("cannot open current directory `{}` for reading", parent.display()))? {
pub(crate) fn find_control_file(
manifest_path: impl AsRef<Path>,
) -> eyre::Result<(PathBuf, String)> {
let parent = manifest_path.as_ref().parent().ok_or_else(|| {
eyre!(
"could not get parent of `{}`",
manifest_path.as_ref().display()
)
})?;

for f in std::fs::read_dir(parent).wrap_err_with(|| {
eyre!(
"cannot open current directory `{}` for reading",
parent.display()
)
})? {
if f.is_ok() {
if let Ok(f) = f {
let f_path = f.path();
if f_path.extension() == Some("control".as_ref()) {
let file_stem = f_path.file_stem()
.ok_or_else(|| eyre!("could not get file stem of `{}`", f_path.display()))?;
let file_stem = file_stem.to_str()
.ok_or_else(|| eyre!("could not get file stem as String from `{}`", f_path.display()))?
let file_stem = f_path.file_stem().ok_or_else(|| {
eyre!("could not get file stem of `{}`", f_path.display())
})?;
let file_stem = file_stem
.to_str()
.ok_or_else(|| {
eyre!(
"could not get file stem as String from `{}`",
f_path.display()
)
})?
.to_string();
return Ok((f_path, file_stem));
}
}
}
}

Err(eyre!("control file not found in `{}`", manifest_path.as_ref().display()))
Err(eyre!(
"control file not found in `{}`",
manifest_path.as_ref().display()
))
}

fn determine_git_hash() -> eyre::Result<Option<String>> {
Expand Down
13 changes: 10 additions & 3 deletions cargo-pgx/src/command/init.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// Copyright 2020 ZomboDB, LLC <[email protected]>. All rights reserved. Use of this source code is
// governed by the MIT license that can be found in the LICENSE file.
/*
Portions Copyright 2019-2021 ZomboDB, LLC.
Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <[email protected]>
All rights reserved.
Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

use crate::command::stop::stop_postgres;
use crate::CommandExecute;
Expand Down Expand Up @@ -435,7 +441,8 @@ pub(crate) fn initdb(bindir: &PathBuf, datadir: &PathBuf) -> eyre::Result<()> {
let command_str = format!("{:?}", command);
tracing::debug!(command = %command_str, "Running");

let output = command.output()
let output = command
.output()
.wrap_err_with(|| eyre!("unable to execute: {}", command_str))?;
tracing::trace!(command = %command_str, status_code = %output.status, "Finished");

Expand Down
Loading

0 comments on commit 4d3a9a7

Please sign in to comment.