Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24d1280

Browse files
committed
Clean up installation directory choices for extensions.
Arrange for the control files to be in $SHAREDIR/extension not$SHAREDIR/contrib, since we're generally trying to deprecate the term"contrib" and this is a once-in-many-moons opportunity to get rid of it ininstall paths. Fix PGXS to install the $EXTENSION file into that directoryno matter what MODULEDIR is set to; a nondefault MODULEDIR should onlyaffect the script and secondary extension files. Fix the control filedirectory parameter to be interpreted relative to $SHAREDIR, to avoid asurprising disconnect between how you specify that and what you setMODULEDIR to.Per discussion with David Wheeler.
1 parent1214749 commit24d1280

File tree

4 files changed

+46
-27
lines changed

4 files changed

+46
-27
lines changed

‎doc/src/sgml/extend.sgml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,13 @@
365365
The <xref linkend="sql-createextension"> command relies on a control
366366
file for each extension, which must be named the same as the extension
367367
with a suffix of <literal>.control</>, and must be placed in the
368-
installation's <literal>SHAREDIR/contrib</literal> directory. There
368+
installation's <literal>SHAREDIR/extension</literal> directory. There
369369
must also be at least one <acronym>SQL</> script file, which follows the
370370
naming pattern
371371
<literal><replaceable>extension</>-<replaceable>version</>.sql</literal>
372372
(for example, <literal>foo-1.0.sql</> for version <literal>1.0</> of
373373
extension <literal>foo</>). By default, the script file(s) are also
374-
placed in the <literal>SHAREDIR/contrib</literal> directory; but the
374+
placed in the <literal>SHAREDIR/extension</literal> directory; but the
375375
control file can specify a different directory for the script file(s).
376376
</para>
377377

@@ -395,7 +395,9 @@
395395
<para>
396396
The directory containing the extension's <acronym>SQL</> script
397397
file(s). Unless an absolute path is given, the name is relative to
398-
the <literal>SHAREDIR/contrib</literal> directory.
398+
the installation's <literal>SHAREDIR</literal> directory. The
399+
default behavior is equivalent to specifying
400+
<literal>directory = 'extension'</>.
399401
</para>
400402
</listitem>
401403
</varlistentry>
@@ -905,23 +907,26 @@ include $(PGXS)
905907

906908
<variablelist>
907909
<varlistentry>
908-
<term><varname>MODULEDIR</varname></term>
910+
<term><varname>EXTENSION</varname></term>
909911
<listitem>
910912
<para>
911-
subdirectory into which EXTENSION, DATA and DOCS files should be
912-
installed (if not set, default is <literal>contrib</literal>)
913+
extension name(s); for each name you must provide an
914+
<literal><replaceable>extension</replaceable>.control</literal> file,
915+
which will be installed into
916+
<literal><replaceable>prefix</replaceable>/share/extension</literal>
913917
</para>
914918
</listitem>
915919
</varlistentry>
916920

917921
<varlistentry>
918-
<term><varname>EXTENSION</varname></term>
922+
<term><varname>MODULEDIR</varname></term>
919923
<listitem>
920924
<para>
921-
extension name(s); for each name you must provide an
922-
<literal><replaceable>extension</replaceable>.control</literal> file,
923-
which will be installed into
924-
<literal><replaceable>prefix</replaceable>/share/$MODULEDIR</literal>
925+
subdirectory of <literal><replaceable>prefix</>/share</literal>
926+
into which DATA and DOCS files should be installed
927+
(if not set, default is <literal>extension</literal> if
928+
<varname>EXTENSION</varname> is set,
929+
or <literal>contrib</literal> if not)
925930
</para>
926931
</listitem>
927932
</varlistentry>

‎doc/src/sgml/ref/create_extension.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ CREATE EXTENSION <replaceable class="parameter">extension_name</replaceable>
6767
The name of the extension to be
6868
installed. <productname>PostgreSQL</productname> will create the
6969
extension using details from the file
70-
<literal>SHAREDIR/contrib/</literal><replaceable class="parameter">extension</replaceable><literal>.control</literal>.
70+
<literal>SHAREDIR/extension/</literal><replaceable class="parameter">extension_name</replaceable><literal>.control</literal>.
7171
</para>
7272
</listitem>
7373
</varlistentry>

‎src/backend/commands/extension.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ get_extension_control_directory(void)
278278

279279
get_share_path(my_exec_path,sharepath);
280280
result= (char*)palloc(MAXPGPATH);
281-
snprintf(result,MAXPGPATH,"%s/contrib",sharepath);
281+
snprintf(result,MAXPGPATH,"%s/extension",sharepath);
282282

