From 2c2386791f88893148b3c249d339e9fae8bb5fc8 Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Wed, 20 Mar 2024 12:41:54 -0400 Subject: [PATCH] update to fedora guidelines and based on debian splits --- mapcache.spec | 84 ---------- mapcache.sysusers | 3 + mapcache_detail.1.xml | 152 ++++++++++++++++++ mapcache_seed.1.xml | 358 ++++++++++++++++++++++++++++++++++++++++++ mod_mapcache.spec | 150 ++++++++++++++++++ 5 files changed, 663 insertions(+), 84 deletions(-) delete mode 100644 mapcache.spec create mode 100644 mapcache.sysusers create mode 100644 mapcache_detail.1.xml create mode 100644 mapcache_seed.1.xml create mode 100644 mod_mapcache.spec diff --git a/mapcache.spec b/mapcache.spec deleted file mode 100644 index a0593f4..0000000 --- a/mapcache.spec +++ /dev/null @@ -1,84 +0,0 @@ -%global project_owner MapServer -%global project_name mapcache - -Name: mapcache -Version: 1.14.0 -Release: 0%{?dist} -Summary: Caching server for WMS layers -Group: Development/Tools -%global dashver %(echo %version | sed 's|\\.|-|g') - -License: MIT -URL: http://mapserver.org/trunk/en/mapcache/ - -Source: https://github.com/%{project_owner}/%{project_name}/releases/download/rel-%{dashver}/mapcache-%{version}.tar.gz - -Requires: httpd - - -BuildRequires: chrpath -BuildRequires: cmake -BuildRequires: fcgi-devel -BuildRequires: gcc -BuildRequires: gdal-devel -BuildRequires: geos-devel -BuildRequires: httpd-devel -BuildRequires: libcurl-devel -BuildRequires: libjpeg-turbo-devel -BuildRequires: libmemcached-devel -BuildRequires: libpng-devel -BuildRequires: libtiff-devel -BuildRequires: pixman-devel -BuildRequires: proj-devel -BuildRequires: sqlite-devel - -%global _description %{expand: -MapCache is a server that implements tile caching to speed up access to WMS layers. -The primary objectives are to be fast and easily deployable, while offering the -essential features (and more!) expected from a tile caching solution.} - -%description %{_description} - -%package devel -Summary: Development files for mapcache - -%description devel %{_description} -Development files for mapcache; these files are needed when building binary packages -against libmapcache. - -%prep -%autosetup - -%build -#%cmake -DWITH_MEMCACHE=1 -DCMAKE_SKIP_BUILD_RPATH=TRUE . -%cmake -DCMAKE_INSTALL_LIBDIR=%{_lib} -DWITH_MEMCACHE=1 -DCMAKE_SKIP_BUILD_RPATH=TRUE . -%cmake_build - -%install -%cmake_install - -for f in \ - %{buildroot}%{_bindir}/{mapcache_seed,mapcache.fcgi,mapcache_detail} \ - %{buildroot}%{_libdir}/libmapcache.so* \ - %{buildroot}%{_libdir}/httpd/modules/mod_mapcache.so; -do - chrpath --delete $f -done - -# NOTE(neil): 2024-03-06 - Upstream tests require running httpd and loading module -- out of scope for %check but can (read: should) be implemented in tmt/zuul. - -%files -%doc INSTALL.md README.md LICENSE.md -%{_bindir}/mapcache.fcgi -%{_bindir}/mapcache_detail -%{_bindir}/mapcache_seed -%{_libdir}/libmapcache.so.%{version} -%{_libdir}/libmapcache.so.1 -%{_libdir}/httpd/modules/mod_mapcache.so - -%files devel -%{_libdir}/libmapcache.so - -%changelog -* Thu Feb 29 2024 Neil Hanlon -- Initial package diff --git a/mapcache.sysusers b/mapcache.sysusers new file mode 100644 index 0000000..4c0f0a3 --- /dev/null +++ b/mapcache.sysusers @@ -0,0 +1,3 @@ +g mapcache - - + +u mapcache - "MapCache Service User" / - - - - diff --git a/mapcache_detail.1.xml b/mapcache_detail.1.xml new file mode 100644 index 0000000..aebdc7a --- /dev/null +++ b/mapcache_detail.1.xml @@ -0,0 +1,152 @@ + + + + + + mapcache_detail + 1 + + + + mapcache_detail + coverage analysis tool for SQLite caches + + + + + mapcache_detail + options + + + + + DESCRIPTION + + mapcache_detail is a coverage analysis tool for SQLite caches. + + + + + OPTIONS + + + + + file + + Configuration file (/path/to/mapcache.xml) + + + + + + DIMENSION_NAME=VALUE + + Set the value of a dimension: format DIMENSIONNAME=VALUE. Can be used multiple times for multiple dimensions + + + + + + name + + Tileset to analyze + + + + + + name + + Grid to analyze + + + + + + minx,miny,maxx,maxy + + Extent to analyze: format minx,miny,maxx,maxy. Cannot be used with + + + + + + data source + + OGR data source to get features from. Cannot be used with . + + + + + + layer + + OGR layer inside OGR data source. Cannot be used with . + + + + + + filter + + Filter to apply on OGR layer features. Cannot be used with . + + + + + + SQL query + + SQL query to filter inside OGR data source. Cannot be used with or . + + + + + + minzoom,maxzoom + + Set min and max zoom levels to analyze, separated by a comma, eg: 12,15 + + + + + + value + + Set query for counting tiles in a rectangle. Default value works with default schema of SQLite caches. + + + + + + + + Only existing SQLite files are reported, missing SQLite files are still taken into account for level and global coverage. + + + + + + + + + EXAMPLE + + + Analyze tile coverage of tileset osm with the g grid. Default extent is the whole world and default zoom level is 0: + + mapcache_detail --config mapcache.xml --tileset osm --grid g + + + + + Same as beforehand, with explicit zoom levels 9 to 12 and explicit extent covering Switzerland: + + mapcache_detail --config mapcache.xml --tileset osm --grid g --zoom 9,12 --extent 663000,5751230,1167680,6075050 + + + + + + diff --git a/mapcache_seed.1.xml b/mapcache_seed.1.xml new file mode 100644 index 0000000..43a0ef9 --- /dev/null +++ b/mapcache_seed.1.xml @@ -0,0 +1,358 @@ + + + + + + mapcache_seed + 1 + + + + mapcache_seed + generate tiles to seed mapcache + + + + + mapcache_seed + /path/to/mapcache.xml + options + + + + + DESCRIPTION + + mapcache_seed is an advanced seeding tool for mapcache, whose main features are: + + configurable number of seeding threads, to speed up the rendering + ability to reseed tiles older than a certain timestamp + ability to seed tiles given a shapefile/OGR datasource + + + + + + OPTIONS + + + + + file + + Path to the mapcache.xml configuration file that contains the tilesets that need to be seeded. + + + + + + override + + Override cache used by selected tileset (useful for selectively seeding fallback/multitier caches). + + + + + + name + + Name of the tileset that must be seeded. + + + + + + name + + Name of the grid that must be seeded (the selected tileset must reference the given grid). + + + + + + minzoom,maxzoom + + (Optional) Start and end zoom levels that must be seeded, separated by a comma, e.g. 0,6. + + + + + + width,height + + Override metatile size while seeding, e.g. 8,8. + + + + + + minx,miny,maxx,maxy + + (Optional) Bounding box of the area to seed. + + + + + + timestamp|now + + + (Optional) Only seed tiles that are older than the given value. + The value can either be the string "now", or a date formatted + like year/month/day hour:minute, e.g.: "2011/01/31 20:45". + (Note that a full timestamp should be quoted). + + + + + + + number + + + Number of parallel threads that should be used to request + tiles from the WMS source. The default is 1, but can be set higher + if the WMS server can withstand parallel requests (as a rule of thumb, + the value chosen here should never be much higher than the number + of cpus on the WMS server). (Incompatible with + /). + + + + + + + number + + + Number of parallel processes that should be used to request + tiles from the WMS source. (Incompatible with + /). + + + + + + + number + + Percent of failed requests allowed from the last 1000 before we abort (default: 1%, set to 0 to abort on first error). + + + + + + file + + Log failed tiles to file. + + + + + + file + + Rtry failed requests logged to file by . + + + + + + seed|delete|transfer + + Mode the utility will be running in: either seed (default), delete or transfer. + + + + + + tileset + + Name of tileset to transfer. + + + + + + DIMENSION=VALUE + + + Used to specify which dimension to use if the tileset supports + dimensions. Can be used multiple times to set multiple + dimensions, e.g. "DIM1=VAL1" + "DIM2=VAL2". + + + + + + + + + Show help. + + + + + + + + Don't print progress messages to the standard output. + + + + + + + + Force tile recreation even if it already exists. + + + + + + + + Print verbose debugging info (if compiled in). + + + + + + + Optional Commandline options when using OGR/GEOS + + + At compile time, if OGR and GEOS where found on the system, the seeder + tool supports additional options to seed only the tiles that cover an + arbitrary geographical area. + + + Important: Note that for the time being, the OGR + datasource should be in the same projection as the grid you are seeding, + as there is no automatic reprojection from the datasource projection to + the grid projection. + + + + + + datasource + + + OGR connection to the spatial source. Consult the OGR documentation + for all that is supported. In the simplest case (e.g. a Shapefile), + this is just the full filename of the shapefile. + + + + + + + layer + + + (Optional) For datasources that contain multiple layers (e.g. postgis, + with multiple tables), determines which layer will be used. + + + + + + + SQL + + OGR sql expression that can be applied (see http://www.gdal.org/ogr/ogr_sql.html). + + + + + + where + + + SQL "where" expression to filter out returned values. This would + typically be used to select only the geometry of a given country + if the datasource contains all the world contours. + + + + + + + + + + NOTES + + The seeding utility must be run under the same user account as the user + running the webserver. This is required so the permissions on the tiles + created by the seeder are accessible by the webserver, and conversely so + the seeder has the rights to write files to directories created by the + webserver. + + + A sample seeding session goes like this: + + + + [user@host]$ sudo www-data + [www-data@host]$ mapcache_seed -c /path/to/www/conf/mapcache.xml [options] + [www-data@host]$ logout + [user@host]$ + + + + + + EXAMPLE + + + Seed the "osm" tileset with the "g"(google/web-mercator) grid: + + mapcache_seed -c mapcache.xml -t osm -g g + + + + + Seed levels 0 through 12: + + mapcache_seed -c mapcache.xml -t osm -g g -z 0,12 + + + + + + Given a shapefile that contains the world country contours, seed only + the areas that are covered by land (i.e. skip the oceans). Also use 4 + request threads in parallel: + + + mapcache_seed -c mapcache.xml -t osm -g g -z 0,12 -n 4 -d /path/to/seed.shp + + + + + + Same as beforehand, but only seed the USA (notice the quote usage, + required to create valid sql with a single-quoted 'US': + + + mapcache_seed -c mapcache.xml -t osm -g g -z 0,12 -n 4 -d /path/to/seed.shp -w "FIPS_A2='US'" + + + + + + Reseed levels 0 to 12 (this could also be done by deleting the cache for + levels 0 to 12 and doing a classic seed, but doing so this way does not + slow down the access from web clients): + + + mapcache_seed -c mapcache.xml -t osm -g g -z 0,12 -o now + + + + + + diff --git a/mod_mapcache.spec b/mod_mapcache.spec new file mode 100644 index 0000000..c52bf52 --- /dev/null +++ b/mod_mapcache.spec @@ -0,0 +1,150 @@ +%global project_owner MapServer +%global project_name mapcache + +Name: mod_mapcache +Version: 1.14.0 +Release: 1%{?dist} +Summary: Caching server for WMS layers +Group: Development/Tools +%global dashver %(echo %version | sed 's|\\.|-|g') + +License: MIT +URL: http://mapserver.org/trunk/en/mapcache/ + +Source: https://github.com/%{project_owner}/%{project_name}/releases/download/rel-%{dashver}/mapcache-%{version}.tar.gz +Source: mapcache.sysusers + +Source: https://salsa.debian.org/debian-gis-team/mapcache/-/raw/master/debian/man/mapcache_detail.1.xml +Source: https://salsa.debian.org/debian-gis-team/mapcache/-/raw/master/debian/man/mapcache_seed.1.xml + +Requires: httpd +Requires: libmapcache%{?_isa} = %{version}-%{release} + +BuildRequires: chrpath +BuildRequires: cmake +BuildRequires: fcgi-devel +BuildRequires: gcc +BuildRequires: gdal-devel +BuildRequires: geos-devel +BuildRequires: httpd-devel +BuildRequires: libcurl-devel +BuildRequires: libjpeg-turbo-devel +BuildRequires: libmemcached-devel +BuildRequires: libpng-devel +BuildRequires: libtiff-devel +BuildRequires: pixman-devel +BuildRequires: proj-devel +BuildRequires: sqlite-devel +BuildRequires: systemd-rpm-macros + +%global _description %{expand: +MapCache is a server that implements tile caching to speed up access to WMS layers. +The primary objectives are to be fast and easily deployable, while offering the +essential features (and more!) expected from a tile caching solution.} + +%description %{_description} +This is the MapCache module for the Apache web server implementing OGC web +services. An alternative mapcache FastCGI program is available in +libmapcache-fcgi. + +%pre +%sysusers_create_compat %{SOURCE1} + +%package -n libmapcache +Summary: The shared library for mapcache + +%description -n libmapcache %{_description} +The shared library files for libmapcache + +%package -n libmapcache-devel +Summary: Development files for mapcache + +%description -n libmapcache-devel %{_description} +Development files for mapcache; these files are needed when building binary packages +against libmapcache. + +%package -n libmapcache-doc +Summary: Documentation files for mapcache +BuildArch: noarch + +%description -n libmapcache-doc %{_description} +Documentation files for mapcache. + +%package -n libmapcache-fcgi +Summary: fcgi implementation for mapcache +Requires: libmapcache%{?_isa} = %{version}-%{release} + +%description -n libmapcache-fcgi %{_description} +This package contains the mapcache FastCGI program, as alternative to the + Apache module available in mod_mapcache. + +%package -n libmapcache-tools +Summary: tools for mapcache + +%description -n libmapcache-tools %{_description} +Provides command-line utilities for mapcache + +%prep +%autosetup -n %{project_name}-%{version} + +%build +#%cmake -DWITH_MEMCACHE=1 -DCMAKE_SKIP_BUILD_RPATH=TRUE . +%cmake -DCMAKE_INSTALL_LIBDIR=%{_lib} -DWITH_MEMCACHE=1 -DCMAKE_SKIP_BUILD_RPATH=TRUE . +%cmake_build + +%install +%cmake_install + +for f in \ + %{buildroot}%{_bindir}/{mapcache_seed,mapcache.fcgi,mapcache_detail} \ + %{buildroot}%{_libdir}/libmapcache.so* \ + %{buildroot}%{_libdir}/httpd/modules/mod_mapcache.so; +do + chrpath --delete $f +done + +install -p -D -m 0644 mapcache.xml %{buildroot}%{_sysconfdir}/mapcache.xml +install -p -D -m 0644 mapcache.xml.sample %{buildroot}%{_datadir}/mapcache/mapcache.xml.sample + +install -p -D -d -m 0755 %{buildroot}%{_localstatedir}/cache/mapcache/ + +install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/mapcache.conf + +install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_mandir}/man1/mapcache_detail.1.xml +install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_mandir}/man1/mapcache_seed.1.xml + +%files +%doc INSTALL.md README.md LICENSE.md +%{_libdir}/httpd/modules/mod_mapcache.so +%config(noreplace) %{_sysconfdir}/mapcache.xml +%{_datadir}/mapcache/mapcache.xml.sample + +%files -n libmapcache +%{_libdir}/libmapcache.so.%{version} +%{_libdir}/libmapcache.so.1 +%{_localstatedir}/cache/mapcache +%{_sysusersdir}/mapcache.conf + +%files -n libmapcache-doc +%doc INSTALL.md README.md LICENSE.md +%{_mandir}/man1/mapcache_seed.1* +%{_mandir}/man1/mapcache_detail.1* + +%files -n libmapcache-devel +%{_libdir}/libmapcache.so + +%files -n libmapcache-fcgi +%{_bindir}/mapcache.fcgi + +%files -n libmapcache-tools +%{_bindir}/mapcache_detail +%{_bindir}/mapcache_seed + + +%changelog +* Mon Mar 11 2024 Neil Hanlon - 1.14.0-1 +- Include mapcache.xml +- split into subpackages following debian + +* Thu Feb 29 2024 Neil Hanlon - 1.14.0-0 +- Initial package based on work from ElNinijo