aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitremotes4
-rwxr-xr-x1-build-srpms.sh107
-rwxr-xr-x2-upload-srpms.sh36
-rw-r--r--README.md71
-rw-r--r--lib.sh31
-rw-r--r--radicale-proxy-ldap-auth-fn.js.patch67
6 files changed, 316 insertions, 0 deletions
diff --git a/.gitremotes b/.gitremotes
new file mode 100644
index 0000000..5f11a52
--- /dev/null
+++ b/.gitremotes
@@ -0,0 +1,4 @@
+gitlab https://gitlab.com/bgstack15/build-radicale-el7.git (fetch)
+gitlab https://gitlab.com/bgstack15/build-radicale-el7.git (push)
+local https://bgstack15.ddns.net/git/build-radicale-el7 (fetch)
+local https://bgstack15.ddns.net/git/build-radicale-el7 (push)
diff --git a/1-build-srpms.sh b/1-build-srpms.sh
new file mode 100755
index 0000000..994835c
--- /dev/null
+++ b/1-build-srpms.sh
@@ -0,0 +1,107 @@
+#!/bin/sh
+# File: 1-build-srpms.sh
+# Author: bgstack15
+# SPDX-License-Identifier: GPL-3.0
+# Startdate: 2022-05-17 10:20
+# Title: Build SRPMs for radicale3 for el7
+# Project: build-radicale-centos7
+# Purpose: Build srpms for upload to copr
+# History:
+# Improve:
+# Reference:
+# Dependencies:
+# git
+# Run this on CentOS 7
+# radicale-proxy-ldap-auth-fn.js.patch from this repo
+# Documentation:
+# README.md
+
+SCRIPTDIR="$( dirname "$(readlink -f "${0}" )" )"
+
+. "${SCRIPTDIR}/lib.sh"
+
+# If you actually compile these packages locally, you need to install these packages.
+if test -n "${BUILD_PACKAGES}" ;
+then
+ need_packages=
+ rpm -q python36-bcrypt 1>/dev/null || need_packages="${need_packages} python36-bcrypt"
+ rpm -q python36-dateutil 1>/dev/null || need_packages="${need_packages} python36-dateutil"
+ test -n "${need_packages}" && sudo yum install ${need_packages}
+fi
+
+mkdir -p "${WORKDIR}"
+cd "${WORKDIR}"
+
+# need python3-coverage
+git clone https://src.fedoraproject.org/rpms/python-coverage python-coverage
+( cd python-coverage ; git checkout -- *.spec ; git checkout "${FEDORA_VER}" ; cp -pf * ~/rpmbuild/SOURCES/ ; rpmbuild -bs *.spec )
+# generated ~/rpmbuild/SRPMS/python-coverage*.src.rpm
+
+# need python3-nose
+git clone https://src.fedoraproject.org/rpms/python-nose python-nose
+( cd python-nose ; git checkout -- *.spec ; git checkout "${FEDORA_VER}" ; cp -pf * ~/rpmbuild/SOURCES/ ; rpmbuild -bs *.spec )
+
+# need python36-passlib
+# This needs python36-bcrypt when compiling, for some inexplicable reason.
+git clone https://src.fedoraproject.org/rpms/python-passlib python-passlib
+(
+ cd python-passlib
+ git checkout -- *.spec ; git checkout "${FEDORA_VER}"
+ sed -i -r python-passlib.spec \
+ -e '/BuildRequires.*nose/aBuildRequires: python36-bcrypt'
+ cp -pf * ~/rpmbuild/SOURCES/ ;
+ rpmbuild -bs *.spec
+)
+
+# need a newer version of python36-dateutil than what CentOS 7 provides
+git clone https://src.fedoraproject.org/rpms/python-dateutil python-dateutil
+(
+ cd python-dateutil
+ git checkout -- *.spec ; git checkout "${FEDORA_VER}"
+ # Disable tests. Fix some python3 to python36 names. Disable docs which are needlessly complicated.
+ sed -i -r python-dateutil.spec \
+ -e '/%bcond.*tests/s/_without/_with/' \
+ -e '/^\w*Requires:.*(sphinx|setuptools|freezegun|hypothesis|pytest|six)/s/python3-/python36-/;' \
+ -e '/docs.*html/{s/^/#/;s/%/%%/g;};' ;
+ cp -pf * ~/rpmbuild/SOURCES/ ;
+ rpmbuild -bs *.spec ;
+)
+
+# need python36-vobject to use adjusted dateutil package name, and also add buildrequires: python36-six
+# This needs python36-dateutil when compiling
+git clone https://src.fedoraproject.org/rpms/python-vobject python-vobject
+(
+ cd python-vobject ;
+ git checkout -- *.spec ; git checkout "${FEDORA_VER}"
+ sed -i -r python-vobject.spec \
+ -e '/^\w*Requires:.*(dateutil)/s/python3-/python36-/;' \
+ -e '/^Summary/aBuildRequires: python36-six\' \
+ -e 'Requires: python36-six'
+ cp -pf * ~/rpmbuild/SOURCES/ ;
+ rpmbuild -bs *.spec ;
+)
+
+# and now prepare radicale3
+git clone https://src.fedoraproject.org/rpms/radicale radicale
+(
+ cd radicale ;
+ git checkout -- *.spec ; git checkout "${FEDORA_VER}"
+ sed -i -r radicale.spec \
+ -e '/^(\w*Requires(\(\w*\))?:|%package|%post|%files|#echo|#\/usr|%description|%\{\?python_provide|Conflicts|Suggests:|Recommends:)/{s/python3-/\%{pyver}-/g;}' \
+ -e '/^sed/s/python3/%{pyver}/g;' \
+ -e '/^SELinux|^httpd example/s/Python3/%{pyver}/;' \
+ -e '/^\w*Requires(\(\w*\))?:/{s/policycoreutils-python-utils/policycoreutils-python/g;};' \
+ -e 's/^(Suggests|Recommends):/Requires:/;' \
+ -e '/%define.*radicale_major/a# stackrpms, 5\' \
+ -e '%define pyver python3\' \
+ -e '%if 0%{?centos}\' \
+ -e '%define pyver python36\' \
+ -e '%endif' \
+ -e '/^%autosetup/s/$/ -p1/;' \
+ -e '/Patch0:/aPatch1: %{name}-proxy-ldap-auth-fn.js.patch' ;
+ cp -pf "${SCRIPTDIR}/"*.patch ~/rpmbuild/SOURCES/
+ cp -pf * ~/rpmbuild/SOURCES/
+ rpmbuild -bs *.spec ;
+)
+
+# Next steps: run script 2
diff --git a/2-upload-srpms.sh b/2-upload-srpms.sh
new file mode 100755
index 0000000..3a78ba1
--- /dev/null
+++ b/2-upload-srpms.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# File: 2-upload-srpms.sh
+# Author: bgstack15
+# SPDX-License-Identifer: GPL-3.0
+# Startdate: 2022-05-17 11:54
+# Title: Upload SRPMs to copr
+# Project: build-radicale-centos7
+# Purpose: upload the generated srpms to copr in order
+# History:
+# Improve:
+# Reference:
+# Dependencies:
+# valid ~/.config/copr for copr authentication
+# Documentation:
+# README.md
+
+SCRIPTDIR="$( dirname "$( readlink -f "${0}" )" )"
+. "${SCRIPTDIR}/lib.sh"
+set -x
+file_coverage=~/rpmbuild/SRPMS/"$( get_latest ~/rpmbuild/SRPMS "python-coverage*.src.rpm" )"
+file_dateutil=~/rpmbuild/SRPMS/"$( get_latest ~/rpmbuild/SRPMS "python-dateutil*.src.rpm" )"
+file_vobject=~/rpmbuild/SRPMS/"$( get_latest ~/rpmbuild/SRPMS "python-vobject*.src.rpm" )"
+file_nose=~/rpmbuild/SRPMS/"$( get_latest ~/rpmbuild/SRPMS "python-nose*.src.rpm" )"
+file_passlib=~/rpmbuild/SRPMS/"$( get_latest ~/rpmbuild/SRPMS "python-passlib*.src.rpm" )"
+file_radicale=~/rpmbuild/SRPMS/"$( get_latest ~/rpmbuild/SRPMS "radicale*.src.rpm" )"
+
+# By omitting the --nowait, we can cause the background jobs to delay so we
+# operate in the correct order.
+copr-cli build "${COPR_REPO}" "${file_coverage}" & job_coverage=$!
+copr-cli build "${COPR_REPO}" "${file_dateutil}" & job_dateutil=$!
+wait ${job_dateutil} && { copr-cli build "${COPR_REPO}" "${file_vobject}" & job_vobject=$! ; }
+wait ${job_coverage} && { copr-cli build "${COPR_REPO}" "${file_nose}" & job_nose=$! ; }
+wait ${job_nose} && { copr-cli build "${COPR_REPO}" "${file_passlib}" & job_passlib=$! ; }
+wait ${job_passlib} ${job_vobject} && { copr-cli build "${COPR_REPO}" "${file_radicale}" & job_radicale=$! ; }
+
+echo "DONE"
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..92a06cf
--- /dev/null
+++ b/README.md
@@ -0,0 +1,71 @@
+# README for build-radicale-el7 project
+<!--
+File: README.md
+Locations:
+ https://gitlab.com/bgstack15/build-radicale-el7
+ https://bgstack15.ddns.net/cgit/build-radicale-el7
+Author: bgstack15
+Startdate: 2022-05-17
+SPDX-License-Identifier: GPL-3.0
+Title: README for build-radicale-el7 project
+Purpose: Describe the project
+History:
+Usage:
+Reference: See References heading
+Improve:
+Dependencies: See Dependencies heading
+Documentation: This whole file
+ -->
+
+## Overview
+This repository contains the steps required to build Radicale3 for CentOS 7 and put the rpms in a copr. The process is generally, "adapt the Fedora packages," which works very well!
+
+## Dependencies
+
+### Packages
+
+* rpmbuild
+* git
+
+### Git repositories
+
+* https://src.fedoraproject.org/rpms/python-nose
+* https://src.fedoraproject.org/rpms/python-passlib
+* https://src.fedoraproject.org/rpms/python-dateutil
+* https://src.fedoraproject.org/rpms/python-vobject
+* https://src.fedoraproject.org/rpms/radicale
+* https://gitlab.com/bgstack15/radicale_auth_ldap
+* https://gitlab.com/bgstack15/radicaleInfCloud
+
+## Using
+You need to establish a [COPR](https://copr.fedorainfracloud.org/) project, and also an api key. Store the api key in ~/.config/copr as typical for copr.
+
+Clone this repository, and examine the shell scripts, at least the top parts, to confirm the variables it will use.
+
+When ready, run `./1-build-srpms.sh`. It will generate in the typical ~/rpmbuild/SRPMS/ path the customized srpms. Some needed no modification from the Fedora sources. Some needed minor changes like `python3` -> `python36`, and some needed
+
+It is possible that my build environment, in which I had already run everything manually, already had the Source: files which tend to be listed in the `sources` file for Fedora's dist-git process. You might have to manually fetch source tarballs. Give `spectool -R -g *.spec` a try in each directory as needed, otherwise you will have to visit each upstream and download the appropriate tarball.
+
+With all the srpms available, run `./2-upload-srpms.sh`. It will run `copr-cli` in the correct order for the build dependencies of the packages. It is not incredibly robust; if any package fails you will have to address it and then re-run the whole thing. I need to redesign it to accept parameters. Pull requests welcome.
+
+Additional packages of type **rpkg** in my COPR include:
+
+Package | clone url | committish
+------------------ | -------------------------------------------------- | ----------
+radicale_auth_ldap | https://gitlab.com/bgstack15/radicale_auth_ldap | 3
+infcloud | https://gitlab.com/bgstack15/radicaleInfCloud | stackrpms
+
+Package `radicale_auth_ldap` is a bonus: I don't actually use it, but I patched it when testing it before going in a different direction (authentication at the reverse proxy level).
+
+Package `infcloud` is the web front-end for the calendar and address book. Its documentation demonstrates how to set up my reverse-proxy with ldap authentication.
+
+### My modifications
+This project modifies Radicale3 to automatically log in the user at the web interface, based on the passed header `HTTP_X_REMOTE_USER`. This might be not to your liking, so you should poke around and disable it if you do not like that.
+
+## Reason for existing
+Radicale is CentOS 7 is version 1.1.2, which is out of date. As of the time of this writing, Radicale is at version 3.1.7. These steps allow me to use Radicale3 with its features on a stable server OS.
+
+I want my server environment to be fairly reproducible, with only configuration changes and not major application changes required.
+
+## References
+All git repo links above.
diff --git a/lib.sh b/lib.sh
new file mode 100644
index 0000000..9f4e0f3
--- /dev/null
+++ b/lib.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# File: lib.sh
+# Author: bgstack15
+# SPDX-License-Identifier: GPL-3.0
+# Startdate: 2022-05-17
+# Title: Library for build-radicale-centos7
+# Project: build-radicale-centos7
+# Purpose: library of common functions and variables
+# History:
+# Usage: dot-sourced by other scripts here
+# Reference:
+# Improve:
+# Dependencies:
+# Documentation:
+# README.md
+
+WORKDIR=~/dev2
+FEDORA_VER=f36
+# COPR username comes from ~/.config/copr auth file
+COPR_REPO=radicale-el7
+
+get_latest() {
+ # call: get_latest ~/rpmbuild/SRPMS "python-nose*.src.rpm"
+ # returns: most-recently-modified python-nose*.src.rpm file
+ ___gl_path="${1}"
+ ___gl_pattern="${2}"
+ (
+ cd "${___gl_path}"
+ basename $( find . -iname "${___gl_pattern}" -exec ls -1t {} + 2>/dev/null | head -n1 ; )
+ )
+}
diff --git a/radicale-proxy-ldap-auth-fn.js.patch b/radicale-proxy-ldap-auth-fn.js.patch
new file mode 100644
index 0000000..de1ff85
--- /dev/null
+++ b/radicale-proxy-ldap-auth-fn.js.patch
@@ -0,0 +1,67 @@
+--- Radicale-3.1.7/radicale/web/internal_data/fn.js.orig 2022-04-20 11:57:41.000000000 -0400
++++ Radicale-3.1.7/radicale/web/internal_data/fn.js 2022-05-16 18:21:39.714987958 -0400
+@@ -119,7 +119,7 @@
+ */
+ function get_principal(user, password, callback) {
+ let request = new XMLHttpRequest();
+- request.open("PROPFIND", SERVER + ROOT_PATH, true, user, password);
++ request.open("PROPFIND", SERVER + ROOT_PATH, true); //, user, password);
+ request.onreadystatechange = function() {
+ if (request.readyState !== 4) {
+ return;
+@@ -162,7 +162,7 @@
+ */
+ function get_collections(user, password, collection, callback) {
+ let request = new XMLHttpRequest();
+- request.open("PROPFIND", SERVER + collection.href, true, user, password);
++ request.open("PROPFIND", SERVER + collection.href, true); //, user, password);
+ request.setRequestHeader("depth", "1");
+ request.onreadystatechange = function() {
+ if (request.readyState !== 4) {
+@@ -288,7 +288,7 @@
+ */
+ function delete_collection(user, password, collection, callback) {
+ let request = new XMLHttpRequest();
+- request.open("DELETE", SERVER + collection.href, true, user, password);
++ request.open("DELETE", SERVER + collection.href, true); //, user, password);
+ request.onreadystatechange = function() {
+ if (request.readyState !== 4) {
+ return;
+@@ -313,7 +313,7 @@
+ */
+ function create_edit_collection(user, password, collection, create, callback) {
+ let request = new XMLHttpRequest();
+- request.open(create ? "MKCOL" : "PROPPATCH", SERVER + collection.href, true, user, password);
++ request.open(create ? "MKCOL" : "PROPPATCH", SERVER + collection.href, true); //, user, password);
+ request.onreadystatechange = function() {
+ if (request.readyState !== 4) {
+ return;
+@@ -502,7 +502,7 @@
+ try {
+ read_form();
+ let password = password_form.value;
+- if (user) {
++ if (true) {
+ error = "";
+ // setup logout
+ logout_view.classList.remove("hidden");
+@@ -560,6 +560,8 @@
+ logout_user_form.textContent = "";
+ }
+
++ this.onlogin = onlogin;
++
+ this.show = function() {
+ remove_logout();
+ fill_form();
+@@ -1120,7 +1122,9 @@
+ function main() {
+ // Hide startup loading message
+ document.getElementById("loadingscene").classList.add("hidden");
+- push_scene(new LoginScene(), false);
++ let nLS = new LoginScene();
++ setTimeout(function(){nLS.onlogin();}, 200);
++ push_scene(nLS, false);
+ }
+
+ window.addEventListener("load", main);
bgstack15