Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patching #20

Closed
wants to merge 4 commits into from
Closed

Patching #20

wants to merge 4 commits into from

Conversation

fluca1978
Copy link
Collaborator

This is a proposal for the patching feature. The idea is to be able to instrument the build process to patch the source tree.

To instrument the build system a patch index file must be created, such file contains a list of files to apply via patch. Each file listed can be with a relative name (relative to the patch/ subfolder) or an absolute path.

The index is searched on a per-version basis with the precedence to the OS type (uname -s). If no file is found for the specific version, the process searches for an index file with less details, so for instance for version 8.1.4 the list of searched files is:

patch/index/patch.8.1.4.Linux
patch/index/patch.8.1.4
patch/index/patch.8.1.Linux
patch/index/patch.8.1
patch/index/patch.8.Linux
patch/index/patch.8

for a Linux kernel/OS. If no index is found, nothing is patched at all.
This allows the user to get better control over the patching process and allows for a "global" patch for a brand release or a specific operating system.

I've refactored the patch for 8.0 and 8.1 but it is not working, at least on 8.1.4, could it be it has been overtaken?

Now there are a couple of pgenv_patch_xxx functions that aims to automate
the patching of the currently building instance. The idea is that patches
are contained in a directory tree rooted at 'patch', and each file corresponds
to a single patch to apply. There are "indexes" that list, in the right order,
which patch files to apply to every version.

Indexes are choosen in a "desperate" manner:
1) exact PostgreSQL version and OS name;
2) exact PostgreSQL version;
3) brand/year and OS name;
4) brand/year;
5) brand and OS name;
6) brand.

So for instance the PostgreSQL version 8.1.4 will apply the first index
found between:

patch/index/patch.8.1.4.Linux
patch/index/patch.8.1.4
patch/index/patch.8.1.Linux
patch/index/patch.8.1
patch/index/patch.8.Linux
patch/index/patch.8

(on a Linux machine).
The first index found readable is the one that wins, so the order the above
list is produced does matter.

The function that performs the patching extracts from the index the name
of a file to apply thru pathc(1). The file name can be absolute or relative,
in such case it must be relative to `patch/` subfolder. A verbose message
is displayed when patching is applied.

So far, if the patching fails, the build stops.
@theory
Copy link
Owner

theory commented Oct 17, 2018

Your code appears to map it to patch only 8.0, not 8.1.

@fluca1978
Copy link
Collaborator Author

Yes, it is a proposal. If that is good, I can commit the very same patch index for 8.1.

This is the same as the patch for 8.0, extracted from the previous version
of the "in-line" patching operated by the script.
See comment <theory#20 (comment)>.
Copy link
Owner

@theory theory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me! Please rebase or squash before merging.

@fluca1978 fluca1978 closed this in 865064a Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants