summaryrefslogtreecommitdiffstats
path: root/postgresql.spec
blob: a62f4f99dad9a831c450270676483c8a83638185 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
# This is the PostgreSQL Global Development Group Official RPMset spec file,
# or a derivative thereof.
# Copyright 2003-2009 Lamar Owen <lowen@pari.edu> <lamar.owen@wgcr.org>
# and others listed.

# Major Contributors:
# ---------------
# Lamar Owen
# Trond Eivind Glomsrd <teg@redhat.com>
# Thomas Lockhart
# Reinhard Max
# Karl DeBisschop
# Peter Eisentraut
# Joe Conway
# Andrew Overholt
# David Jee
# Kaj J. Niemi
# Sander Steffann
# Tom Lane
# and others in the Changelog....

# This spec file and ancillary files are licensed in accordance with
# The PostgreSQL license.

# In this file you can find the default build package list macros.
# These can be overridden by defining on the rpm command line:
# rpm --define 'packagename 1' .... to force the package to build.
# rpm --define 'packagename 0' .... to force the package NOT to build.
# The base package, the libs package, the devel package, and the server package
# always get built.

%{?scl:%scl_package postgresql}

%{!?beta:%global beta 0}
%{?beta:%global __os_install_post /usr/lib/rpm/brp-compress}

%{!?test:%global test 1}
%{!?upgrade:%global upgrade 0}
%{!?rewind:%global rewind 1}
%{!?plpython:%global plpython 1}
%{!?plpython3:%global plpython3 0}
%{!?pltcl:%global pltcl 1}
%{!?plperl:%global plperl 1}
%{!?ssl:%global ssl 1}
%{!?kerberos:%global kerberos 1}
%{!?ldap:%global ldap 1}
%{!?nls:%global nls 1}
%{!?uuid:%global uuid 1}
%{!?xml:%global xml 1}
%{!?pam:%global pam 1}
%{!?sdt:%global sdt 1}
%{!?selinux:%global selinux 1}
%{!?runselftest:%global runselftest 1}

# By default, patch(1) creates backup files when chunks apply with offsets.
# Turn that off to ensure such files don't get included in RPMs.
%global _default_patch_flags --no-backup-if-mismatch

%if 0%{?scl:1}
%global scl_upper %{lua:print(string.upper(string.gsub(rpm.expand("%{scl}"), "-", "_")))}
%endif

%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
Summary: PostgreSQL client programs
Name: %{?scl_prefix}postgresql
%global majorversion 9.5
Version: 9.5
Release: 1%{?dist}

# The PostgreSQL license is very similar to other MIT licenses, but the OSI
# recognizes it as an independent license, so we do as well.
License: PostgreSQL
Group: Applications/Databases
Url: http://www.postgresql.org/

%global setup_version 3.5

%global service_name %{?scl_prefix}postgresql.service
Source0: https://pkajaba.fedorapeople.org/postgresql-%{version}.tar.bz2
# The PDF file is generated by generate-pdf.sh, which see for comments
Source1: postgresql-%{version}-US.pdf
# generate-pdf.sh is not used during RPM build, but include for documentation
Source2: generate-pdf.sh
Source5: Makefile.regress
Source6: pg_config.h
Source7: ecpg_config.h
Source13: postgresql.tmpfiles.d
Source14: postgresql.pam
Source15: postgresql-bashprofile

# http://fedorapeople.org/cgit/praiskup/public_git/postgresql-setup.git/
Source16: http://praiskup.fedorapeople.org/proj/postgresql-setup/postgresql-setup-%{setup_version}.tar.gz

# Comments for these patches are in the patch files.
Patch1: rpm-pgsql.patch
Patch2: postgresql-logging.patch
Patch3: postgresql-perl-rpath.patch
Patch4: postgresql-config-comment.patch
Patch6: postgresql-var-run-socket.patch
Patch8: postgresql-man.patch
Patch9: postgresql-socket-dirs-pgupgrade.patch


BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk
BuildRequires: perl(ExtUtils::Embed)
BuildRequires: readline-devel zlib-devel

# postgresql-setup build requires
BuildRequires: m4 elinks docbook-utils help2man

%if 0%{?rhel} >= 6
BuildRequires: perl-devel
%endif
BuildRequires: systemd

%if %plpython
BuildRequires: python-devel
%endif

%if %plpython3
BuildRequires: python3-devel
%endif

%if %pltcl
BuildRequires: tcl-devel
%endif

%if %ssl
BuildRequires: openssl-devel
%endif

%if %kerberos
BuildRequires: krb5-devel
%endif

%if %ldap
BuildRequires: openldap-devel
%endif

%if %nls
BuildRequires: gettext >= 0.10.35
%endif

%if %uuid
BuildRequires: uuid-devel
%endif

%if %xml
BuildRequires: libxml2-devel libxslt-devel
%endif

%if %pam
BuildRequires: pam-devel
%endif

%if %sdt
BuildRequires: systemtap-sdt-devel
%endif

%if %selinux
BuildRequires: libselinux-devel
%endif

# main package requires -libs subpackage
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%{?scl:Requires:%scl_runtime}

%description
PostgreSQL is an advanced Object-Relational database management system (DBMS).
The base postgresql package contains the client programs that you'll need to
access a PostgreSQL DBMS server, as well as HTML documentation for the whole
system.  These client programs can be located on the same machine as the
PostgreSQL server, or on a remote machine that accesses a PostgreSQL server
over a network connection.  The PostgreSQL server can be found in the
postgresql-server sub-package.


%package libs
Summary: The shared libraries required for any PostgreSQL clients
Group: Applications/Databases
# for /sbin/ldconfig
Requires(post): glibc
Requires(postun): glibc
%{?scl:Requires:%scl_runtime}
%description libs
The postgresql-libs package provides the essential shared libraries for any 
PostgreSQL client program or interface. You will need to install this package
to use any other PostgreSQL package or any clients that need to connect to a
PostgreSQL server.


%package server
Summary: The programs needed to create and run a PostgreSQL server
Group: Applications/Databases
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: /usr/bin/scl_source
Requires(pre): /usr/sbin/useradd
# We require this to be present for %%{_prefix}/lib/tmpfiles.d
Requires: systemd
# Make sure it's there when scriptlets run, too
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%{?scl:Requires:%scl_runtime}

%description server
PostgreSQL is an advanced Object-Relational database management system (DBMS).
The postgresql-server package contains the programs needed to create
and run a PostgreSQL server, which will in turn allow you to create
and maintain PostgreSQL databases.


%package docs
Summary: Extra documentation for PostgreSQL
Group: Applications/Databases
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?scl:Requires:%scl_runtime}

%description docs
The postgresql-docs package contains some additional documentation for
PostgreSQL.  Currently, this includes the main documentation in PDF format
and source files for the PostgreSQL tutorial.


%package contrib
Summary: Extension modules distributed with PostgreSQL
Group: Applications/Databases
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%{?scl:Requires:%scl_runtime}

%description contrib
The postgresql-contrib package contains various extension modules that are
included in the PostgreSQL distribution.


%package devel
Summary: PostgreSQL development header files and libraries
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}

%description devel
The postgresql-devel package contains the header files and libraries
needed to compile C or C++ applications which will directly interact
with a PostgreSQL database management server.  It also contains the ecpg
Embedded C Postgres preprocessor. You need to install this package if you want
to develop applications which will interact with a PostgreSQL server.

%if %upgrade
%package upgrade
Summary: Support for upgrading from the previous major release of PostgreSQL
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%{?scl:Requires:%scl_runtime}

%description upgrade
The postgresql-upgrade package contains the pg_upgrade utility and supporting
files needed for upgrading a PostgreSQL database from the core system version
of PostgreSQL.
%endif

%if %plperl
%package plperl
Summary: The Perl procedural language for PostgreSQL
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{version}-%{release}
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
BuildRequires:  perl-Data-Dumper
%{?scl:Requires:%scl_runtime}

%description plperl
The postgresql-plperl package contains the PL/Perl procedural language,
which is an extension to the PostgreSQL database server.
Install this if you want to write database functions in Perl.
%endif

%if %plpython
%package plpython
Summary: The Python2 procedural language for PostgreSQL
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{version}-%{release}
%{?scl:Requires:%scl_runtime}

%description plpython
The postgresql-plpython package contains the PL/Python procedural language,
which is an extension to the PostgreSQL database server.
Install this if you want to write database functions in Python 2.
%endif

%if %plpython3
%package plpython3
Summary: The Python3 procedural language for PostgreSQL
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{version}-%{release}
%{?scl:Requires:%scl_runtime}

%description plpython3
The postgresql-plpython3 package contains the PL/Python3 procedural language,
which is an extension to the PostgreSQL database server.
Install this if you want to write database functions in Python 3.
%endif

%if %pltcl
%package pltcl
Summary: The Tcl procedural language for PostgreSQL
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{version}-%{release}
Requires: tcl-pgtcl
%{?scl:Requires:%scl_runtime}

%description pltcl
The postgresql-pltcl package contains the PL/Tcl procedural language,
which is an extension to the PostgreSQL database server.
Install this if you want to write database functions in Tcl.
%endif

%if %test
%package test
Summary: The test suite distributed with PostgreSQL
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%{?scl:Requires:%scl_runtime}

%description test
The postgresql-test package contains files needed for various tests for the
PostgreSQL database management system, including regression tests and
benchmarks.
%endif

%prep
%setup -q %{?scl:-n %{pkg_name}-%{version}} -a 16
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch6 -p1
%patch8 -p1
%patch9 -p1

# We used to run autoconf here, but there's no longer any real need to,
# since Postgres ships with a reasonably modern configure script.

# add ppc64p7 support (https://fedoraproject.org/wiki/Features/Power7Subarch)
# hopefully need for this will go away next time upstream updates config.sub
sed -i -e "s/ppc64-\*/ppc64-\* \| ppc64p7-\*/" config/config.sub

cp -p %{SOURCE1} .

# We need to add an extra setting of SCL environment into the service file
# and some checks into scripts that can be possibly run without scl enable,
# but only if we build the package in SCL environment. 
cp -p %{SOURCE15} .
%if 0%{?scl:1}
%global scl_sed_patches 1
%if %scl_sed_patches
find . -type f -name Makefile -exec sed -i -e "s/SO_MAJOR_VERSION=\s\?\([0-9]\+\)/SO_MAJOR_VERSION= %{?scl}-\1/" {} \;
%endif
%endif

# remove .gitignore files to ensure none get into the RPMs (bug #642210)
find . -type f -name .gitignore | xargs rm

%build

# fail quickly and obviously if user tries to build as root
%if %runselftest
	if [ x"`id -u`" = x0 ]; then
		echo "postgresql's regression tests fail if run as root."
		echo "If you really need to build the RPM as root, use"
		echo "--define='runselftest 0' to skip the regression tests."
		exit 1
	fi
%endif

CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS

# Strip out -ffast-math from CFLAGS....
CFLAGS=`echo $CFLAGS|xargs -n 1|grep -v ffast-math|xargs -n 100`
# Add LINUX_OOM_SCORE_ADJ=0 to ensure child processes reset postmaster's oom_score_adj
CFLAGS="$CFLAGS -DLINUX_OOM_SCORE_ADJ=0"
# let's try removing this kluge, it may just be a workaround for bz#520916
# # use -O1 on sparc64 and alpha
# %%ifarch sparc64 alpha
# CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O1|g" `
# %%endif

cd postgresql-setup-%{setup_version}
%configure \
    pgdocdir=%{_pkgdocdir} \
    systemdunitsdir=%{_root_prefix}/lib/systemd/system \
    systemduserunitsdir=%{_root_sysconfdir}/systemd/system \
    systemdlegacyscriptsdir=%{_root_libexecdir}/initscripts/legacy-actions \
    PGVERSION=%{version} \
    PGMAJORVERSION=%{majorversion} \
    NAME_DEFAULT_PREV_SERVICE=postgresql \
    SCLS=%{?scl} \
    NAME_SRV_PFX=%{?scl}- \
    NAME_PKG_PFX=%{?scl}-

make %{?_smp_mflags}
cd ..


# plpython requires separate configure/build runs to build against python 2
# versus python 3.  Our strategy is to do the python 3 run first, then make
# distclean and do it again for the "normal" build.  Note that the installed
# Makefile.global will reflect the python 2 build, which seems appropriate
# since that's still considered the default plpython version.
%if %plpython3

export PYTHON=/usr/bin/python3

# These configure options must match main build
%configure --disable-rpath \
%if %beta
	--enable-debug \
	--enable-cassert \
%endif
%if %plperl
	--with-perl \
%endif
%if %pltcl
	--with-tcl \
	--with-tclconfig=%{?scl:%_root_libdir}%{!?scl:%_libdir} \
%endif
%if %plpython3
	--with-python \
%endif
%if %ldap
	--with-ldap \
%endif
%if %ssl
	--with-openssl \
%endif
%if %pam
	--with-pam \
%endif
%if %kerberos
	--with-krb5 \
	--with-gssapi \
%endif
%if %uuid
	--with-ossp-uuid \
%endif
%if %xml
	--with-libxml \
	--with-libxslt \
%endif
%if %nls
	--enable-nls \
%endif
%if %sdt
	--enable-dtrace \
%endif
%if 0{!%selinux:1}
	--with-selinux \
%endif
	--with-system-tzdata=%{?scl:%_root_datadir}%{!?scl:%_datadir}/zoneinfo \
	--datadir=%{_datadir}/pgsql

# Fortunately we don't need to build much except plpython itself
cd src/backend
make submake-errcodes
cd ../..
cd src/pl/plpython
make %{?_smp_mflags} all
cd ..
# save built form in a directory that "make distclean" won't touch
cp -a plpython plpython3
cd ../..

# must also save this version of Makefile.global for later
cp src/Makefile.global src/Makefile.global.python3

make distclean

%endif

unset PYTHON

# Normal (not python3) build begins here

# we want to build with rpath since LD_LIBRARY_PATH is not strong enough
# for running pg_ctl under runuser command
%configure --disable-rpath \
%if %beta
	--enable-debug \
	--enable-cassert \
%endif
%if %plperl
	--with-perl \
%endif
%if %pltcl
	--with-tcl \
	--with-tclconfig=%{?scl:%_root_libdir}%{!?scl:%_libdir} \
%endif
%if %plpython
	--with-python \
%endif
%if %ldap
	--with-ldap \
%endif
%if %ssl
	--with-openssl \
%endif
%if %pam
	--with-pam \
%endif
%if %kerberos
	--with-krb5 \
	--with-gssapi \
%endif
%if %uuid
	--with-ossp-uuid \
%endif
%if %xml
	--with-libxml \
	--with-libxslt \
%endif
%if %nls
	--enable-nls \
%endif
%if %sdt
	--enable-dtrace \
%endif
%if %selinux
	--with-selinux \
%endif
	--with-system-tzdata=%{?scl:%_root_datadir}%{!?scl:%_datadir}/zoneinfo \
	--datadir=%{_datadir}/pgsql

make %{?_smp_mflags} world