283283
returnresult;
284284
}
@@ -291,7 +291,7 @@ get_extension_control_filename(const char *extname)
291291

292292
get_share_path(my_exec_path,sharepath);
293293
result= (char*)palloc(MAXPGPATH);
294-
snprintf(result,MAXPGPATH,"%s/contrib/%s.control",
294+
snprintf(result,MAXPGPATH,"%s/extension/%s.control",
295295
sharepath,extname);
296296

297297
returnresult;
@@ -305,7 +305,7 @@ get_extension_script_directory(ExtensionControlFile *control)
305305

306306
/*
307307
* The directory parameter can be omitted, absolute, or relative to the
308-
*control-file directory.
308+
*installation's share directory.
309309
*/
310310
if (!control->directory)
311311
returnget_extension_control_directory();
@@ -315,8 +315,7 @@ get_extension_script_directory(ExtensionControlFile *control)
315315

316316
get_share_path(my_exec_path,sharepath);
317317
result= (char*)palloc(MAXPGPATH);
318-
snprintf(result,MAXPGPATH,"%s/contrib/%s",
319-
sharepath,control->directory);
318+
snprintf(result,MAXPGPATH,"%s/%s",sharepath,control->directory);
320319

321320
returnresult;
322321
}

‎src/makefiles/pgxs.mk

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
#
2626
# The following variables can also be set:
2727
#
28-
# MODULEDIR -- subdirectory into which EXTENSION, DATA and DOCS files
29-
# should be installed (if not set, default is "contrib")
3028
# EXTENSION -- name of extension (there must be a $EXTENSION.control file)
29+
# MODULEDIR -- subdirectory of $PREFIX/share into which DATA and DOCS files
30+
# should be installed (if not set, default is "extension" if EXTENSION
31+
# is set, or "contrib" if not)
3132
# DATA -- random files to install into $PREFIX/share/$MODULEDIR
3233
# DATA_built -- random files to install into $PREFIX/share/$MODULEDIR,
3334
# which need to be built first
@@ -72,11 +73,16 @@ override CFLAGS += $(CFLAGS_SL)
7273
endif
7374

7475
ifdefMODULEDIR
75-
datamoduledir =$(MODULEDIR)
76-
docmoduledir =$(MODULEDIR)
76+
datamoduledir:=$(MODULEDIR)
77+
docmoduledir:=$(MODULEDIR)
7778
else
78-
datamoduledir = contrib
79-
docmoduledir = contrib
79+
ifdefEXTENSION
80+
datamoduledir := extension
81+
docmoduledir := extension
82+
else
83+
datamoduledir := contrib
84+
docmoduledir := contrib
85+
endif
8086
endif
8187

8288
ifdefPG_CPPFLAGS
@@ -96,8 +102,14 @@ endif # MODULE_big
96102

97103

98104
install: all installdirs
99-
ifneq (,$(DATA)$(DATA_built)$(EXTENSION))
100-
@for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built) $(addsuffix .control, $(EXTENSION)); do \
105+
ifneq (,$(EXTENSION))
106+
@for file in $(addprefix $(srcdir)/, $(addsuffix .control, $(EXTENSION))); do \
107+
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/extension'"; \
108+
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/extension'; \
109+
done
110+
endif# EXTENSION
111+
ifneq (,$(DATA)$(DATA_built))
112+
@for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built); do \
101113
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/$(datamoduledir)'"; \
102114
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/$(datamoduledir)'; \
103115
done
@@ -168,8 +180,11 @@ endif # MODULE_big
168180

169181

170182
uninstall:
171-
ifneq (,$(DATA)$(DATA_built)$(EXTENSION))
172-
rm -f $(addprefix '$(DESTDIR)$(datadir)/$(datamoduledir)'/, $(notdir $(DATA) $(DATA_built) $(addsuffix .control, $(EXTENSION))))
183+
ifneq (,$(EXTENSION))
184+
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(addsuffix .control, $(EXTENSION))))
185+
endif
186+
ifneq (,$(DATA)$(DATA_built))
187+
rm -f $(addprefix '$(DESTDIR)$(datadir)/$(datamoduledir)'/, $(notdir $(DATA) $(DATA_built)))
173188
endif
174189
ifneq (,$(DATA_TSEARCH))
175190
rm -f $(addprefix '$(DESTDIR)$(datadir)/tsearch_data'/, $(notdir $(DATA_TSEARCH)))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp