mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Use an extension to denote vendorized code.
Vendorized code is copied from another project when a library is not available and a git subproject won't work. Currently all the vendorized code is copied from PostgreSQL but it makes sense to have a more general mechanism for indicating vendorized code. The .vendor extension will be used to denote vendorized code in the same way that .auto is used to denote auto-generated code.
This commit is contained in:
parent
a329afd3be
commit
688ec2a8f5
@ -10,7 +10,7 @@ Page Checksum Filter
|
||||
#include "common/memContext.h"
|
||||
#include "common/type/object.h"
|
||||
#include "postgres/interface.h"
|
||||
#include "postgres/interface/static.auto.h"
|
||||
#include "postgres/interface/static.vendor.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Filter type constant
|
||||
|
@ -5,12 +5,12 @@ PostgreSQL Page Interface
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "postgres/interface/static.auto.h"
|
||||
#include "postgres/interface/static.vendor.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Include the page checksum code
|
||||
***********************************************************************************************************************************/
|
||||
#include "postgres/interface/pageChecksum.auto.c"
|
||||
#include "postgres/interface/pageChecksum.vendor.c"
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
uint16_t
|
||||
|
@ -1,9 +1,6 @@
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL Page Checksum Algorithm
|
||||
|
||||
Despite the .auto.h suffix this file is not automatically generated, though it could be. We use this suffix to emphasize that the
|
||||
code has been copied from PostgreSQL and to exclude this file from project code counts.
|
||||
|
||||
For each supported release of PostgreSQL check the code in this file to see if it has changed. The easiest way to do this is to
|
||||
copy and paste in place and check git to see if there are any diffs. Tabs should be copied as is to make this process easy even
|
||||
though the pgBackRest project does not use tabs elsewhere.
|
@ -4,9 +4,6 @@ PostgreSQL Types That Do Not Vary By Version
|
||||
Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
||||
Portions Copyright (c) 1994, Regents of the University of California
|
||||
|
||||
Despite the .auto.h suffix this file is not automatically generated, though it could be. We use this suffix to emphasize that the
|
||||
types have been copied from PostgreSQL and to exclude this file from project code counts.
|
||||
|
||||
For each supported release of PostgreSQL check the types in this file to see if they have changed. The easiest way to do this is to
|
||||
copy and paste in place and check git to see if there are any diffs. Tabs should be copied as is to make this process easy even
|
||||
though the pgBackRest project does not use tabs elsewhere.
|
||||
@ -20,8 +17,8 @@ which could have a large impact on dependencies. Hopefully that won't happen of
|
||||
Note when adding new types it is safer to add them to version.auto.c unless they are needed for code that must be compatible across
|
||||
all versions of PostgreSQL supported by pgBackRest.
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef POSTGRES_INTERFACE_STATICAUTO_H
|
||||
#define POSTGRES_INTERFACE_STATICAUTO_H
|
||||
#ifndef POSTGRES_INTERFACE_STATICVENDOR_H
|
||||
#define POSTGRES_INTERFACE_STATICVENDOR_H
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "postgres/interface.h"
|
@ -1,21 +1,21 @@
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL Version Interface
|
||||
|
||||
Macros for building version-specific functions that interface with the types in version.auto.h. Due to the way PostgreSQL types
|
||||
Macros for building version-specific functions that interface with the types in version.vendor.h. Due to the way PostgreSQL types
|
||||
evolve over time, this seems to be the easiest way to extract information from them.
|
||||
|
||||
These macros should be kept as simple as possible, with most of the logic contained in postgres/interface.c.
|
||||
|
||||
Each version of PostgreSQL will need a vXXX.c file to contain the version-specific functions created by these macros.
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef POSTGRES_INTERFACE_IMPLEMENTATION_H
|
||||
#define POSTGRES_INTERFACE_IMPLEMENTATION_H
|
||||
#ifndef POSTGRES_INTERFACE_VERSIONINTERN_H
|
||||
#define POSTGRES_INTERFACE_VERSIONINTERN_H
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "postgres/interface/version.h"
|
||||
#include "postgres/version.h"
|
||||
|
||||
#include "postgres/interface/version.auto.h"
|
||||
#include "postgres/interface/version.vendor.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get the catalog version
|
||||
|
@ -4,9 +4,6 @@ PostgreSQL Types That Vary By Version
|
||||
Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
||||
Portions Copyright (c) 1994, Regents of the University of California
|
||||
|
||||
Despite the .auto.h suffix this file is not automatically generated, though it could be. We use this suffix to emphasize that the
|
||||
types have been copied from PostgreSQL and to exclude this file from project code counts.
|
||||
|
||||
For each supported release of PostgreSQL check the types in this file to see if they have changed. The easiest way to do this is to
|
||||
copy and paste in place and check git to see if there are any diffs. Tabs should be copied as is to make this process easy even
|
||||
though the pgBackRest project does not use tabs elsewhere.
|
||||
@ -24,7 +21,7 @@ If a comment has syntax only changes, then the new version of the comment can be
|
||||
If a comment has changed in a way that implies a difference in the way the type is used, then a new version of the comment and type
|
||||
should be created. See the CheckPoint type difference between 9.5 and 9.6 as an example.
|
||||
***********************************************************************************************************************************/
|
||||
#include "postgres/interface/static.auto.h"
|
||||
#include "postgres/interface/static.vendor.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Types from src/include/c.h
|
@ -1199,11 +1199,11 @@ src/postgres/interface/page.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/postgres/interface/pageChecksum.auto.c:
|
||||
src/postgres/interface/pageChecksum.vendor.c:
|
||||
class: core/auto
|
||||
type: c
|
||||
|
||||
src/postgres/interface/static.auto.h:
|
||||
src/postgres/interface/static.vendor.h:
|
||||
class: core/auto
|
||||
type: c/h
|
||||
|
||||
@ -1255,7 +1255,7 @@ src/postgres/interface/v120.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/postgres/interface/version.auto.h:
|
||||
src/postgres/interface/version.vendor.h:
|
||||
class: core/auto
|
||||
type: c/h
|
||||
|
||||
|
@ -98,6 +98,12 @@ sub codeCountScan
|
||||
$strClass .= '/auto';
|
||||
}
|
||||
|
||||
# Append vendor if a vendorized file
|
||||
if ($strFile =~ '\.vendor\..$')
|
||||
{
|
||||
$strClass .= '/vendor';
|
||||
}
|
||||
|
||||
# Force unrecognized file types
|
||||
my $strForceLang = undef;
|
||||
my $strType = undef;
|
||||
|
@ -311,6 +311,9 @@ sub run
|
||||
# Skip all files except .c files (including .auto.c)
|
||||
next if $strFile !~ /(?<!\.auto)\.c$/;
|
||||
|
||||
# Skip all files except .c files (including .vendor.c)
|
||||
next if $strFile !~ /(?<!\.vendor)\.c$/;
|
||||
|
||||
# ??? Skip main for now until the function can be renamed to allow unit testing
|
||||
next if $strFile =~ /main\.c$/;
|
||||
|
||||
@ -335,9 +338,12 @@ sub run
|
||||
# Don't include the test file as it is already included below
|
||||
next if $strFile =~ /Test$/;
|
||||
|
||||
# Don't any auto files as they are included in their companion C files
|
||||
# Don't include auto files as they are included in their companion C files
|
||||
next if $strFile =~ /auto$/;
|
||||
|
||||
# Don't include vendor files as they are included in regular C files
|
||||
next if $strFile =~ /vendor$/;
|
||||
|
||||
# Include the C file if it exists
|
||||
my $strCIncludeFile = "${strFile}.c";
|
||||
|
||||
|
@ -5,7 +5,7 @@ Test Common Functions and Definitions for Backup and Expire Commands
|
||||
#include "common/regExp.h"
|
||||
#include "common/type/json.h"
|
||||
#include "postgres/interface.h"
|
||||
#include "postgres/interface/static.auto.h"
|
||||
#include "postgres/interface/static.vendor.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
@ -9,7 +9,7 @@ Test Backup Command
|
||||
#include "common/io/bufferRead.h"
|
||||
#include "common/io/bufferWrite.h"
|
||||
#include "common/io/io.h"
|
||||
#include "postgres/interface/static.auto.h"
|
||||
#include "postgres/interface/static.vendor.h"
|
||||
#include "storage/helper.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user