# Have to hack makefile to put correct path into tutorial scripts
sed "s|C=\`pwd\`;|C=%{_libdir}/pgsql/tutorial;|" < src/tutorial/Makefile > src/tutorial/GNUmakefile
make %{?_smp_mflags} -C src/tutorial NO_PGXS=1 all
rm -f src/tutorial/GNUmakefile
# The object files shouldn't be copied to rpm bz#1187514
rm -f src/tutorial/*.o


test_failure=0

# run_testsuite WHERE
# -------------------
# Run 'make check' in WHERE path.  When that command fails, return the logs
# given by PostgreSQL build system and set 'test_failure=1'.

run_testsuite()
{
	make -C "$1" MAX_CONNECTIONS=5 check && return 0

	test_failure=1

	(
		set +x
		find "$1" -name 'regression.diffs' | \
		while read line; do
			echo "=== make failure: $line ==="
			cat "$line"
		done
	)
}

%if %runselftest
	run_testsuite "src/test/regress"
	make clean -C "src/test/regress"
	run_testsuite "src/pl"
%if %plpython3
	# must install Makefile.global that selects python3
	mv src/Makefile.global src/Makefile.global.save
	cp src/Makefile.global.python3 src/Makefile.global
	touch -r src/Makefile.global.save src/Makefile.global
	# because "make check" does "make install" on the whole tree,
	# we must temporarily install plpython3 as src/pl/plpython,
	# since that is the subdirectory src/pl/Makefile knows about
	mv src/pl/plpython src/pl/plpython2
	mv src/pl/plpython3 src/pl/plpython

	run_testsuite "src/pl/plpython"

	# and clean up our mess
	mv src/pl/plpython src/pl/plpython3
	mv src/pl/plpython2 src/pl/plpython
	mv -f src/Makefile.global.save src/Makefile.global
%endif
	run_testsuite "contrib"
%endif

# "assert(ALL_TESTS_OK)"
test "$test_failure" -eq 0

%if %test
	# undo the "make clean" above
	make all -C src/test/regress
%endif

%install

cd postgresql-setup-%{setup_version}
make install DESTDIR=$RPM_BUILD_ROOT
cd ..

# For some reson, specifying %doc %{_pkgdocdir}/README.rpm-dist in %files does
# not work (at least on RHEL6) and rpmbuild fails with (it may be known issue
# but I was unable to debug properly yet):
#   error: create archive failed on file
#   /builddir/.../...-9.4.1/README.rpm-dist: cpio: Bad magic
cp $RPM_BUILD_ROOT/%{_pkgdocdir}/README.rpm-dist ./

# This creates config files for postgresql-setup to migrate dbs from various
# versions to current one since data are not compatible with latest version
# normal 9.2
cat > $RPM_BUILD_ROOT%{_sysconfdir}/postgresql-setup/upgrade/postgresql92.conf <<EOF
id              postgresql
major           9.2
data_default    /var/lib/pgsql/data
engine          /usr/bin
description     "Upgrade data from system PostgreSQL version (PostgreSQL 9.2)"
redhat_sockets_hack yes
EOF

# collection 9.2
cat > $RPM_BUILD_ROOT%{_sysconfdir}/postgresql-setup/upgrade/scl-postgresql92.conf <<EOF
id              postgresql92-postgresql
major           9.2
data_default    /opt/rh/postgresql92/root/var/lib/pgsql/data
engine          /opt/rh/postgresql92/root/usr/bin
description     "Upgrade data from RHSCL 1.X PostgreSQL version (PostgreSQL 9.2)"
scls            "postgresql92"
redhat_sockets_hack yes
EOF

# normal 9.4
cat > $RPM_BUILD_ROOT%{_sysconfdir}/postgresql-setup/upgrade/postgresql94.conf <<EOF
id              postgresql
major           9.4
data_default    /var/lib/pgsql/data
engine          /usr/bin
description     "Upgrade data from system PostgreSQL version (PostgreSQL 9.4)"
redhat_sockets_hack yes
EOF

# collection 9.4
cat > $RPM_BUILD_ROOT%{_sysconfdir}/postgresql-setup/upgrade/scl-postgresql94.conf <<EOF
id              postgresql92-postgresql
major           9.4
data_default    /opt/rh/postgresql94/root/var/lib/pgsql/data
engine          /opt/rh/postgresql94/root/usr/bin
description     "Upgrade data from RHSCL 2.X PostgreSQL version (PostgreSQL 9.4)"
scls            "postgresql94"
redhat_sockets_hack yes
EOF

make DESTDIR=$RPM_BUILD_ROOT install-world

%if %plpython3
	mv src/Makefile.global src/Makefile.global.save
	cp src/Makefile.global.python3 src/Makefile.global
	touch -r src/Makefile.global.save src/Makefile.global
	pushd src/pl/plpython3
	make DESTDIR=$RPM_BUILD_ROOT install
	popd
	mv -f src/Makefile.global.save src/Makefile.global
%endif

# make sure these directories exist even if we suppressed all contrib modules
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/contrib
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/extension

# multilib header hack; note pg_config.h is installed in two places!
# we only apply this to known Red Hat multilib arches, per bug #177564
case `uname -i` in
  i386 | x86_64 | ppc | ppc64 | ppc64p7 | s390 | s390x | sparc | sparc64 | aarch64 )
    mv $RPM_BUILD_ROOT%{_includedir}/pg_config.h $RPM_BUILD_ROOT%{_includedir}/pg_config_`uname -i`.h
    install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_includedir}/
    mv $RPM_BUILD_ROOT%{_includedir}/pgsql/server/pg_config.h $RPM_BUILD_ROOT%{_includedir}/pgsql/server/pg_config_`uname -i`.h
    install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_includedir}/pgsql/server/
    mv $RPM_BUILD_ROOT%{_includedir}/ecpg_config.h $RPM_BUILD_ROOT%{_includedir}/ecpg_config_`uname -i`.h
    install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_includedir}/
    ;;
  *)
    ;;
esac

install -d -m 755 $RPM_BUILD_ROOT%{_libdir}/pgsql/tutorial
cp -p src/tutorial/* $RPM_BUILD_ROOT%{_libdir}/pgsql/tutorial

%if ! %{selinux}
mkdir -p -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/contrib
%endif

%if %pam
install -d $RPM_BUILD_ROOT/etc/pam.d
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT/etc/pam.d/%{?scl_prefix}postgresql
%endif

# Create the directory for sockets.
install -d -m 755 $RPM_BUILD_ROOT%{?_localstatedir}/run/postgresql

# ... and make a tmpfiles script to recreate it at reboot.
mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
install -m 0644 %{SOURCE13} $RPM_BUILD_ROOT%{_tmpfilesdir}/%{?scl_prefix}postgresql.conf

# PGDATA needs removal of group and world permissions due to pg_pwd hole.
install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql/data 

# backups of data go here...
install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql/backups

# postgres' .bash_profile

%if 0%{?scl:1}
install -d -m 755 $RPM_BUILD_ROOT%{?_root_localstatedir}/run/postgresql

# make sure /var/lib/pgsql exists, see bz#1023113
mkdir -p -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql
mkdir -p -m 700 $RPM_BUILD_ROOT%{?_root_localstatedir}/lib/pgsql

%endif

# see bz#1009365
sed -i	-e 's|/var/lib/pgsql/data|%{?localstatedir}/lib/pgsql/data|' postgresql-bashprofile
install -m 644 postgresql-bashprofile $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql/.bash_profile

%if %test
	# tests. There are many files included here that are unnecessary,
	# but include them anyway for completeness.  We replace the original
	# Makefiles, however.
	mkdir -p $RPM_BUILD_ROOT%{_libdir}/pgsql/test
	cp -a src/test/regress $RPM_BUILD_ROOT%{_libdir}/pgsql/test
	# pg_regress binary should be only in one subpackage, 
	# there will be a symlink from -test to -devel
	rm -f $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress/pg_regress
	ln -sf ../../pgxs/src/test/regress/pg_regress $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress/pg_regress
	pushd  $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress
	rm -f GNUmakefile Makefile *.o
	chmod 0755 pg_regress regress.so
	popd
	cp %{SOURCE5} $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress/Makefile
	chmod 0644 $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress/Makefile
%endif

# To allow --short-circuit
rm -rf doc/html

# Fix some more documentation
mv $RPM_BUILD_ROOT%{_docdir}/pgsql/html doc
rm -rf $RPM_BUILD_ROOT%{_docdir}/pgsql

# remove files not to be packaged
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a

%if !%plperl
rm -f $RPM_BUILD_ROOT%{_bindir}/pgsql/hstore_plperl.so
%endif

%if !%plpython
rm -f $RPM_BUILD_ROOT%{_bindir}/pgsql/hstore_plpython2.so
%endif

# initialize file lists
cp /dev/null main.lst
cp /dev/null libs.lst
cp /dev/null server.lst
cp /dev/null devel.lst
cp /dev/null plperl.lst
cp /dev/null pltcl.lst
cp /dev/null plpython.lst
cp /dev/null plpython3.lst

%if %nls
%find_lang ecpg-%{majorversion}
cat ecpg-%{majorversion}.lang >>devel.lst
%find_lang ecpglib%{?scl_prefix}6-%{majorversion}
cat ecpglib%{?scl_prefix}6-%{majorversion}.lang >>libs.lst
%find_lang initdb-%{majorversion}
cat initdb-%{majorversion}.lang >>server.lst
%find_lang libpq%{?scl_prefix}5-%{majorversion}
cat libpq%{?scl_prefix}5-%{majorversion}.lang >>libs.lst
%find_lang pg_basebackup-%{majorversion}
cat pg_basebackup-%{majorversion}.lang >>server.lst
%find_lang pg_controldata-%{majorversion}
cat pg_controldata-%{majorversion}.lang >>server.lst
%find_lang pg_ctl-%{majorversion}
cat pg_ctl-%{majorversion}.lang >>server.lst
%find_lang pg_config-%{majorversion}
cat pg_config-%{majorversion}.lang >>main.lst
%find_lang pg_dump-%{majorversion}
cat pg_dump-%{majorversion}.lang >>main.lst
%find_lang pg_resetxlog-%{majorversion}
cat pg_resetxlog-%{majorversion}.lang >>server.lst
%find_lang pg_rewind-%{majorversion}
cat pg_rewind-%{majorversion}.lang >>server.lst
%find_lang pgscripts-%{majorversion}
cat pgscripts-%{majorversion}.lang >>main.lst
%if %plperl
%find_lang plperl-%{majorversion}
cat plperl-%{majorversion}.lang >>plperl.lst
%endif
%find_lang plpgsql-%{majorversion}
cat plpgsql-%{majorversion}.lang >>server.lst
%if %plpython
%find_lang plpython-%{majorversion}
cat plpython-%{majorversion}.lang >>plpython.lst
%endif
%if %plpython3
# plpython3 shares message files with plpython
%find_lang plpython-%{majorversion}
cat plpython-%{majorversion}.lang >>plpython3.lst
%endif
%if %pltcl
%find_lang pltcl-%{majorversion}
cat pltcl-%{majorversion}.lang >>pltcl.lst
%endif
%find_lang postgres-%{majorversion}
cat postgres-%{majorversion}.lang >>server.lst
%find_lang psql-%{majorversion}
cat psql-%{majorversion}.lang >>main.lst
%endif


%post libs -p /sbin/ldconfig 
%postun libs -p /sbin/ldconfig 

%pre server
/usr/sbin/groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
/usr/sbin/useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
%if 0%{?rhel} >= 6
-N \
%endif
	-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :

%post server
%if 0%{?scl:1}
semanage fcontext -a -e "%{_unitdir}/postgresql.service" "%{_unitdir}/%{scl_prefix}postgresql.service" >/dev/null 2>&1 || :
# Per hhorak's report:  It seems that we can't simply use
# semanage fcontext -a -e %%{_root_bindir}/pg_ctl %%{_root_libexecdir}/postgresql-ctl
# because the equivalence (-e, --equal) rules are not transitive thus the
# %%{_libexec}/postgresql-ctl would get wrong context.
semanage fcontext -a -t postgresql_exec_t %{_root_libexecdir}/postgresql-ctl || :
selinuxenabled && load_policy || :
restorecon -R "%{?_scl_root}/" >/dev/null 2>&1 || :
restorecon -R "%{_sysconfdir}" >/dev/null 2>&1 || :
restorecon -R "%{_localstatedir}" >/dev/null 2>&1 || :
restorecon -R "%{_unitdir}/%{scl_prefix}postgresql.service" >/dev/null 2>&1 || :
%endif

%systemd_post %service_name
/sbin/ldconfig

%preun server
%systemd_preun %service_name

%postun server
%systemd_postun_with_restart %service_name


%check
cd postgresql-setup-%{setup_version}
make check
cd -


# FILES section.

%files -f main.lst
%doc doc/KNOWN_BUGS doc/MISSING_FEATURES doc/TODO
%doc COPYRIGHT README HISTORY doc/bug.template
%doc doc/html
%doc README.rpm-dist
%{_bindir}/clusterdb
%{_bindir}/createdb
%{_bindir}/createlang
%{_bindir}/createuser
%{_bindir}/dropdb
%{_bindir}/droplang
%{_bindir}/dropuser
%{_bindir}/pg_config
%{_bindir}/pg_dump
%{_bindir}/pg_dumpall
%{_bindir}/pg_isready
%{_bindir}/pg_restore
%{_bindir}/pg_upgrade
%{_bindir}/psql
%{_bindir}/reindexdb
%{_bindir}/vacuumdb
%{_mandir}/man1/clusterdb.*
%{_mandir}/man1/createdb.*
%{_mandir}/man1/createlang.*
%{_mandir}/man1/createuser.*
%{_mandir}/man1/dropdb.*
%{_mandir}/man1/droplang.*
%{_mandir}/man1/dropuser.*
%{_mandir}/man1/pg_config.*
%{_mandir}/man1/pg_dump.*
%{_mandir}/man1/pg_dumpall.*
%{_mandir}/man1/pg_isready.*
%{_mandir}/man1/pg_restore.*
%{_mandir}/man1//pg_upgrade.*
%{_mandir}/man1/psql.*
%{_mandir}/man1/reindexdb.*
%{_mandir}/man1/vacuumdb.*
%{_mandir}/man7/*
%dir %{_libdir}/pgsql

%files docs
%doc *-US.pdf
%{_libdir}/pgsql/tutorial/
%doc doc/html

%files contrib
%{_datadir}/pgsql/extension/adminpack*
%{_datadir}/pgsql/extension/autoinc*
%{_datadir}/pgsql/extension/btree_gin*
%{_datadir}/pgsql/extension/btree_gist*
%{_datadir}/pgsql/extension/chkpass*
%{_datadir}/pgsql/extension/citext*
%{_datadir}/pgsql/extension/cube*
%{_datadir}/pgsql/extension/dblink*
%{_datadir}/pgsql/extension/dict_int*
%{_datadir}/pgsql/extension/dict_xsyn*
%{_datadir}/pgsql/extension/earthdistance*
%{_datadir}/pgsql/extension/file_fdw*
%{_datadir}/pgsql/extension/fuzzystrmatch*
%{_datadir}/pgsql/extension/hstore*
%{_datadir}/pgsql/extension/insert_username*
%{_datadir}/pgsql/extension/intagg*
%{_datadir}/pgsql/extension/intarray*
%{_datadir}/pgsql/extension/isn*
%{_datadir}/pgsql/extension/lo*
%{_datadir}/pgsql/extension/ltree*
%{_datadir}/pgsql/extension/moddatetime*
%{_datadir}/pgsql/extension/pageinspect*
%{_datadir}/pgsql/extension/pg_buffercache*
%{_datadir}/pgsql/extension/pgcrypto*
%{_datadir}/pgsql/extension/pg_freespacemap*
%{_datadir}/pgsql/extension/pg_prewarm*
%{_datadir}/pgsql/extension/pgrowlocks*
%{_datadir}/pgsql/extension/pg_stat_statements*
%{_datadir}/pgsql/extension/pgstattuple*
%{_datadir}/pgsql/extension/pg_trgm*
%{_datadir}/pgsql/extension/postgres_fdw*
%{_datadir}/pgsql/extension/refint*
%{_datadir}/pgsql/extension/seg*
%{_datadir}/pgsql/extension/tablefunc*
%{_datadir}/pgsql/extension/tcn*
%{_datadir}/pgsql/extension/timetravel*
%{_datadir}/pgsql/extension/tsearch2*
%{_datadir}/pgsql/extension/tsm_system_rows*
%{_datadir}/pgsql/extension/tsm_system_time*
%{_datadir}/pgsql/extension/unaccent*
%{_libdir}/pgsql/adminpack.so
%{_libdir}/pgsql/auth_delay.so
%{_libdir}/pgsql/auto_explain.so
%{_libdir}/pgsql/autoinc.so
%{_libdir}/pgsql/btree_gin.so
%{_libdir}/pgsql/btree_gist.so
%{_libdir}/pgsql/chkpass.so
%{_libdir}/pgsql/citext.so
%{_libdir}/pgsql/cube.so
%{_libdir}/pgsql/dblink.so
%{_libdir}/pgsql/dict_int.so
%{_libdir}/pgsql/dict_xsyn.so
%{_libdir}/pgsql/earthdistance.so
%{_libdir}/pgsql/file_fdw.so
%{_libdir}/pgsql/fuzzystrmatch.so
%{_libdir}/pgsql/hstore.so
%if %plperl
%{_libdir}/pgsql/hstore_plperl.so
%endif
%if %plpython
%{_libdir}/pgsql/hstore_plpython2.so
%endif
%{_libdir}/pgsql/insert_username.so
%{_libdir}/pgsql/_int.so
%{_libdir}/pgsql/isn.so
%{_libdir}/pgsql/lo.so
%{_libdir}/pgsql/ltree.so
%if %plpython
%{_libdir}/pgsql/ltree_plpython2.so
%endif
%{_libdir}/pgsql/moddatetime.so
%{_libdir}/pgsql/pageinspect.so
%{_libdir}/pgsql/passwordcheck.so
%{_libdir}/pgsql/pg_buffercache.so
%{_libdir}/pgsql/pgcrypto.so
%{_libdir}/pgsql/pg_freespacemap.so
%{_libdir}/pgsql/pgrowlocks.so
%{_libdir}/pgsql/pg_stat_statements.so
%{_libdir}/pgsql/pgstattuple.so
%{_libdir}/pgsql/pg_trgm.so
%{_libdir}/pgsql/postgres_fdw.so
%{_libdir}/pgsql/refint.so
%{_libdir}/pgsql/seg.so
%{_libdir}/pgsql/tablefunc.so
%{_libdir}/pgsql/tcn.so
%{_libdir}/pgsql/test_decoding.so
%{_libdir}/pgsql/timetravel.so
%{_libdir}/pgsql/tsearch2.so
%{_libdir}/pgsql/tsm_system_rows.so
%{_libdir}/pgsql/tsm_system_time.so
%{_libdir}/pgsql/unaccent.so
%if %selinux
%{_datadir}/pgsql/contrib/sepgsql.sql
%{_libdir}/pgsql/sepgsql.so
%endif
%if %ssl
%{_datadir}/pgsql/extension/sslinfo*
%{_libdir}/pgsql/sslinfo.so
%endif
%if %uuid
%{_datadir}/pgsql/extension/uuid-ossp*
%{_libdir}/pgsql/uuid-ossp.so
%endif
%if %xml
%{_datadir}/pgsql/extension/xml2*
%{_libdir}/pgsql/pgxml.so
%endif
%{_bindir}/oid2name
%{_bindir}/pg_archivecleanup
%{_bindir}/pg_standby
%{_bindir}/pg_test_fsync
%{_bindir}/pg_test_timing
%{_bindir}/pg_xlogdump
%{_bindir}/pgbench
%{_bindir}/vacuumlo
%{_mandir}/man1/oid2name.*
%{_mandir}/man1/pg_archivecleanup.*
%{_mandir}/man1/pgbench.*
%{_mandir}/man1/pg_recvlogical.*
%{_mandir}/man1/pg_standby.*
%{_mandir}/man1/pg_test_fsync.*
%{_mandir}/man1/pg_test_timing.*
%{_mandir}/man1/pg_xlogdump.*
%{_mandir}/man1/vacuumlo.*
%{_mandir}/man3/dblink*
%doc contrib/spi/*.example

%files libs -f libs.lst
%doc COPYRIGHT
%{_libdir}/libpq.so.*
%{_libdir}/libecpg.so.*
%{_libdir}/libpgtypes.so.*
%{_libdir}/libecpg_compat.so.*

%files server -f server.lst
%{_unitdir}/%{scl_prefix}postgresql*.service
%dir %{_root_libexecdir}/initscripts/legacy-actions/%{?scl_prefix}postgresql
%{_root_libexecdir}/initscripts/legacy-actions/%{?scl_prefix}postgresql/*
%if %pam
%config(noreplace) /etc/pam.d/%{?scl_prefix}postgresql
%endif
%{_bindir}/initdb
%{_bindir}/pg_basebackup
%{_bindir}/pg_controldata
%{_bindir}/pg_ctl
%{_bindir}/pg_receivexlog
%{_bindir}/pg_recvlogical
%{_bindir}/pg_resetxlog
%{_bindir}/pg_rewind
%{_bindir}/postgres
%{_bindir}/postgresql-setup
%{_bindir}/postmaster
%{_mandir}/man1/initdb.*
%{_mandir}/man1/pg_basebackup.*
%{_mandir}/man1/pg_controldata.*
%{_mandir}/man1/pg_ctl.*
%{_mandir}/man1/pg_receivexlog.*
%{_mandir}/man1/pg_resetxlog.*
%{_mandir}/man1/pg_rewind.*
%{_mandir}/man1/postgres.*
%{_mandir}/man1/postgresql-setup.*
%{_mandir}/man1/postmaster.*
%{_datadir}/pgsql/postgres.bki
%{_datadir}/pgsql/postgres.description
%{_datadir}/pgsql/postgres.shdescription
%{_datadir}/pgsql/system_views.sql
%{_datadir}/pgsql/*.sample
%{_datadir}/pgsql/timezonesets/
%{_datadir}/pgsql/tsearch_data/
%{_datadir}/postgresql-setup/library.sh
%{_libdir}/pgsql/dict_snowball.so
%{_libdir}/pgsql/pg_prewarm.so
%{_libdir}/pgsql/plpgsql.so
%dir %{_datadir}/pgsql
%dir %{_datadir}/pgsql/contrib
%dir %{_datadir}/pgsql/extension
%{_datadir}/pgsql/extension/plpgsql*
%{_tmpfilesdir}/%{?scl_prefix}postgresql.conf
%attr(755,postgres,postgres) %dir %{?_localstatedir}/run/postgresql
%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql
%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql/data
%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql/backups
%attr(644,postgres,postgres) %config(noreplace) %{?_localstatedir}/lib/pgsql/.bash_profile
%{_libdir}/pgsql/libpqwalreceiver.so
%{_libdir}/pgsql/*_and_*.so
%{_libdir}/pgsql/euc2004_sjis2004.so
%{_datadir}/pgsql/conversion_create.sql
%{_datadir}/pgsql/information_schema.sql
%{_datadir}/pgsql/snowball_create.sql
%{_datadir}/pgsql/sql_features.txt
%{_libexecdir}/postgresql-check-db-dir
%{_libexecdir}/postgresql-ctl
%dir %{_sysconfdir}/postgresql-setup
%dir %{_sysconfdir}/postgresql-setup/upgrade
%config %{_sysconfdir}/postgresql-setup/upgrade/*.conf


%if 0%{?scl:1}
%attr(755,postgres,postgres) %dir %{?_root_localstatedir}/run/postgresql
%attr(700,postgres,postgres) %dir %{?_root_localstatedir}/lib/pgsql
%endif

%files devel -f devel.lst
%{_includedir}/*
%{_bindir}/ecpg
%{_libdir}/libpq.so
%{_libdir}/libecpg.so
%{_libdir}/libecpg_compat.so
%{_libdir}/libpgtypes.so
%{_libdir}/pgsql/pgxs/
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man1/ecpg.*
%{_mandir}/man3/SPI_*

%if %upgrade
%files upgrade
%endif

%if %plperl
%files plperl -f plperl.lst
%{_datadir}/pgsql/extension/plperl*
%{_libdir}/pgsql/plperl.so
%endif

%if %pltcl
%files pltcl -f pltcl.lst
%{_datadir}/pgsql/extension/pltcl*
%{_libdir}/pgsql/pltcl.so
%{_bindir}/pltcl_delmod
%{_bindir}/pltcl_listmod
%{_bindir}/pltcl_loadmod
%{_datadir}/pgsql/unknown.pltcl
%endif

%if %plpython
%files plpython -f plpython.lst
%{_datadir}/pgsql/extension/plpythonu*
%{_datadir}/pgsql/extension/plpython2*
%{_libdir}/pgsql/plpython2.so
%endif

%if %plpython3
%files plpython3 -f plpython3.lst
%{_datadir}/pgsql/extension/plpython3*
%{_libdir}/pgsql/plpython3.so
%endif

%if %test
%files test
%defattr(-,postgres,postgres)
%attr(-,postgres,postgres) %{_libdir}/pgsql/test/*
%attr(-,postgres,postgres) %dir %{_libdir}/pgsql/test
%endif

%changelog
* Wed Nov 18 2015 Pavel Kajaba <pkajaba@redhat.com> - 9.5-1
- Rebase to 9.5. Added: pg_rewind, tsm_system_time, tsm_system_row,
  removed: test_parser, test_shm_mq, worker_spi. moved pg_upgrade to
  main package

* Wed Oct 21 2015 Pavel Raiskup <praiskup@redhat.com> - 9.4.5-1
- update to 9.4.5 per release notes
  http://www.postgresql.org/docs/9.4/static/release-9-4-5.html

* Mon Jun 15 2015 Jozef Mlich <jmlich@redhat.com> - 9.4.4-1
- rebase to 9.4.4 due to security issues
  CVE-2015-3165 CVE-2015-3167 CVE-2015-3166
  Resolves: #1225798

* Sun Mar 22 2015 Pavel Raiskup <praiskup@redhat.com> - 9.4.1-8
- postgresql-setup 3.3 - per several initscript start() issues

* Fri Mar 20 2015 Pavel Raiskup <praiskup@redhat.com> - 9.4.1-7
- set the postgresql-ctl context in main package
- rebase the postgresql-setup to v3.2 to fix --initdb for multiple
  postmasters scenario

* Thu Mar 19 2015 Jozef Mlich <jmlich@redhat.com> - 9.4.1-6
- postgreql-setup was updated to 3.1

* Thu Mar 19 2015 Jozef Mlich <jmlich@redhat.com> - 9.4.1-5
- adding tcl-pgtcl to requires of -tcl subpackage
  Resolves: #1199466

* Mon Mar 02 2015 Pavel Raiskup <praiskup@redhat.com> - 9.4.1-4
- use postgresql-setup.tar.gz

* Tue Feb 24 2015 Pavel Raiskup <praiskup@redhat.com> - 9.4.1-3
- allow pg_upgrade from postgresql92-postgresql (#1196030)

* Wed Feb 18 2015 Honza Horak <hhorak@redhat.com> - 9.4.1-2
- Remove NFS register feature for questionable usage for DBs

* Wed Feb 18 2015 Honza Horak <hhorak@redhat.com> - 9.4.1-1
- Update to 9.4.1
  This also fixes CVE-2015-0244 CVE-2014-8161 CVE-2015-0241 CVE-2015-0243
  Resolves: #1192910

* Thu Jan 29 2015 Jozef Mlich <jmlich@redhat.com> 9.4.0-1
- update to 9.4.0

* Fri Oct  3 2014 Marcela Mašláňová <mmaslano@redhat.com> 9.2.8-2.1
- global must be used in systemd_post, otherwise scriptlets fail
  Resolves: #1149257

* Mon Apr 07 2014 Jozef Mlich <jmlich@redhat.com> 9.2.8-2
- added two dashes into scl-legacy.patch
  Resolves: #1060767

* Wed Mar 26 2014 Jozef Mlich <jmlich@redhat.com> 9.2.8-1
- update to 9.2.8 minor version per release notes:
  http://www.postgresql.org/docs/9.2/static/release-9-2-8.html
  Resolves: #1079994

* Thu Feb 20 2014 Jozef Mlich <jmlich@redhat.com> 9.2.7-2
- update to 9.2.7 minor version per release notes:
  http://www.postgresql.org/docs/9.2/static/release-9-2-7.html
  Resolves: #1065861
  including fixes for CVE-2014-0066 CVE-2014-0064 CVE-2014-0065
  CVE-2014-0062 CVE-2014-0063 CVE-2014-0060 CVE-2014-0061

* Mon Feb 17 2014 Jozef Mlich <jmlich@redhat.com> 9.2.6-8
- Legacy scripts are using scl enable
  Resolves: #1060767
- Release bump to -8 in order to get builds from brew

* Thu Feb 13 2014 Jozef Mlich <jmlich@redhat.com> 9.2.6-4
- Require /usr/bin/scl_source that is not in every scl-utils
  Resolves: #1054261

* Wed Dec 18 2013 Jozef Mlich <jmlich@redhat.com> 9.2.6-3
- release bump to avoid name colision with rhel7 when using
  rhpkg build 

* Wed Dec 18 2013 Jozef Mlich <jmlich@redhat.com> 9.2.6-1
- rebase to 9.2.6
  http://www.postgresql.org/docs/9.2/static/release-9-2-6.html
  Resolves: #1038693
- More details about replication issues are at
  https://wiki.postgresql.org/wiki/Nov2013ReplicationIssue

* Wed Nov 27 2013 Honza Horak <hhorak@redhat.com> 9.2.5-9
- Rebuild for openssl dependency issues

* Wed Nov 27 2013 Honza Horak <hhorak@redhat.com> 9.2.5-8
- Use --no-backup-if-mismatch to avoid inclusion patch left-overs

* Mon Nov 25 2013 Honza Horak <hhorak@redhat.com> 9.2.5-7
- Fix wrongly patched postgresql-setup

* Fri Nov 22 2013 Honza Horak <hhorak@redhat.com> 9.2.5-6
- Restore SCL environment after runuser

* Tue Nov 19 2013 Honza Horak <hhorak@redhat.com> 9.2.5-5
- Port to RHEL-7

* Tue Nov 19 2013 Honza Horak <hhorak@redhat.com> 9.2.5-4
- Remove rpath usage and proper enable SCL environment after su instead

* Mon Nov 18 2013 Jozef Mlich <jmlich@redhat.com> 9.2.5-1
- rebase to 9.2.5
  http://www.postgresql.org/docs/9.2/static/release-9-2-5.html
- modified useradd command
  Resolves #1023113
- modified bash-profile
  Resolves #1009365

* Wed Oct  9 2013 Jozef Mlich <jmlich@redhat.com> 9.2.4-8
- release bump to scl 1.1

* Wed May 15 2013 Honza Horak <hhorak@redhat.com> 9.2.4-7
- Run restorecon to init script as well
  Resolves: #962391

* Tue May 14 2013 Honza Horak <hhorak@redhat.com> 9.2.4-6
- Move lock file under collection root
  Resolves: #962872

* Mon May 13 2013 Honza Horak <hhorak@redhat.com> 9.2.4-5
- Run restorecon in %%post section of -server
  Resolves: #962391

* Thu May  2 2013 Honza Horak <hhorak@redhat.com> 9.2.4-4
- Do not include daemon of the previous version and support upgrade from
  the core system version 8.4
- Pidfile used by init script should be in /opt
- Fix advice in the init script to use proper service name
- Include -devel sub-package for developing server-sice extensions
- Prefix major soname version of all libraries with collection name

* Thu Apr 25 2013 Honza Horak <hhorak@redhat.com> 9.2.4-3
- All sub-packages require SCL runtime
- Use only one Unix socket in /tmp
- Use rpath since we call some commands by runuser in init script,
  so LD_LIBRARY_PATH doesn't work here

* Thu Apr 18 2013 Honza Horak <hhorak@redhat.com> 9.2.4-2
- Remove RHEL-7 stuff

* Thu Apr  4 2013 Tom Lane <tgl@redhat.com> 9.2.4-1
- Update to PostgreSQL 9.2.4, for various fixes described at
  http://www.postgresql.org/docs/9.2/static/release-9-2-4.html
  including the fixes for CVE-2013-1899, CVE-2013-1900, CVE-2013-1901
Resolves: #929223, #929255, #929328
- fix build for aarch64 and ppc64p7

* Wed Feb 13 2013 Honza Horak <hhorak@redhat.com> 9.2.3-1
- Update to PostgreSQL 9.2.3, for various fixes described at
  http://www.postgresql.org/docs/9.2/static/release-9-2-3.html
  including the fix for CVE-2013-0255
Resolves: #908722
- Make the package build with selinux option disabled
Resolves: #894367
- Include old version of pg_controldata in postgresql-upgrade subpackage
Related: #896161

* Fri Jan  4 2013 Honza Horak <hhorak@redhat.com> 9.2.2-1
- Update to PostgreSQL 9.2.2, for various fixes described at
  http://www.postgresql.org/docs/9.2/static/release-9-2-2.html
- Prevent creation of TCP socket during pg_upgrade regression test, so that
  concurrent RPM builds on the same machine won't fail
Resolves: #891531
- Make sure $PGDATA/pg_log/ gets the right SELinux label in postgresql-setup
Resolves: #891547

* Mon Nov 12 2012 Honza Horak <hhorak@redhat.com> 9.2.1-4
- Rebuild for ppc64

* Thu Oct 25 2012 Honza Horak <hhorak@redhat.com> 9.2.1-3
- Run self tests during build
- Use a config file for specifying SCLS enabled when starting service
- Use sclname as a prefix of major number of libpq soname
- Edit spec file for RHEL-5
- Changed way how patch files are enhanced with scl macros values
- Disable uuid module, since e2fsprogs is not compatible
- Basic scripts fail if not run in scl environment
- Use scl-service wrapper to fix systemd start issues
- Fix paths in systemd service file
- Remove quotes from the service file, otherwise arguments are passed
  wrongly to scl-service

* Thu Oct 18 2012 Honza Horak <hhorak@redhat.com> 9.2.1-2
- Initial import into postgresql92 scl branch

* Mon Sep 24 2012 Tom Lane <tgl@redhat.com> 9.2.1-1
- Update to PostgreSQL 9.2.1, for various fixes described at
  http://www.postgresql.org/docs/9.2/static/release-9-2-1.html
  including a nasty data-loss bug
- Adopt new systemd macros for server package install/uninstall triggers
Resolves: #850277

* Mon Sep 10 2012 Tom Lane <tgl@redhat.com> 9.2.0-1
- Update to PostgreSQL 9.2.0 (major version bump);
  in-place upgrade support now works from 9.1.x as the previous version
- Add postgresql-plpython3 subpackage with PL/Python built against Python 3

* Tue Aug 28 2012 Tom Lane <tgl@redhat.com> 9.1.5-2
- Remove unnecessary ldconfig calls in pre/post triggers
Resolves: #849344

* Fri Aug 17 2012 Tom Lane <tgl@redhat.com> 9.1.5-1
- Update to PostgreSQL 9.1.5, for various fixes described at
  http://www.postgresql.org/docs/9.1/static/release-9-1-5.html
  including the fixes for CVE-2012-3488, CVE-2012-3489

* Mon Aug 13 2012 Tom Lane <tgl@redhat.com> 9.1.4-5
- Back-port upstream support for postmaster listening on multiple Unix sockets
- Configure postmaster to create sockets in both /var/run/postgresql and /tmp;
  the former is now the default place for libpq to contact the postmaster.
Resolves: #825448
- Annotate postgresql.conf about not setting port number there
- Minor specfile cleanup per suggestions from Tom Callaway
Related: #845110

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.1.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jul 14 2012 Tom Lane <tgl@redhat.com> 9.1.4-3
- Update code to use oom_score_adj not oom_adj, thereby suppressing
  whining in the kernel log
- Add "legacy action" scripts to support "service postgresql initdb" and
  "service postgresql upgrade" in a now-approved fashion (requires a
  recent version of initscripts to work)
Resolves: #800416

* Mon Jun 11 2012 Petr Pisar <ppisar@redhat.com> - 9.1.4-2
- Perl 5.16 rebuild

* Mon Jun  4 2012 Tom Lane <tgl@redhat.com> 9.1.4-1
- Update to PostgreSQL 9.1.4, for various fixes described at
  http://www.postgresql.org/docs/9.1/static/release-9-1-4.html
  including the fixes for CVE-2012-2143, CVE-2012-2655
Resolves: #826606
- Update previous version (embedded in postgresql-upgrade) to 9.0.8
  because fix in whole-row variable dumping could be needed for upgrades
- Revert fix for bug #800416, per fedora-packaging discussion at
  http://lists.fedoraproject.org/pipermail/packaging/2012-April/008314.html
  "service postgresql initdb" is dead and will stay that way

* Sat Mar 17 2012 Tom Lane <tgl@redhat.com> 9.1.3-3
- Fix postgresql-setup to rely on systemd to parse the unit file, instead
  of using ad-hoc code
Resolves: #804290

* Tue Mar 13 2012 Tom Lane <tgl@redhat.com> 9.1.3-2
- Fix postgresql-setup to look for unit file in /usr/lib and to ignore
  comments therein
Resolves: #802835
- Resurrect a now-mostly-dummy postgresql init script, so that people can
  keep on using "service postgresql initdb" if they wish
Resolves: #800416

* Mon Feb 27 2012 Tom Lane <tgl@redhat.com> 9.1.3-1
- Update to PostgreSQL 9.1.3, for various fixes described at
  http://www.postgresql.org/docs/9.1/static/release-9-1-3.html
  including the fixes for CVE-2012-0866, CVE-2012-0867, CVE-2012-0868
Resolves: #797918

* Mon Jan  9 2012 Tom Lane <tgl@redhat.com> 9.1.2-2
- Make systemd unit file more user-friendly by resurrecting the old init
  script's checks for data directory presence and version match
Resolves: #771496

* Mon Dec  5 2011 Tom Lane <tgl@redhat.com> 9.1.2-1
- Update to PostgreSQL 9.1.2, for various fixes described at
  http://www.postgresql.org/docs/9.1/static/release-9-1-2.html

* Wed Nov 02 2011 Honza Horak <hhorak@redhat.com> 9.1.1-2
- Create a symlink of pg_regress instead of full copy;
  Don't strip symbols from regress libs
Related: #729012

* Mon Sep 26 2011 Tom Lane <tgl@redhat.com> 9.1.1-1
- Update to PostgreSQL 9.1.1, for various fixes described at
  http://www.postgresql.org/docs/9.1/static/release-9-1-1.html
- Enable build (but not test) of contrib/sepgsql
- Clean up specfile build options so that turning options off works again

* Mon Sep 12 2011 Tom Lane <tgl@redhat.com> 9.1.0-1
- Update to PostgreSQL 9.1.0 (major version bump);
  in-place upgrade support now works from 9.0.x as the previous version

* Wed Jul 27 2011 Tom Lane <tgl@redhat.com> 9.0.4-8
- Convert to systemd startup support
Resolves: #696427

* Thu Jul 21 2011 Petr Sabata <contyk@redhat.com> - 9.0.4-7
- Perl mass rebuild

* Wed Jul 20 2011 Petr Sabata <contyk@redhat.com> - 9.0.4-6
- Perl mass rebuild

* Wed Jul  6 2011 Tom Lane <tgl@redhat.com> 9.0.4-5
- Remove erroneously-included Default-Start line from LSB init block
Related: #717024

* Fri Jun 17 2011 Marcela Mašláňová <mmaslano@redhat.com> 9.0.4-4
- Perl mass rebuild
- incorporate upstream patch to make it build with Perl 5.14

* Fri Jun 10 2011 Tom Lane <tgl@redhat.com> 9.0.4-3
- Work around gcc 4.6.0 bug (temporary backport from next upstream release)

* Tue May 10 2011 Tom Lane <tgl@redhat.com> 9.0.4-2
- Add LSB init block to initscript, to ensure sane ordering at system boot
Resolves: #703215

* Mon Apr 18 2011 Tom Lane <tgl@redhat.com> 9.0.4-1
- Update to PostgreSQL 9.0.4, for various fixes described at
  http://www.postgresql.org/docs/9.0/static/release-9-0-4.html
- Add %%{?_isa} to cross-subpackage Requires, per latest packaging guidelines

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.0.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Feb  3 2011 Tom Lane <tgl@redhat.com> 9.0.3-2
- Remove filter-requires-perl-Pg.sh, which doesn't seem to be needed now that
  PyGreSQL has been split out; and our use of it isn't compatible with rpm 4.9
  anyway

* Tue Feb  1 2011 Tom Lane <tgl@redhat.com> 9.0.3-1
- Update to PostgreSQL 9.0.3, for various fixes described at
  http://www.postgresql.org/docs/9.0/static/release-9-0-3.html
  including the fix for CVE-2010-4015
Resolves: #674296

* Tue Dec 28 2010 Tom Lane <tgl@redhat.com> 9.0.2-1
- Update to PostgreSQL 9.0.2 (major version bump)
- Create infrastructure for in-place database upgrade using pg_upgrade
Resolves: #398221

* Thu Dec 16 2010 Tom Lane <tgl@redhat.com> 8.4.6-1
- Update to PostgreSQL 8.4.6, for various fixes described at
  http://www.postgresql.org/docs/8.4/static/release-8-4-6.html
- Ensure we don't package any .gitignore files from the source tarball
Related: #642210

* Tue Oct  5 2010 Tom Lane <tgl@redhat.com> 8.4.5-1
- Update to PostgreSQL 8.4.5, for various fixes described at
  http://www.postgresql.org/docs/8.4/static/release-8-4-5.html
  including the fix for CVE-2010-3433
Related: #639371
- Add -p "$pidfile" to initscript's status call to improve corner cases.
Related: #561010

* Sat Jul 31 2010 Orcan Ogetbil <oget[dot]fedora[at]gmail[dot]com> - 8.4.4-3
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
- Duplicate COPYRIGHT in -libs subpackage, per revised packaging guidelines

* Wed Jun 02 2010 Marcela Maslanova <mmaslano@redhat.com> - 8.4.4-2
- Mass rebuild with perl-5.12.0

* Mon May 17 2010 Tom Lane <tgl@redhat.com> 8.4.4-1
- Update to PostgreSQL 8.4.4, for various fixes described at
  http://www.postgresql.org/docs/8.4/static/release-8-4-4.html
  including fixes for CVE-2010-1169 and CVE-2010-1170
Resolves: #593032

* Sun Mar 14 2010 Tom Lane <tgl@redhat.com> 8.4.3-1
- Update to PostgreSQL 8.4.3, for various fixes described at
  http://www.postgresql.org/docs/8.4/static/release-8-4-3.html

* Mon Feb 22 2010 Tom Lane <tgl@redhat.com> 8.4.2-8
- Bring init script into some modicum of compliance with Fedora/LSB standards
Resolves: #201043

* Thu Feb 18 2010 Tom "spot" Callaway <tcallawa@redhat.com> 8.4.2-7
- adjust license tag to reflect OSI decision

* Tue Jan 26 2010 Tom Lane <tgl@redhat.com> 8.4.2-6
- Emit explicit error message if user tries to build RPM as root
Related: #558921

* Wed Jan 20 2010 Tom Lane <tgl@redhat.com> 8.4.2-5
- Latest version of systemtap needs the probes.o file to be built again
Resolves: #557266
- Provide script and instructions for building the documentation PDF

* Mon Jan 11 2010 Tom Lane <tgl@redhat.com> 8.4.2-4
- Arrange for the postmaster, but not any of its child processes, to be run
  with oom_adj -17.  This compensates for the OOM killer not being smart about
  accounting for shared memory usage.

* Sat Jan  9 2010 Tom Lane <tgl@redhat.com> 8.4.2-3
- Remove the postgresql-python and postgresql-tcl subpackages.  These files
  are now broken out as their own packages (PyGreSQL and tcl-pgtcl,
  respectively), to reflect the now longstanding split of upstream projects.
Related: #452306, #452321

* Tue Jan  5 2010 Tom Lane <tgl@redhat.com> 8.4.2-2
- Remove static libraries (.a files) from package, per packaging guidelines
- Change %%define to %%global, per packaging guidelines

* Wed Dec 16 2009 Tom Lane <tgl@redhat.com> 8.4.2-1
- Update to PostgreSQL 8.4.2, for various fixes described at
  http://www.postgresql.org/docs/8.4/static/release-8-4-2.html
  including two security issues
Related: #546321
Related: #547662
- Use -N not the obsolete -n in useradd call
Resolves: #495727
- Clean up specfile to eliminate rpmlint gripes, mainly by removing
  no-longer-needed provisions for superseding rh-postgresql

* Mon Dec  7 2009 Stepan Kasal <skasal@redhat.com> - 8.4.1-5
- rebuild against perl 5.10.1

* Thu Oct 15 2009 Tom Lane <tgl@redhat.com> 8.4.1-4
- add sparc/sparc64 to multilib header support

* Mon Sep 21 2009 Tom Lane <tgl@redhat.com> 8.4.1-3
- Ensure pgstartup.log gets the right ownership/permissions during initdb
Resolves: #498959

* Wed Sep 16 2009 Tomas Mraz <tmraz@redhat.com> - 8.4.1-2
- Use password-auth common PAM configuration instead of system-auth

* Wed Sep  9 2009 Tom Lane <tgl@redhat.com> 8.4.1-1
- Update to PostgreSQL 8.4.1, for various fixes described at
  http://www.postgresql.org/docs/8.4/static/release-8-4-1.html
  including two security issues
Related: #522085
Related: #522092

* Tue Sep 01 2009 Karsten Hopp <karsten@redhat.com> 8.4.0-3.2
- bump release and build again with the correct libssl

* Tue Sep 01 2009 Karsten Hopp <karsten@redhat.com> 8.4.0-3.1
- disable dtrace on s390x as a workaround until #520469 has been fixed

* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 8.4.0-3
- rebuilt with new openssl

* Thu Aug 20 2009 Tom "spot" Callaway <tcallawa@redhat.com> 8.4.0-2
- update License tag to MIT (PostgreSQL calls it "BSD", but it is MIT)
- Note: This changes nothing from a license compatibility perspective.

* Mon Aug 17 2009 Tom Lane <tgl@redhat.com> 8.4.0-1
- Update to PostgreSQL 8.4.0.  See release notes at
  http://www.postgresql.org/docs/8.4/static/release-8-4.html

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.3.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat Mar 21 2009 Tom Lane <tgl@redhat.com> 8.3.7-1
- Update to PostgreSQL 8.3.7, for various fixes described at
  http://www.postgresql.org/docs/8.3/static/release-8-3-7.html
  notably the fix for CVE-2009-0922

* Tue Mar 10 2009 Tom Lane <tgl@redhat.com> 8.3.6-4
- Prevent dependent packages from needing to include sys/sdt.h
  (unintended side effect of previous patch)
- Use -O1 on alpha, per report from Oliver Falk; -O2 tickles gcc bugs

* Sun Mar  8 2009 Tom Lane <tgl@redhat.com> 8.3.6-3
- Enable tracing via systemtap
Resolves: #488941

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.3.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Feb  7 2009 Tom Lane <tgl@redhat.com> 8.3.6-1
- Update to PostgreSQL 8.3.6, for various fixes described at
  http://www.postgresql.org/docs/8.3/static/release-8-3-6.html

* Wed Jan 21 2009 Dennis Gilmore <dennis@ausil.us> 8.3.5-4
- use -O1 on sparc64

* Sat Jan 17 2009 Tomas Mraz <tmraz@redhat.com> - 8.3.5-3
- rebuild with new openssl

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 8.3.5-2
- Rebuild for Python 2.6

* Sun Nov  2 2008 Tom Lane <tgl@redhat.com> 8.3.5-1
- Update to PostgreSQL 8.3.5.
- Improve display from init script's initdb action, per Michael Schwendt

* Thu Sep 25 2008 Tom Lane <tgl@redhat.com> 8.3.4-1
- Update to PostgreSQL 8.3.4.

* Mon Jul 28 2008 Tom Lane <tgl@redhat.com> 8.3.3-3
- Fix build failure caused by new default patch fuzz = 0 policy in rawhide.

* Fri Jun 20 2008 Tom Lane <tgl@redhat.com> 8.3.3-2
- Install Pgtcl in /usr/lib/tcl$TCL_VERSION, not directly in /usr/lib.
  Needed because tcl 8.5 no longer puts /usr/lib into its package search path.
  NOTE: do not back-port this change into branches using pre-8.5 tcl, because
  /usr/lib/tcl8.4 had been a symlink to /usr/share/tcl8.4, and /usr/share
  is exactly where we must not put Pgtcl.
Resolves: #228263

* Wed Jun 11 2008 Tom Lane <tgl@redhat.com> 8.3.3-1
- Update to PostgreSQL 8.3.3.
- Remove postgresql-prefer-ncurses.patch, no longer needed in recent
  Fedora releases because libtermcap is gone.

* Sat May 17 2008 Tom Lane <tgl@redhat.com> 8.3.1-5
- rebuild because of buildsystem hiccup

* Sat May 17 2008 Tom Lane <tgl@redhat.com> 8.3.1-4
- Enable LDAP support
Resolves: #445315
- Use -Wl,--as-needed to suppress bogus dependencies for libraries that
  are really only needed by some of the subpackages

* Mon Apr 28 2008 Tom Lane <tgl@redhat.com> 8.3.1-3
- Fix build breakage on PPC due to incorrect configure test
Related: #444317

* Sat Apr 26 2008 Tom Lane <tgl@redhat.com> 8.3.1-2
- Clean up cross-subpackage Requires: to ensure that updating any one
  subpackage brings in the matching versions of others.
Resolves: #444271

* Tue Mar 25 2008 Tom Lane <tgl@redhat.com> 8.3.1-1
- Update to PostgreSQL 8.3.1.

* Tue Mar 18 2008 Tom "spot" Callaway <tcallawa@redhat.com> 8.3.0-3
- add Requires for versioned perl (libperl.so)

* Wed Feb  6 2008 Tom Lane <tgl@redhat.com> 8.3.0-2
- Enable the new GSSAPI support in 8.3.0.

* Mon Feb  4 2008 Tom Lane <tgl@redhat.com> 8.3.0-1
- Update to PostgreSQL 8.3.0.

* Fri Jan 18 2008 Tom Lane <tgl@redhat.com> 8.3RC2-1
- Update to PostgreSQL 8.3RC2 (not waiting for 8.3.0 because Fedora 9 alpha
  should be 8.3-based not 8.2-based).
- Update to pgtcl 1.6.2

* Mon Jan  7 2008 Tom Lane <tgl@redhat.com> 8.2.6-1
- Update to PostgreSQL 8.2.6 to fix CVE-2007-4769, CVE-2007-4772,
  CVE-2007-6067, CVE-2007-6600, CVE-2007-6601
- Make initscript and pam config files be installed unconditionally;
  seems new buildroots don't necessarily have those directories in place

* Wed Dec  5 2007 Tom Lane <tgl@redhat.com> 8.2.5-2
- Rebuild for new openssl

* Thu Sep 20 2007 Tom Lane <tgl@redhat.com> 8.2.5-1
- Update to PostgreSQL 8.2.5 and pgtcl 1.6.0

* Tue Sep  4 2007 Tom Lane <tgl@redhat.com> 8.2.4-6
- Fix multilib problem for /usr/include/ecpg_config.h (which is new in 8.2.x)

* Sat Aug 25 2007 Tom Lane <tgl@redhat.com> 8.2.4-5
- Use nicer solution for tzdata file substitution: upstream discussion
  concluded that hardwiring the path was better than a symlink after all.

* Wed Aug 22 2007 Tom Lane <tgl@redhat.com> 8.2.4-4
- Use tzdata package's data files instead of private copy, so that
  postgresql-server need not be turned for routine timezone updates
- Don't remove postgres user/group during RPM uninstall, per Fedora
  packaging guidelines
- Seems we need an explicit BuildRequires on gawk now
- Rebuild to fix Fedora toolchain issues

* Sun Aug 12 2007 Tom Lane <tgl@redhat.com> 8.2.4-3
- Recent perl changes in rawhide mean we need a more specific BuildRequires

* Wed Jun 20 2007 Tom Lane <tgl@redhat.com> 8.2.4-2
- Fix oversight in postgresql-test makefile: pg_regress isn't a shell script
  anymore.  Per upstream bug 3398.

* Tue Apr 24 2007 Tom Lane <tgl@redhat.com> 8.2.4-1
- Update to PostgreSQL 8.2.4 for CVE-2007-2138, data loss bugs
Resolves: #237682

* Wed Feb 14 2007 Karsten Hopp <karsten@redhat.com> 8.2.3-2
- rebuild with tcl-8.4

* Wed Feb  7 2007 Tom Lane <tgl@redhat.com> 8.2.3-1
- Update to PostgreSQL 8.2.3 due to regression induced by security fix
Resolves: #227522

* Sun Feb  4 2007 Tom Lane <tgl@redhat.com> 8.2.2-1
- Update to PostgreSQL 8.2.2 to fix CVE-2007-0555, CVE-2007-0556
Related: #225496

* Fri Jan 12 2007 Tom Lane <tgl@redhat.com> 8.2.1-2
- Split -pl subpackage into three new packages to reduce dependencies
  and track upstream project's packaging.

* Wed Jan 10 2007 Tom Lane <tgl@redhat.com> 8.2.1-1
- Update to PostgreSQL 8.2.1
- Update to pgtcl 1.5.3
- Be sure we link to libncurses, not libtermcap which is disappearing in Fedora

* Thu Dec  7 2006 Jeremy Katz <katzj@redhat.com> - 8.2.0-2
- rebuild for python 2.5

* Mon Dec  4 2006 Tom Lane <tgl@redhat.com> 8.2.0-1
- Update to PostgreSQL 8.2.0
- Update to PyGreSQL 3.8.1
- Fix chcon arguments in test/regress/Makefile
Related: #201035
- Adjust init script to not fool /etc/rc.d/rc
Resolves: #161470
- Change init script to not do initdb automatically, but require
  manual "service postgresql initdb" for safety.  Per upstream discussions.

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 8.1.4-1.1
- rebuild

* Mon May 22 2006 Tom Lane <tgl@redhat.com> 8.1.4-1
- Update to PostgreSQL 8.1.4 (includes fixes for CVE-2006-2313, CVE-2006-2314;
  see bug #192173)
- Update to PyGreSQL 3.8
- Suppress noise from chcon, per bug #187744

* Mon Mar 27 2006 Tom Lane <tgl@redhat.com> 8.1.3-2
- Remove JDBC from this build; we will package it as separate SRPM

* Mon Feb 13 2006 Jesse Keating <jkeating@redhat.com> - 8.1.3-1.1
- rebump for build order issues during double-long bump

* Mon Feb 13 2006 Tom Lane <tgl@redhat.com> 8.1.3-1
- Update to PostgreSQL 8.1.3 (fixes bug #180617, CVE-2006-0553)
- Update to jdbc driver build 405
- Modify multilib header hack to not break non-RH arches, per bug #177564

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 8.1.2-1.1
- rebuilt for new gcc4.1 snapshot and glibc changes

* Mon Jan  9 2006 Tom Lane <tgl@redhat.com> 8.1.2-1
- Update to PostgreSQL 8.1.2
- Repair extraneous quote in pgtcl configure script ... odd that bash
  didn't use to spit up on this.

* Thu Dec 15 2005 Tom Lane <tgl@redhat.com> 8.1.1-3
- fix pg_config.h for 64-bit and ppc platforms
- update Makefile.regress (needs to --load-language=plpgsql)

* Wed Dec 14 2005 Tom Lane <tgl@redhat.com> 8.1.1-2
- oops, looks like we want uname -i not uname -m

* Wed Dec 14 2005 Tom Lane <tgl@redhat.com> 8.1.1-1
- Update to PostgreSQL 8.1.1
- Make pg_config.h architecture-independent for multilib installs;
  put the original pg_config.h into pg_config_$ARCH.h

* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt

* Sat Nov 12 2005 Tom Lane <tgl@redhat.com> 8.1.0-4
- Update included PDF-format manual to 8.1.

* Wed Nov  9 2005 Tom Lane <tgl@redhat.com> 8.1.0-3
- Rebuild due to openssl library update.

* Wed Nov  9 2005 Tom Lane <tgl@redhat.com> 8.1.0-2
- Rebuild due to openssl library update.

* Mon Nov  7 2005 Tom Lane <tgl@redhat.com> 8.1.0-1
- Update to PostgreSQL 8.1.0, PyGreSQL 3.7, and jdbc driver build 404
- Fix PAM config file (must have account not only auth) (bug #167040)
- Add BuildPrereq: libxslt-devel (bug #170141)
- Sync with PGDG SRPM as much as feasible

* Fri Oct 14 2005 Tomas Mraz <tmraz@redhat.com>
- use include instead of pam_stack in pam config

* Tue Oct  4 2005 Tom Lane <tgl@redhat.com> 8.0.4-2
- Add rpath to plperl.so (bug #162198)

* Tue Oct  4 2005 Tom Lane <tgl@redhat.com> 8.0.4-1
- Update to PostgreSQL 8.0.4, PyGreSQL 3.6.2, and jdbc driver build 312
- Adjust pgtcl link command to ensure it binds to correct libpq (bug #166665)
- Remove obsolete Conflicts: against other python versions (bug #166754)
- Add /etc/pam.d/postgresql (bug #167040)
- Include contrib/xml2 in build (bug #167492)

* Tue May 10 2005 Tom Lane <tgl@redhat.com> 8.0.3-1
- Update to PostgreSQL 8.0.3 (includes security and data-loss fixes; see
  bz#156727, CAN-2005-1409, CAN-2005-1410)
- Update to jdbc driver build 311
- Recreate postgres user after superseding an rh-postgresql install (bug #151911)
- Ensure postgresql server is restarted if running during an upgrade

* Thu Apr 14 2005 Florian La Roche <laroche@redhat.com> 8.0.2-2
- rebuild for postgresql-tcl

* Tue Apr 12 2005 Tom Lane <tgl@redhat.com> 8.0.2-1
- Update to PostgreSQL 8.0.2.

* Fri Mar 11 2005 Tom Lane <tgl@redhat.com> 8.0.1-5
- Remove unwanted rpath specification from pgtcl (bz#150649)

* Wed Mar  2 2005 Tom Lane <tgl@redhat.com> 8.0.1-4
- Attach Obsoletes: declarations for rh-postgresql to subpackages (bz#144435)
- Make Requires: and Prereq: package linkages specify release not only
  version, as per recent mailing list discussion.

* Tue Mar  1 2005 Tomas Mraz <tmraz@redhat.com> 8.0.1-3
- rebuild with openssl-0.9.7e

* Mon Feb 21 2005 Tom Lane <tgl@redhat.com> 8.0.1-2
- Repair improper error message in init script when PGVERSION doesn't match.
- Arrange for auto update of version embedded in init script.

* Sun Jan 30 2005 Tom Lane <tgl@redhat.com> 8.0.1-1
- Update to PostgreSQL 8.0.1.
- Add versionless symlinks to jar files (bz#145744)

* Wed Jan 19 2005 Tom Lane <tgl@redhat.com> 8.0.0-1
- Update to PostgreSQL 8.0.0, PyGreSQL 3.6.1, pgtcl 1.5.2,
  and jdbc driver build 309.
- Extensive cleanout of obsolete cruft in patch set.
- Regression tests are run during RPM build (NOTE: cannot build as root when
  this is enabled).
- Postmaster stderr goes someplace useful, not /dev/null (bz#76503, #103767)
- Make init script return a useful exit status (bz#80782)
- Move docs' tutorial directory to %%{_libdir}/pgsql/tutorial, since it
  includes .so files that surely do not belong under /usr/share.
- Remove useless .sgml files from docs RPM (bz#134450)
- Put regression tests under /usr/lib64 on 64-bit archs, since .so files
  are not architecture-independent.

* Wed Jan 12 2005 Tim Waugh <twaugh@redhat.com> 7.4.6-5
- Rebuilt for new readline.

* Tue Jan 11 2005 Dan Walsh <dwalsh@redhat.com> 7.4.6-4
- Add restorecon to postgresql.init in order to restore database to correct
- SELinux context.

* Thu Dec 16 2004 Tom Lane <tgl@redhat.com> 7.4.6-3
- Update to PyGreSQL 3.6 (to fix bug #142711)
- Adjust a few file permissions (bug #142431)
- Assign %%{_libdir}/pgsql to base package instead of -server (bug #74003)

* Mon Nov 15 2004 Tom Lane <tgl@redhat.com> 7.4.6-2
- Rebuild so python components play with python 2.4 (bug 139160)

* Sat Oct 23 2004 Tom Lane <tgl@redhat.com> 7.4.6-1
- Update to PostgreSQL 7.4.6 (bugs 136947, 136949)
- Make init script more paranoid about mkdir step of initializing a new
  database (bugs 136947, 136949)

* Wed Oct 20 2004 Tom Lane <tgl@redhat.com> 7.4.5-4
- Remove contrib/oidjoins stuff from installed fileset; it's of no use
  to ordinary users and has a security issue (bugs 136300, 136301)
- adjust chkconfig priority (bug 128852)

* Tue Oct 05 2004 Tom Lane <tgl@redhat.com> 7.4.5-3
- Solve the stale lockfile problem (bugs 71295, 96981, 134090)
- Use runuser instead of su for SELinux (bug 134588)

* Mon Aug 30 2004 Tom Lane <tgl@redhat.com> 7.4.5-2
- Update to PyGreSQL 3.5.

* Tue Aug 24 2004 Tom Lane <tgl@redhat.com> 7.4.5-1
- Update to PostgreSQL 7.4.5.
- Update JDBC jars to driver build 215.
- Add Obsoletes: entries for rh-postgresql packages, per bug 129278.

* Sat Jul 10 2004 Tom Lane <tgl@redhat.com> 7.4.3-3
- Undo ill-considered chkconfig change that causes server to start
  immediately upon install.  Mea culpa (bug 127552).

* Sat Jul 03 2004 Tom Lane <tgl@redhat.com> 7.4.3-2
- Update JDBC jars to driver build 214.

* Wed Jun 23 2004 Tom Lane <tgl@redhat.com> 7.4.3-1
- Update to PostgreSQL 7.4.3.
- Uninstalling server RPM stops postmaster first, per bug 114846.
- Fix su commands to not assume PG user's shell is sh-like, per bug 124024.
- Fix permissions on postgresql-python doc files, per bug 124822.
- Minor postgresql.init improvements.

* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Wed Mar 10 2004 Tom Lane <tgl@redhat.com> 7.4.2-1
- Update to PostgreSQL 7.4.2; sync with community SRPM as much as possible.
- Support PGOPTS from /etc/sysconfig/pgsql, per bug 111504.
- Fix permissions on /etc/sysconfig/pgsql, per bug 115278.
- SELinux patch in init file: always su </dev/null, per bug 117901.
- Rebuilt

* Tue Mar 02 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Wed Feb 25 2004 Tom Lane <tgl@redhat.com>
- Update to PostgreSQL 7.4.1.
- Rebuilt

* Tue Feb 24 2004 Tom Lane <tgl@redhat.com>
- Fix chown syntax in postgresql.init also.
- Rebuilt

* Mon Feb 23 2004 Tim Waugh <twaugh@redhat.com>
- Use ':' instead of '.' as separator for chown.

* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Fri Jan 9 2004 Lamar Owen <lowen@pari.edu>
- 7.4.1-1PGDG
- Merge Sander Steffann's changes up to 7.4-0.5PGDG
- Proper 7.4.1 JDBC jars this time.
- Patch for no pl/python from Alvaro

* Fri Dec 05 2003 David Jee <djee@redhat.com> 7.4-5
- Rebuild for Perl 5.8.2.

* Mon Dec 01 2003 David Jee <djee@redhat.com> 7.4-4
- Add PyGreSQL patch for deprecated column pg_type.typprtlen [Bug #111263]
- Add headers patch which moves ecpg headers to /usr/include/ecpg
  [Bug #111195]

* Fri Nov 28 2003 David Jee <djee@redhat.com> 7.4-3
- uncomment buildrequires tcl-devel

* Fri Nov 28 2003 David Jee <djee@redhat.com> 7.4-2
- rebuild

* Mon Nov 24 2003 David Jee <djee@redhat.com> 7.4-1
- initial Red Hat build
- move jars to /usr/share/java
- fix rpm-multilib patch to use sysconfig

* Fri Nov 21 2003 Lamar Owen <lowen@pari.edu> <lamar.owen@wgcr.org>
- 7.4-0.1PGDG
- Development JDBC jars in addition to the 7.3 jars; will replace the
- 7.3 jars once 7.4 official jars are released.
- Changed to use the bzip2 source to save a little size.
- Removed some commented out portions of the specfile.
- Removed the 7.3.4 PDF docs.  Will replace with 7.4 PDF's once they
- are ready.

* Tue Nov 18 2003 Kaj J. Niemi <kajtzu@fi.basen.net> 7.4-0.1
- 7.4
- Fixed Patch #1 (now rpm-pgsql-7.4.patch)
- Fixed Patch #2 (now rpm-multilib-7.4.patch):
- Patch #4 is unnecessary (upstream)
- Fixed Patch #6 (now postgresql-7.4-src-tutorial.patch)
- Added Patch #8 (postgresql-7.4-com_err.patch) as com_err()
  is provided by e2fsprogs and CPPFLAGS gets lost somewhere
  inside configure (bad macro?)
- No 7.4 PDF docs available yet (Source #17)
- PyGreSQL is separated from the upstream distribution but
  we include it as usual (Source #18)
- Default to compiling libpq and ECPG as fully thread-safe

- 7.4 Origin.  See previous spec files for previous history. Adapted
- from Red Hat and PGDG's 7.3.4 RPM, directly descended from 
- postgresql-7.3.4-2 as shipped in Fedora Core 1.