-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmailman3.spec
2260 lines (1849 loc) · 84.8 KB
/
mailman3.spec
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
### *** mailman3
###
### see also:
### - https://github.com/pbiering/mailman3-rpm
### - description (below)
###
### Step 1: create source package by
### BUNDLED-AS-REQUIRED PACKAGING (overload existing older versions if required by storing in USER_SITE)
### download required packages and store to ~/rpmbuild/SOURCES
### known required overloading see below defined: b_e_* / b_v_* (*b*undle_*e*nabled / *b*undle_*v*ersion))
### $ rpmbuild -bp --undefine=_disable_source_fetch mailman3.spec
###
### Step 2: install required build dependencies, get list of required packages
### $ rpmbuild -bb mailman3.spec 2>&1 | awk '$0 ~ "is needed" { print $1 }' | xargs echo "dnf install"
###
### Step 3: install required build dependencies, get list of required packages
### $ sudo dnf install ...
###
### Step 4: rebuild
### $ rpmbuild -bb mailman3.spec
# convert version to num
%define v2n() %(echo "%1" | awk -F. '{ print (($1 * 100) + $2) * 100 + $3 }')
# do not create debug packages
%define debug_package %{nil}
# release
%global release_token 2
## MAIN VERSIONS+RELEASE
%global version_mailman 3.3.10
%global version_mailman_web 0.0.9
%global version_mailman_hyperkitty 1.2.1
%if %{v2n %{version_mailman_web}} <= %{v2n 0.0.8}
%define name_mailman_web mailman-web
%else
%define name_mailman_web mailman_web
%endif
## BUNDLED VERSIONS
# base
%define b_v_postorius 1.3.13
%define b_v_hyperkitty 1.3.12
%if %{v2n %{b_v_hyperkitty}} <= %{v2n 1.3.8}
%define name_hyperkitty HyperKitty
%else
%define name_hyperkitty hyperkitty
%endif
%define b_v_mailmanclient 3.3.5
## django mailman related
%define b_v_django_mailman3 1.3.15
%define b_v_django_mailman3_num %(echo "%{b_v_django_mailman3}" | awk -F. '{ print (($1 * 100) + $2) * 100 + $3 }')
%if %{b_v_django_mailman3_num} <= 10311
# <= 1.3.11
%define name_django_mailman3 django-mailman3
%define django_mailman3_extra ""
%else
# >= 1.3.12
%define name_django_mailman3 django_mailman3
%define django_mailman3_extra pyproject
%endif
## BUNDLED DEPENDENCIES VERSIONS
#define b_v_alembic 1.10.3 # typing_extensions/TypeGuard problem
%define b_v_alembic 1.9.4
#define b_v_atpublic 3.1.1 # >= 3.x has no setup.py
%define b_v_atpublic 2.3
%define b_v_attrs 22.2.0
%define b_v_authres 1.2.0
%define b_v_blessed 1.20.0
%define b_v_certifi 2022.12.7
%define b_v_charset_normalizer 3.1.0
%define b_v_click 8.1.3
%define b_v_cryptography 40.0.1
%define b_v_dateutil 2.8.2
%define b_v_defusedxml 0.7.1
%define b_v_dnspython 2.3.0
%define b_v_flit_core 3.8.0
%define b_v_flufl_lock 7.1.1
%define b_v_greenlet 2.0.2
%define b_v_idna 3.4
# version from EL9
%define b_v_importlib_metadata 4.12.0
%define b_v_isort 5.12.0
%define b_v_mako 1.2.4
%define b_v_MarkupSafe 2.1.2
# version from EL9
%define b_v_networkx 2.6.2
# dropped from Python 3.13.0+
%define b_v_nntplib 3.12.2
%define b_v_oauthlib 3.2.2
%define b_v_openid 3.2.0
%define b_v_passlib 1.7.4
# version from F40 2.1.8 has build issues
%define b_v_pdm_backend 2.0.7
%define b_v_pdm_pep517 1.1.3
%define b_v_psutil 5.9.4
#define b_v_jwt 2.6.0 # conflicts on EL with python39-cryptography==3.3.1
%define b_v_jwt 2.5.0
%define b_v_pytz 2023.3
%define b_v_rcssmin 1.1.1
%define b_v_requests_oauthlib 1.3.1
%define b_v_robot_detection 0.4
%define b_v_setuptools 67.6.1
%define b_v_setuptools_scm 7.1.0
#define b_v_sqlalchemy 2.0.9 # EL8 problem typing_extensions/Concatenate
%define b_v_sqlalchemy 1.4.47
%define b_v_sqlparse 0.4.3
#define b_v_tomli 2.0.1 # >= 2.x has no setup.py
#define b_v_tomli 1.2.3 # >= 1.2.x has no setup.py
%define b_v_tomli 1.1.0
#define b_v_typing_extensions 4.5.0 # >= 4.x has no setup.py / 3.10.0.2 causes dataclass_transform dependency problems
#define b_v_typing_extensions 3.10.0.2 # causes dataclass_transform dependency problems
%define b_v_typing_extensions 3.7.4.3
%define b_v_types_cryptography 3.3.23.2
%define b_v_wcwidth 0.2.6
%define b_v_webencodings 0.5.1
# 0.40.0 has issue on EL9 with flit_core
#define b_v_wheel 0.40.0
%define b_v_wheel 0.38.4
# version from EL9
%define b_v_zipp 0.5.1
%define b_v_zope_component 5.1.0
%define b_v_zope_event 4.6
%define b_v_zope_hookable 5.4
%define b_v_zope_interface 6.0
## BUNDLED VERSIONS
# dependencies
%define b_v_aiosmtpd 1.4.4.post2
%define b_v_arrow 1.2.3
%define b_v_asgiref 3.6.0
%define b_v_authheaders 0.15.2
%define b_v_bleach 6.0.0
%define b_v_cffi 1.15.1
%define b_v_dkimpy 1.1.1
%define b_v_docutils 0.19
%define b_v_falcon 3.1.1
%define b_v_flufl_bounce 4.0
%define b_v_gunicorn 20.1.0
%define b_v_lazr_config 2.2.3
%define b_v_lazr_delegates 2.1.0
%if %{v2n %{b_v_hyperkitty}} <= %{v2n 1.3.8}
%define b_v_mistune 2.0.4
%else
%define b_v_mistune 3.0.2
%endif
%define b_v_publicsuffix2 2.20191221
%define b_v_pygments 2.14.0
%define b_v_rjsmin 1.2.1
%define b_v_whoosh 2.7.4
%define b_v_zope_configuration 4.4.1
%define b_v_zope_schema 7.0.1
%define b_v_zope_i18nmessageid 6.0.1
%define b_v_readme_renderer 37.3
%define b_v_cmarkgfm 0.8.0
%define b_v_flufl_i18n 4.1.1
## django dependencies
%define b_v_django 4.2.16
%if %{b_v_django_mailman3_num} <= 10311
%define b_v_django_allauth 0.58.2
%else
%define b_v_django_allauth 0.59.0
%endif
%define b_v_django_appconf 1.0.6
%define b_v_django_compressor 4.4
%define b_v_django_extensions 3.2.3
%define b_v_django_gravatar2 1.4.4
%define b_v_django_haystack 3.2.1
%define b_v_django_picklefield 3.1
%define b_v_django_rest_framework 3.14.0
%define b_v_django_q 1.3.9
## django CAPTCHA related
%define b_v_django_recaptcha 4.0.0
%define b_v_django_hcaptcha 0.2.0
%define b_v_django_friendlycaptcha 0.1.8
%define b_v_django_turnstile 0.1.0
## NAMES
%global pypi_name mailman
%global pname mailman3
# toggle to create a with mailman version 2 non-conflicting package
%if (0%{?rhel} >= 9) || (0%{?fedora} >= 37)
%global mailman3_separated 0
%else
%global mailman3_separated 1
%endif
### base dependencies
%if (0%{?rhel} == 8)
# hardwire to Python 3.9
%define python3_version_num 39
%define python3_version 3.9
BuildRequires: python%{python3_version_num}-devel
BuildRequires: python%{python3_version_num}-setuptools
Requires: python%{python3_version_num}
%else
# Enforce Python >= 3.9
%define python3_version_num 3
#do not overwrite python3_version from rpm-macros
BuildRequires: python3-devel >= 3.9
BuildRequires: python3-setuptools
BuildRequires: python3-pip
Requires: python3 >= 3.9
%endif
## BUNDLED-AS-REQUIRED by EL+EPEL supported requirements
# mandatory packages for mailman
%define b_e_django_mailman3 1
%define b_e_hyperkitty 1
%define b_e_postorius 1
# mandatory packages for enabling CAPTCHA
%define b_e_django_allauth 1
%define b_e_django_recaptcha 1
%define b_e_django_hcaptcha 1
%define b_e_django_friendlycaptcha 1
%define b_e_django_turnstile 1
%define b_e_whoosh 1
# networkx has huge amount of Require/Recommends list, therefore always bundle
%define b_e_networkx 1
%if (0%{?rhel} == 8)
# not available for EL == 8 -> bundle
%define b_e_alembic 1
%define b_e_atpublic 1
%define b_e_attrs 1
%define b_e_authheaders 1
%define b_e_authres 1
%define b_e_bleach 1
%define b_e_blessed 1
%define b_e_cffi 1
%define b_e_dateutil 1
%define b_e_defusedxml 1
%define b_e_dkimpy 1
%define b_e_docutils 1
%define b_e_falcon 1
%define b_e_flit_core 1
%define b_e_flufl_lock 1
%define b_e_greenlet 1
%define b_e_gunicorn 1
%define b_e_importlib_metadata 1
%define b_e_isort 1
%define b_e_jwt 1
%define b_e_lazr_config 1
%define b_e_lazr_delegates 1
%define b_e_mailmanclient 1
%define b_e_mako 1
%define b_e_mistune 1
%define b_e_oauthlib 1
%define b_e_passlib 1
%define b_e_pdm_pep517 1
%define b_e_publicsuffix2 1
%define b_e_pygments 1
%define b_e_pytz 1
%define b_e_rcssmin 1
%define b_e_requests_oauthlib 1
%define b_e_rjsmin 1
%define b_e_robot_detection 1
%define b_e_sqlparse 1
%define b_e_sqlalchemy 1
%define b_e_tomli 1
%define b_e_typing_extensions 1
%define b_e_types_cryptography 1
%define b_e_wcwidth 1
%define b_e_webencodings 1
%define b_e_zipp 1
%define b_e_zope_configuration 1
%define b_e_zope_schema 1
%define b_e_zope_i18nmessageid 1
%define b_e_zope_component 1
%define b_e_zope_configuration 1
%define b_e_zope_event 1
%define b_e_zope_hookable 1
%define b_e_zope_interface 1
%define b_e_zope_schema 1
## django dependencies
%define b_e_django_gravatar2 1
# EL8 provides only 1.1
%define b_e_networkx 1
%endif
# end of rhel==8
%if 0%{?rhel} >= 8
# not available for EL >= 8 -> bundle
%define b_e_arrow 1
%define b_e_cmarkgfm 1
%define b_e_openid 1
%define b_e_readme_renderer 1
%define b_e_flufl_bounce 1
%define b_e_flufl_i18n 1
%endif
# end of rhel>=8
%if 0%{?rhel} >= 8 && 0%{?rhel} <= 9
# not available or too old for EL >= 8 && <=9 but available on EL >= 10-> bundle
# >= 3.5.2 required, 3.4.1-3.el9 is too low
%define b_e_asgiref 1
# superseed EL9 appstream
%define b_e_cffi 1
%define b_e_pdm_backend 1
%define b_e_psutil 1
%endif
# package Django unconditionally to apply CAPTCHA support
%define b_e_django 1
# django-appconf has strong dependency to python-django
%define b_e_django_appconf 1
%define b_e_django_compressor 1
%define b_e_django_extensions 1
# django-picklefield has strong dependency to python-django
%define b_e_django_picklefield 1
%define b_e_django_q 1
%define b_e_django_rest_framework 1
%if (0%{?fedora} == 39)
# f39 has 2.1-24.fc39 which is causing: AttributeError: 'RawConfigParser' object has no attribute 'readfp'
%define b_e_lazr_config 1
%endif
%if (0%{?fedora} <= 41)
%define b_e_flufl_bounce 1
# unclear why installed 8.0.2 is not recognized
%define b_e_flufl_lock 1
%endif
%if (0%{?fedora} <= 42)
%define b_e_flufl_i18n 1
%endif
%if (0%{?fedora} <= 41) || 0%{?rhel} <= 9
%if %{v2n %{b_v_hyperkitty}} >= %{v2n 1.3.9}
# mistune >= 3.0 not packaged so far in Fedora <=41 and EL <= 9
%define b_e_mistune 1
%if 0%{?rhel} <= 9
# EL <= 9 has setuptools <= 53 causing issues when bundling mistune >= 3
%define b_e_setuptools 1
%endif
%endif
%endif
%if (0%{?fedora} >= 37) || (0%{?rhel} >= 9)
# aiosmtpd: >= 1.4.4
%else
%define b_e_aiosmtpd 1
%endif
%if (0%{?fedora} >= 37) || (0%{?rhel} >= 9)
# django-haystack: solved BZ#2187604
%else
# EL8 is not providing for python3.9
%define b_e_django_haystack 1
%endif
%if (0%{?fedora} >= 41)
# nntplib dropped from Python 3.13.0+
%define b_e_nntplib 1
%endif
### Requirements
## Macros
# systemctl/timer/disable-if-active
%define systemctl_timer_disable_if_active() { \
if systemctl -q is-active %1; then \
echo "Timer enabled (disable now) : %1"; \
systemctl disable --now %1; \
else \
echo "Timer not active (nothing todo): %1"; \
fi }
# systemctl/timer/enable-if-not-active
%define systemctl_timer_enable_if_not_active() { \
if systemctl -q is-active %1; then \
echo "Timer already enabled (nothing todo): %1"; \
else \
echo "Timer will be enabled now : %1"; \
systemctl enable --now %1; \
fi }
# requirement conditional build-only without version
%define req_cond_b_o_n_v() \
%if ! %1 \
BuildRequires: python%{python3_version_num}-%2 \
%endif
# requirement conditional build+install without version
%define req_cond_b_i_n_v() \
%if ! %1 \
BuildRequires: python%{python3_version_num}-%2 \
Requires: python%{python3_version_num}-%2 \
%endif
# requirement conditional build+install with version
%define req_cond_b_i_w_v() \
%if ! %1 \
BuildRequires: python%{python3_version_num}-%2 %3 %4 \
Requires: python%{python3_version_num}-%2 %3 %4 \
%endif
# requirement conditional build+install with version and conflicts
%define req_cond_b_i_wcv() \
%if ! %1 \
BuildRequires: python%{python3_version_num}-%2 %3 %4 \
Requires: python%{python3_version_num}-%2 %3 %4 \
%else \
BuildConflicts: python%{python3_version_num}-%2 %5 %6 \
Conflicts: python%{python3_version_num}-%2 %5 %6 \
%endif
# requirement conditional build+install with version and build conflicts
%define req_cond_b_i_wbv() \
%if ! %1 \
BuildRequires: python%{python3_version_num}-%2 %3 %4 \
Requires: python%{python3_version_num}-%2 %3 %4 \
%else \
BuildConflicts: python%{python3_version_num}-%2 \
%endif
### build-only related
%req_cond_b_o_n_v 0 rpm-macros
%req_cond_b_o_n_v 0%{?b_e_flit_core} flit-core
%req_cond_b_o_n_v 0%{?b_e_setuptools} setuptools
%req_cond_b_o_n_v 0%{?b_e_setuptools_scm} setuptools_scm
%req_cond_b_o_n_v 0%{?b_e_wheel} wheel
## Build dependencies
%if 0%{?b_e_cffi}
BuildRequires: libffi-devel
BuildRequires: gcc
%endif
%if 0%{?b_e_pdm_backend}
# pdm_backend
BuildRequires: python3-importlib-metadata
%endif
### build+install related
%req_cond_b_i_w_v 0%{?b_e_aiosmtpd} aiosmtpd >= 1.4.3
%req_cond_b_i_n_v 0%{?b_e_alembic} alembic
%req_cond_b_i_w_v 0%{?b_e_arrow} arrow < 2.0.0 >= 1.1.0
%req_cond_b_i_w_v 0%{?b_e_asgiref} asgiref >= 3.5.2
%req_cond_b_i_n_v 0%{?b_e_atpublic} atpublic
%req_cond_b_i_n_v 0%{?b_e_attrs} attrs
%req_cond_b_i_n_v 0%{?b_e_authres} authres
%req_cond_b_i_w_v 0%{?b_e_authheaders} authheaders >= 0.15.2
%req_cond_b_i_w_v 0%{?b_e_cmarkgfm} cmarkgfm >= 0.8.0
%req_cond_b_i_n_v 0%{?b_e_bleach} bleach
%req_cond_b_i_n_v 0%{?b_e_blessed} blessed
%req_cond_b_i_n_v 0%{?b_e_dateutil} dateutil
%req_cond_b_i_n_v 0%{?b_e_defusedxml} defusedxml
%req_cond_b_i_w_v 0%{?b_e_dkimpy} dkimpy >= 0.7.1
%req_cond_b_i_w_v 0%{?b_e_docutils} docutils >= 0.13.1
%req_cond_b_i_w_v 0%{?b_e_django} django >= 4
%req_cond_b_i_n_v 0%{?b_e_django_compressor} django-compressor
%req_cond_b_i_w_v 0%{?b_e_django_extensions} django-extensions >= 1.3.7
%req_cond_b_i_w_v 0%{?b_e_django_gravatar2} django-gravatar2 >= 1.0.6
%req_cond_b_i_n_v 0%{?b_e_django_picklefield} django-picklefield >= 3.0.1 < 4.0.0
%req_cond_b_i_wcv 0%{?b_e_django_haystack} django-haystack >= 3.2 < 3.2
%req_cond_b_i_n_v 0%{?b_e_django_q} django-q
%req_cond_b_i_n_v 0%{?b_e_django_rest_framework} django-rest-framework
%req_cond_b_i_w_v 0%{?b_e_falcon} falcon >= 3.0.0
%req_cond_b_i_w_v 0%{?b_e_flufl_bounce} flufl-bounce >= 4.0
%req_cond_b_i_w_v 0%{?b_e_flufl_i18n} flufl-i18n >= 3.2
%req_cond_b_i_n_v 0%{?b_e_flufl_lock} flufl-lock >= 5.1
%req_cond_b_i_n_v 0%{?b_e_gunicorn} gunicorn
%req_cond_b_i_n_v 0%{?b_e_greenlet} greenlet
%req_cond_b_i_w_v 0%{?b_e_importlib_metadata} importlib-metadata >= 4.12.0
%req_cond_b_i_n_v 0%{?b_e_isort} isort
%req_cond_b_i_w_v 0%{?b_e_jwt} jwt >= 1.7
%req_cond_b_i_n_v 0%{?b_e_lazr_config} lazr-config
%req_cond_b_i_n_v 0%{?b_e_lazr_delegates} lazr-delegates
%req_cond_b_i_n_v 0%{?b_e_mako} mako
%req_cond_b_i_n_v 0%{?b_e_mailmanclient} mailmanclient
%req_cond_b_i_w_v 0%{?b_e_networkx} networkx >= 2.0
%req_cond_b_i_w_v 0%{?b_e_mistune} mistune >= %{b_v_mistune}
%req_cond_b_i_w_v 0%{?b_e_openid} openid >= 3.0.8
%req_cond_b_i_n_v 0%{?b_e_passlib} passlib
%req_cond_b_i_w_v 0%{?b_e_pdm_backend} pdm-backend >= 2.0.7
%req_cond_b_i_w_v 0%{?b_e_pdm_pep517} pdm-pep517 >= 1.0.4
%req_cond_b_i_w_v 0%{?b_e_psutil} psutil >= 5.9.0
%req_cond_b_i_n_v 0%{?b_e_publicsuffix2} publicsuffix2
%req_cond_b_i_n_v 0%{?b_e_pygments} pygments
%req_cond_b_i_n_v 0%{?b_e_pytz} pytz
%req_cond_b_i_n_v 0%{?b_e_rcssmin} rcssmin
%req_cond_b_i_n_v 0%{?b_e_readme_renderer} readme-renderer
%req_cond_b_i_w_v 0%{?b_e_requests_oauthlib} requests-oauthlib >= 0.3.0
%req_cond_b_i_w_v 0%{?b_e_rjsmin} rjsmin >= 1.2.1
%req_cond_b_i_n_v 0%{?b_e_robot_detection} robot-detection
%req_cond_b_i_n_v 0%{?b_e_sqlalchemy} sqlalchemy
%req_cond_b_i_n_v 0%{?b_e_sqlparse} sqlparse
%req_cond_b_i_n_v 0%{?b_e_tomli} tomli
%req_cond_b_i_n_v 0%{?b_e_typing_extensions} typing-extensions
%req_cond_b_i_n_v 0%{?b_e_webencodings} webencodings
%req_cond_b_i_n_v 0%{?b_e_whoosh} whoosh
%req_cond_b_i_w_v 0%{?b_e_zipp} zipp >= 0.5.1
%req_cond_b_i_n_v 0%{?b_e_zope_component} zope-component
%req_cond_b_i_n_v 0%{?b_e_zope_configuration} zope-configuration
%req_cond_b_i_n_v 0%{?b_e_zope_event} zope-event
%req_cond_b_i_n_v 0%{?b_e_zope_hookable} zope-hookable
%req_cond_b_i_n_v 0%{?b_e_zope_i18nmessageid} zope-i18nmessageid
%req_cond_b_i_n_v 0%{?b_e_zope_interface} zope-interface
%req_cond_b_i_n_v 0%{?b_e_zope_schema} zope-schema
## ALL supported OS versions
%req_cond_b_i_n_v 0 click
%req_cond_b_i_n_v 0 cryptography
%req_cond_b_i_n_v 0 dns
%req_cond_b_i_n_v 0 idna
%req_cond_b_i_n_v 0 markupsafe
%req_cond_b_i_n_v 0 psutil
%req_cond_b_i_n_v 0 requests
%req_cond_b_i_n_v 0 six
%req_cond_b_i_n_v 0 toml
%req_cond_b_i_n_v 0 urllib3
# extra
BuildRequires: publicsuffix-list
Requires: publicsuffix-list
## destination directories
%global basedir /usr/lib/%{pname}
%global logdir %{_localstatedir}/log/%{pname}
%global rundir %{_rundir}/%{pname}
%global lockdir %{_rundir}/lock/%{pname}
%global spooldir %{_localstatedir}/spool/%{pname}
%global vardir %{_localstatedir}/lib/%{pname}
%global etcdir %{_sysconfdir}/%{pname}
%global sysconfdir %{_sysconfdir}
%global builddir %{_builddir}/%{pypi_name}-%{version_mailman}%{?prerelease}
%global bindir %{_libexecdir}/%{pname}
%global sitelibdir %{python3_sitelib}
%global sitearchdir %{python3_sitearch}
%define sitedirsub /.local/lib/python%{python3_version}/site-packages
%global usersitedir %{basedir}%{sitedirsub}
%global sharedstatesitedir %{vardir}%{sitedirsub}
%global lmtpport 8024
# 8025 is default for aiosmtpd
%global webport 8026
%global restapiport 8027
## USER+GROUP
%if (0%{mailman3_separated} == 0)
# The user and group Mailman will run as, same as mailman 2 RPM (this create conflicts in parallel installation)
%global mmuser mailman
%global mmuserid 41
%global mmgroup mailman
%global mmgroupid 41
%else
# The user and group Mailman will run as, different values than mailman 2 RPM to enable parallel setup on one system
# user/group system id will be autogenerated by using -r
%global mmuser mailman3
%global mmuserid ""
%global mmgroup mailman3
%global mmgroupid ""
%endif
### HEADER
Name: %{pname}-enhanced
Summary: The GNU mailing list manager 3 "enhanced"
Version: %{version_mailman}%{?prerelease:~%{prerelease}}
Release: %{release_token}%{?dist}
License: GPLv3
URL: https://www.mailman3.org/
Source1: %{pname}.cfg
Source2: %{pname}-tmpfiles.conf
Source3: %{pname}.service
Source4: %{pname}.logrotate
Source7: %{pname}-gunicorn.conf.py
Source8: %{pname}-django-settings.py
Source9: %{pname}-web.service
Source11: %{pname}-httpd.conf
Source13: %{pname}-hyperkitty.cfg
# SELinux
Source90: %{pname}.fc
Source91: %{pname}.te
Source100: %{__pypi_url}m/%{pypi_name}/%{pypi_name}-%{version_mailman}%{?prerelease}.tar.gz
Source101: %{__pypi_url}m/%{pypi_name}-web/%{name_mailman_web}-%{version_mailman_web}.tar.gz
Source102: %{__pypi_url}m/%{pypi_name}-hyperkitty/%{pypi_name}-hyperkitty-%{version_mailman_hyperkitty}.tar.gz
# converted from mailman3.cron
Source300: %{pname}-notify.service
Source301: %{pname}-digests.service
Source310: %{pname}-notify.timer
Source311: %{pname}-digests.timer
# converted from mailman3-web.cron
Source400: %{pname}-web-minutely.service
Source401: %{pname}-web-quarter_hourly.service
Source402: %{pname}-web-hourly.service
Source403: %{pname}-web-daily.service
Source404: %{pname}-web-weekly.service
Source405: %{pname}-web-monthly.service
Source406: %{pname}-web-yearly.service
Source410: %{pname}-web-minutely.timer
Source411: %{pname}-web-quarter_hourly.timer
Source412: %{pname}-web-hourly.timer
Source413: %{pname}-web-daily.timer
Source414: %{pname}-web-weekly.timer
Source415: %{pname}-web-monthly.timer
Source416: %{pname}-web-yearly.timer
### COMMON PACKAGING
Source1000: %{__pypi_url}p/postorius/postorius-%{b_v_postorius}.tar.gz
Source1001: %{__pypi_url}H/HyperKitty/%{name_hyperkitty}-%{b_v_hyperkitty}.tar.gz
Source1010: %{__pypi_url}a/authheaders/authheaders-%{b_v_authheaders}.tar.gz
Source1011: %{__pypi_url}l/lazr.config/lazr.config-%{b_v_lazr_config}.tar.gz
Source1012: %{__pypi_url}l/lazr.delegates/lazr.delegates-%{b_v_lazr_delegates}.tar.gz
Source1013: %{__pypi_url}a/aiosmtpd/aiosmtpd-%{b_v_aiosmtpd}.tar.gz
Source1014: %{__pypi_url}f/falcon/falcon-%{b_v_falcon}.tar.gz
Source1015: %{__pypi_url}d/dkimpy/dkimpy-%{b_v_dkimpy}.tar.gz
Source1016: %{__pypi_url}m/mistune/mistune-%{b_v_mistune}.tar.gz
Source1017: %{__pypi_url}r/readme_renderer/readme_renderer-%{b_v_readme_renderer}.tar.gz
Source1018: %{__pypi_url}p/publicsuffix2/publicsuffix2-%{b_v_publicsuffix2}.tar.gz
Source1019: %{__pypi_url}r/rjsmin/rjsmin-%{b_v_rjsmin}.tar.gz
Source1020: %{__pypi_url}a/arrow/arrow-%{b_v_arrow}.tar.gz
Source1021: %{__pypi_url}d/docutils/docutils-%{b_v_docutils}.tar.gz
Source1022: %{__pypi_url}b/bleach/bleach-%{b_v_bleach}.tar.gz
Source1023: %{__pypi_url}P/Pygments/Pygments-%{b_v_pygments}.tar.gz
Source1024: %{__pypi_url}a/asgiref/asgiref-%{b_v_asgiref}.tar.gz
Source1025: %{__pypi_url}f/flufl.bounce/flufl.bounce-%{b_v_flufl_bounce}.tar.gz
Source1026: %{__pypi_url}f/flufl.i18n/flufl.i18n-%{b_v_flufl_i18n}.tar.gz
Source1027: %{__pypi_url}W/Whoosh/Whoosh-%{b_v_whoosh}.tar.gz
Source1028: %{__pypi_url}c/cmarkgfm/cmarkgfm-%{b_v_cmarkgfm}.tar.gz
Source1029: %{__pypi_url}c/cffi/cffi-%{b_v_cffi}.tar.gz
Source1031: %{__pypi_url}g/gunicorn/gunicorn-%{b_v_gunicorn}.tar.gz
Source1040: %{__pypi_url}z/zope.configuration/zope.configuration-%{b_v_zope_configuration}.tar.gz
Source1041: %{__pypi_url}z/zope.schema/zope.schema-%{b_v_zope_schema}.tar.gz
Source1042: %{__pypi_url}z/zope.i18nmessageid/zope.i18nmessageid-%{b_v_zope_i18nmessageid}.tar.gz
## django dependencies
Source1100: %{__pypi_url}D/Django/Django-%{b_v_django}.tar.gz
Source1101: %{__pypi_url}d/django-haystack/django-haystack-%{b_v_django_haystack}.tar.gz
Source1102: %{__pypi_url}d/django-allauth/django-allauth-%{b_v_django_allauth}.tar.gz
Source1104: %{__pypi_url}d/django-q/django-q-%{b_v_django_q}.tar.gz
Source1105: %{__pypi_url}d/django_compressor/django_compressor-%{b_v_django_compressor}.tar.gz
Source1106: %{__pypi_url}d/django-extensions/django-extensions-%{b_v_django_extensions}.tar.gz
Source1107: %{__pypi_url}d/django-gravatar2/django-gravatar2-%{b_v_django_gravatar2}.tar.gz
Source1108: %{__pypi_url}d/djangorestframework/djangorestframework-%{b_v_django_rest_framework}.tar.gz
Source1109: %{__pypi_url}d/django-appconf/django-appconf-%{b_v_django_appconf}.tar.gz
Source1110: %{__pypi_url}d/django-picklefield/django-picklefield-%{b_v_django_picklefield}.tar.gz
## django mailman related
Source1180: %{__pypi_url}d/django-mailman3/%{name_django_mailman3}-%{b_v_django_mailman3}.tar.gz
## django CAPTCHA related
Source1190: %{__pypi_url}d/django-recaptcha/django-recaptcha-%{b_v_django_recaptcha}.tar.gz
Source1191: %{__pypi_url}d/django-hCaptcha/django-hCaptcha-%{b_v_django_hcaptcha}.tar.gz
Source1192: %{__pypi_url}d/django-friendly-captcha/django-friendly-captcha-%{b_v_django_friendlycaptcha}.tar.gz
Source1193: %{__pypi_url}d/django-turnstile/django-turnstile-%{b_v_django_turnstile}.tar.gz
Source2019: %{__pypi_url}n/networkx/networkx-%{b_v_networkx}.tar.gz
Source2030: %{__pypi_url}P/PyJWT/PyJWT-%{b_v_jwt}.tar.gz
Source2036: %{__pypi_url}s/setuptools/setuptools-%{b_v_setuptools}.tar.gz
Source2037: %{__pypi_url}s/setuptools_scm/setuptools_scm-%{b_v_setuptools_scm}.tar.gz
Source2041: %{__pypi_url}s/sqlparse/sqlparse-%{b_v_sqlparse}.tar.gz
Source2043: %{__pypi_url}t/typing_extensions/typing_extensions-%{b_v_typing_extensions}.tar.gz
Source2046: %{__pypi_url}w/wcwidth/wcwidth-%{b_v_wcwidth}.tar.gz
Source2047: %{__pypi_url}w/webencodings/webencodings-%{b_v_webencodings}.tar.gz
Source2048: %{__pypi_url}w/wheel/wheel-%{b_v_wheel}.tar.gz
# EL8+
Source2000: %{__pypi_url}a/alembic/alembic-%{b_v_alembic}.tar.gz
Source2001: %{__pypi_url}a/atpublic/atpublic-%{b_v_atpublic}.tar.gz
Source2002: %{__pypi_url}a/attrs/attrs-%{b_v_attrs}.tar.gz
Source2003: %{__pypi_url}a/authres/authres-%{b_v_authres}.tar.gz
Source2004: %{__pypi_url}b/blessed/blessed-%{b_v_blessed}.tar.gz
Source2005: %{__pypi_url}c/certifi/certifi-%{b_v_certifi}.tar.gz
Source2006: %{__pypi_url}c/charset-normalizer/charset-normalizer-%{b_v_charset_normalizer}.tar.gz
Source2010: %{__pypi_url}d/defusedxml/defusedxml-%{b_v_defusedxml}.tar.gz
Source2012: %{__pypi_url}f/flit_core/flit_core-%{b_v_flit_core}.tar.gz
Source2013: %{__pypi_url}f/flufl.lock/flufl.lock-%{b_v_flufl_lock}.tar.gz
Source2014: %{__pypi_url}g/greenlet/greenlet-%{b_v_greenlet}.tar.gz
Source2015: %{__pypi_url}i/importlib_metadata/importlib_metadata-%{b_v_importlib_metadata}.tar.gz
Source2016: %{__pypi_url}i/isort/isort-%{b_v_isort}.tar.gz
Source2017: %{__pypi_url}M/Mako/Mako-%{b_v_mako}.tar.gz
Source2020: %{__pypi_url}o/oauthlib/oauthlib-%{b_v_oauthlib}.tar.gz
Source2022: %{__pypi_url}p/passlib/passlib-%{b_v_passlib}.tar.gz
Source2023: %{__pypi_url}p/pdm-pep517/pdm-pep517-%{b_v_pdm_pep517}.tar.gz
Source2024: %{__pypi_url}p/pdm-backend/pdm_backend-%{b_v_pdm_backend}.tar.gz
Source2025: %{__pypi_url}p/psutil/psutil-%{b_v_psutil}.tar.gz
Source2027: %{__pypi_url}p/python-dateutil/python-dateutil-%{b_v_dateutil}.tar.gz
Source2028: %{__pypi_url}p/python3-openid/python3-openid-%{b_v_openid}.tar.gz
Source2029: %{__pypi_url}p/pytz/pytz-%{b_v_pytz}.tar.gz
Source2031: %{__pypi_url}r/rcssmin/rcssmin-%{b_v_rcssmin}.tar.gz
Source2034: %{__pypi_url}r/requests-oauthlib/requests-oauthlib-%{b_v_requests_oauthlib}.tar.gz
Source2035: %{__pypi_url}r/robot-detection/robot-detection-%{b_v_robot_detection}.tar.gz
Source2042: %{__pypi_url}S/SQLAlchemy/SQLAlchemy-%{b_v_sqlalchemy}.tar.gz
Source2044: %{__pypi_url}t/tomli/tomli-%{b_v_tomli}.tar.gz
Source2045: %{__pypi_url}z/zipp/zipp-%{b_v_zipp}.tar.gz
Source2049: %{__pypi_url}z/zope.component/zope.component-%{b_v_zope_component}.tar.gz
Source2050: %{__pypi_url}z/zope.event/zope.event-%{b_v_zope_event}.tar.gz
Source2051: %{__pypi_url}z/zope.hookable/zope.hookable-%{b_v_zope_hookable}.tar.gz
Source2052: %{__pypi_url}z/zope.interface/zope.interface-%{b_v_zope_interface}.tar.gz
Source2055: %{__pypi_url}t/types-cryptography/types-cryptography-%{b_v_types_cryptography}.tar.gz
# Python 3.13.0+
Source2080: %{__pypi_url}s/standard-nntplib/standard_nntplib-%{b_v_nntplib}.tar.gz
Source2090: %{__pypi_url}m/mailmanclient/mailmanclient-%{b_v_mailmanclient}.tar.gz
Patch3000: mailman3-haystack-whoosh_backend-PR1870.patch
Patch3001: mailman3-whoosh-whoosh3.patch
Patch1024: zope.i18nmessageid-setuptools.patch
## CAPTCHA enabling patches
# shared library
Source900: django_multi_captcha_support.py
# code extensions
Patch901: mailman3-postorius-forms-list_forms.py-CAPTCHA.patch
Patch902: mailman3-allauth-account-forms.py-CAPTCHA.patch
Patch903: mailman3-django-contrib-admin-forms.py-CAPTCHA.patch
# template extensions
Patch913: mailman3-django-contrib-admin-templates-admin-login.html-CAPTCHA.patch
# code patches
Patch929: django_recaptcha-4.0.0-broken-v2.patch
## Arch adjustments
%define noarch 1
# has binary packages
%{?b_e_cmarkgfm:%define noarch 0}
%{?b_e_cffi:%define noarch 0}
%{?b_e_rjsmin:%define noarch 0}
%{?b_e_zope_hookable:%define noarch 0}
%{?b_e_zope_i18nmessageid:%define noarch 0}
%{?b_e_zope_interface:%define noarch 0}
# conflict with virtualenv mailman3
Conflicts: mailman3-virtualenv
# conflict with mailman3 (from Upstream)
Conflicts: mailman3
# conflict with mailman version 2 as long as sharing the same user
%if (0%{mailman3_separated} == 0)
Conflicts: mailman
%endif
# SELinux https://fedoraproject.org/wiki/SELinux/IndependentPolicy#Creating_the_Spec_File
Provides: %{pname}-selinux == %{version}-%{release}
%global selinux_variants mls targeted
Requires: selinux-policy >= %{_selinux_policy_version}
BuildRequires: pkgconfig(systemd)
BuildRequires: selinux-policy
BuildRequires: selinux-policy-devel
Requires(post): selinux-policy-base >= %{_selinux_policy_version}
Requires(post): libselinux-utils
Requires(post): policycoreutils
%if 0%{?fedora} || 0%{?rhel} >= 8
Requires(post): policycoreutils-python-utils
%else
Requires(post): policycoreutils-python
%endif
BuildRequires: pyproject-rpm-macros
# SELinux https://fedoraproject.org/wiki/SELinux_Policy_Modules_Packaging_Draft
BuildRequires: checkpolicy, selinux-policy-devel
BuildRequires: hardlink
# Scriptlets
%{?systemd_requires}
BuildRequires: systemd
Requires(pre): shadow-utils
# httpd config for Web UI
BuildRequires: httpd-devel
Requires: httpd
# i18n
BuildRequires: gettext
# CSS compilation
Requires: sassc
# Webinterface
Requires: httpd
# email system
Requires: postfix
# html to plain text
Requires: lynx
# password generator (postinstall)
Requires: /usr/bin/uuidgen
Requires: /usr/bin/md5sum
Requires: /usr/bin/cut
# systemd ExecStartPost
Requires: /usr/sbin/ss
Requires: /usr/bin/timeout
## MACROS for prepare/build/install
%define get_source(n:) %{lua:
n = tonumber(rpm.expand("%{-n:%{-n*}}"))
for i, s in ipairs(source_nums) do
if (n == s) then
print(sources[i])
end
end
}
%define prep_cond() (\
echo "SETUP_COND: '%1' '%2'"; \
if [ "%1" = "1" ]; then \
%setup -q -T -a %2 -D -n %{builddir} \
fi)
%define build_cond() (\
echo "BUILD_COND: '%1' '%2' '%3' '%4'"; \
if [ "%1" = "1" ]; then \
%define buildsubdir %{pypi_name}-%{version_mailman}%{?prerelease} \
pushd %3-%2 || exit 1 \
if [ "%4" = "pyproject" ]; then \
%pyproject_wheel \
else \
%py3_build \
fi \
popd \
fi)
%define install_cond() (\
echo "INSTALL_COND: '%1' '%2' '%3' '%4'"; \
%define buildsubdir %{pypi_name}-%{version_mailman}%{?prerelease} \
if [ "%1" = "1" ]; then \
pushd %3-%2 || exit 1 \
if [ "%4" = "pyproject" ]; then \
%{__mkdir} -p %{buildroot}%{sitearchdir}/dummy.dist-info \
touch %{buildroot}%{sitearchdir}/dummy.dist-info/{INSTALLER,RECORD} \
%pyproject_install \
else \
%py3_install \
fi \
popd \
fi)
%description
This is GNU Mailman, a mailing list management system distributed under the
terms of the GNU General Public License (GPL) version 3 or later. The name of
this software is spelled 'Mailman' with a leading capital 'M' but with a lower
case second `m'. Any other spelling is incorrect.
* THIS package contains Mailman 3 and all required but by OS not supported modules
USER_SITE: %{usersitedir}
%if 0%{mailman3_separated}
* THIS package can coexist with Mailman 2
%else
* THIS package conflicts with Mailman 2
%endif
* THIS package contains scheduled tasks using: systemd.timer
user/group : %{mmuser}/%{mmgroup}
directory : %{vardir}
it contains also
mailman-web : %{version_mailman_web} using 'gunicorn'
mailman-hyperkitty: %{version_mailman_hyperkitty}
important forms are extended with CAPTCHA protection:
recaptcha hcaptcha friendlycaptcha turnstile
default configuration:
database: sqlite3
indexer : whoosh
CAPTCHA : NONE (requires custom secret+site key)
preconfigured ports (required for SELinux)
LMTP : %{lmtpport}
REST-API : %{restapiport}
Web Interface: %{webport}
%prep
%{__rm} -rf %{builddir}
%{__mkdir} %{builddir}
cd %{builddir}
set +x
%if 0%{mailman3_separated}
echo "** RPM: separate Mailman 3 from Mailman 2"
%else
echo "** RPM: Mailman 3 conflicts with Mailman 2"
%endif
%if 0%{?mailman3_cron}
echo "** Scheduled tasks: packaged using cron"
%else
echo "** Scheduled tasks: packaged using systemd.timer"
%endif