From 601116b3c7a1000b656414a6745d4e52dbdc55bc Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Wed, 3 Nov 2021 11:42:49 -0400 Subject: [PATCH] import rust-zram-generator-0.3.2-7.el9 --- .gitignore | 2 + .rust-zram-generator.metadata | 2 + SOURCES/zram-generator.8 | 55 ++++++++++++ SOURCES/zram-generator.conf | 9 ++ SOURCES/zram-generator.conf.5 | 124 +++++++++++++++++++++++++++ SPECS/rust-zram-generator.spec | 150 +++++++++++++++++++++++++++++++++ 6 files changed, 342 insertions(+) create mode 100644 .gitignore create mode 100644 .rust-zram-generator.metadata create mode 100644 SOURCES/zram-generator.8 create mode 100644 SOURCES/zram-generator.conf create mode 100644 SOURCES/zram-generator.conf.5 create mode 100644 SPECS/rust-zram-generator.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05f72cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/zram-generator-0.3.2.crate +SOURCES/zram-generator-v0.3.2-vendor.tar.gz diff --git a/.rust-zram-generator.metadata b/.rust-zram-generator.metadata new file mode 100644 index 0000000..e929462 --- /dev/null +++ b/.rust-zram-generator.metadata @@ -0,0 +1,2 @@ +987e5137e6c9c6e64f5a2a452d273c43f1ce5a04 SOURCES/zram-generator-0.3.2.crate +9613428de5eadbcee227c8113d4116feaa205422 SOURCES/zram-generator-v0.3.2-vendor.tar.gz diff --git a/SOURCES/zram-generator.8 b/SOURCES/zram-generator.8 new file mode 100644 index 0000000..62c67e3 --- /dev/null +++ b/SOURCES/zram-generator.8 @@ -0,0 +1,55 @@ +.\" generated with Ronn-NG/v0.9.1 +.\" http://github.com/apjanke/ronn-ng/tree/0.9.1 +.TH "ZRAM\-GENERATOR" "8" "February 2021" "zram-generator developers" +.SH "NAME" +\fBzram\-generator\fR \- Systemd unit generator for zram swap devices +.SH "SYNOPSIS" +\fB/usr/lib/systemd/system\-generators/zram\-generator\fR \fBTARGET_DIR\fR [\fI2RGET_DIR\fR \fI3RGET_DIR\fR] +.br +\fB/usr/lib/systemd/system\-generators/zram\-generator\fR \-\-setup\-device \fBDEVICE\fR +.br +\fB/usr/lib/systemd/system\-generators/zram\-generator\fR \-\-reset\-device \fBDEVICE\fR +.SH "DESCRIPTION" +\fBzram\-generator\fR is a generator that creates systemd units to format and use compressed RAM devices, either as swap or a mount point\. +.P +The generator will be invoked by systemd early at boot\. The generator will then: +.IP "1." 4 +read configuration files from \fI{/etc,/lib}/systemd/zram\-generator\.conf[\.d]\fR (see zram\-generator\.conf(5) for details); +.IP "2." 4 +generate systemd\.swap(5) and/or systemd\.mount(5) units into \fBTARGET_DIR\fR and connect them to \fBswap\.target\fR or \fBlocal\-fs\.target\fR as appropriate; +.IP "3." 4 +ensure the \fBzram\fR module is loaded and create the requested devices\. +.IP "" 0 +.P +The generator does nothing if run inside a container (as determined by \fIsystemd\-detect\-virt(8) \-\-container\fR)\. +.P +The generator also understands the kernel command\-line option \fBsystemd\.zram\fR\. See zram\-generator\.conf(5) for details\. +.P +Setting the \fBZRAM_GENERATOR_ROOT\fR environment variable makes the generator run in test mode, in which case containerisation is ignored and step \fB3\fR is skipped\. +.br +For the ramifications of \fBZRAM_GENERATOR_ROOT\fR on config handling, see zram\-generator\.conf(5)\. +.P +Generated \fIdev\-zramN\.swap\fR units depend on \fBsystemd\-swap\-create@zramN\.service\fR, which will: +.IP "1." 4 +read configuration files from \fI{/etc,/lib}/systemd/zram\-generator\.conf[\.d]\fR (see zram\-generator\.conf(5) for details); +.IP "2." 4 +set the desired compression algorithm, if any; if the current kernel doesn\'t understand the specified algorithm, a warning is issued, but execution continues; +.IP "3." 4 +set the desired blockdev size and format it as swap with \fIsystemd\-makefs(8)\fR\. +.IP "" 0 +.P +Generated \fIpath\-to\-mount\-point\.mount\fR units depend on \fBsystemd\-swap\-create@zramN\.service\fR\. The effect is similar to what happens for swap units, but of course they are formatted with a file system\. +.P +When the unit is stopped, the zram device is reset, freeing memory and allowing the device to be reused\. +.P +\fBzram\-generator\fR implements systemd\.generator(7)\. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/systemd/zram\-generator/issues\fR> +.SH "SEE ALSO" +zram\-generator\.conf(5), systemd\.generator(7), systemd\.swap(5) +.P +<\fIhttps://github\.com/systemd/zram\-generator\fR> +.P +Linux documentation of zram: <\fIhttps://kernel\.org/doc/html/latest/admin\-guide/blockdev/zram\.html\fR> +.br +and the zram sysfs ABI: <\fIhttps://kernel\.org/doc/Documentation/ABI/testing/sysfs\-block\-zram\fR> diff --git a/SOURCES/zram-generator.conf b/SOURCES/zram-generator.conf new file mode 100644 index 0000000..a5432f9 --- /dev/null +++ b/SOURCES/zram-generator.conf @@ -0,0 +1,9 @@ +# This config file enables a /dev/zram0 device with the default settings: +# — size — same as available RAM or 8GB, whichever is less +# — compression — most likely lzo-rle +# +# To disable, uninstall zram-generator-defaults or create empty +# /etc/systemd/zram-generator.conf file. +[zram0] +zram-fraction = 1.0 +max-zram-size = 8192 diff --git a/SOURCES/zram-generator.conf.5 b/SOURCES/zram-generator.conf.5 new file mode 100644 index 0000000..e888863 --- /dev/null +++ b/SOURCES/zram-generator.conf.5 @@ -0,0 +1,124 @@ +.\" generated with Ronn-NG/v0.9.1 +.\" http://github.com/apjanke/ronn-ng/tree/0.9.1 +.TH "ZRAM\-GENERATOR\.CONF" "5" "February 2021" "zram-generator developers" +.SH "NAME" +\fBzram\-generator\.conf\fR \- Systemd unit generator for zram swap devices (configuration) +.SH "SYNOPSIS" +\fB/usr/lib/systemd/zram\-generator\.conf\fR +.br +\fB/usr/local/lib/systemd/zram\-generator\.conf\fR +.br +\fB/etc/systemd/zram\-generator\.conf\fR +.br +\fB/run/systemd/zram\-generator\.conf\fR +.P +\fB/usr/lib/systemd/zram\-generator\.conf\.d/*\.conf\fR +.br +\fB/usr/local/lib/systemd/zram\-generator\.conf\.d/*\.conf\fR +.br +\fB/etc/systemd/zram\-generator\.conf\.d/*\.conf\fR +.br +\fB/run/systemd/zram\-generator\.conf\.d/*\.conf\fR +.SH "DESCRIPTION" +These files configure devices created by zram\-generator(8)\. See systemd\.syntax(5) for a general description of the syntax\. +.SH "CONFIGURATION DIRECTORIES AND PRECEDENCE" +The default configuration doesn\'t specify any devices\. Consult \fI/usr/share/zram\-generator/zram\-generator\.conf\.example\fR for an example configuration file\. +.P +When packages need to customize the configuration, they can install configuration snippets in \fI/usr/lib/systemd/zram\-generator\.conf\.d/\fR\. Files in \fI/etc/\fR are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages\. The main configuration file is read before any of the configuration directories, and has the lowest precedence; entries in a file in any configuration directory override entries in the single configuration file\. Files in the \fI*\.conf\.d/\fR configuration subdirectories are sorted by their filename in lexicographic order, regardless of which of the subdirectories they reside in\. When multiple files specify the same option, for options which accept just a single value, the entry in the file with the lexicographically latest name takes precedence\. It is recommended to prefix all filenames in those subdirectories with a two\-digit number and a dash, to simplify the ordering of the files\. +.P +To disable a configuration file supplied by the vendor, the recommended way is to place a symlink to \fI/dev/null\fR in the configuration directory in \fI/etc/\fR, with the same filename as the vendor configuration file\. +.P +The generator understands the following option on the kernel command\-line: \fBsystemd\.zram[=0|1]\fR\. When specified with a true argument (or no argument), the \fBzram0\fR device will be created\. Default options apply, but may be overridden by configuration on disk if present\. When specified with a false argument, no zram devices will be created by the generator\. This option thus has higher priority than the configuration files\. +.SH "OPTIONS" +Each device is configured independently in its \fB[zramN]\fR section, where N is a nonnegative integer\. Other sections are ignored\. +.P +Devices with the final size of \fI0\fR will be discarded\. +.IP "\[ci]" 4 +\fBhost\-memory\-limit\fR= +.IP +Sets the upper limit on the total usable RAM (as defined by \fIMemTotal\fR in \fB/proc/meminfo\fR, confer proc(5)) above which the device will \fInot\fR be created\. +.IP +This takes a nonnegative number, representing that limit in megabytes, or the literal string \fInone\fR, which can be used to override a limit set earlier\. +.IP +Defaults to \fInone\fR\. +.IP +For compatibility with earlier versions, \fBmemory\-limit\fR is allowed as an alias for this option\. Its use is discouraged, and administrators should migrate to \fBhost\-memory\-limit\fR\. +.IP "\[ci]" 4 +\fBzram\-fraction\fR= +.IP +Defines the scaling factor of the zram device\'s size with relation to the total usable RAM\. +.IP +This takes a nonnegative floating\-point number representing that factor\. +.IP +Defaults to \fI0\.5\fR\. +.IP "\[ci]" 4 +\fBmax\-zram\-size\fR= +.IP +Sets the limit on the zram device\'s size obtained by \fBzram\-fraction\fR\. +.IP +This takes a nonnegative number, representing that limit in megabytes, or the literal string \fInone\fR, which can be used to override a limit set earlier\. +.IP +Defaults to \fI4096\fR\. +.IP "\[ci]" 4 +\fBcompression\-algorithm\fR= +.IP +Specifies the algorithm used to compress the zram device\. +.IP +This takes a literal string, representing the algorithm to use\. +.br +Consult \fI/sys/block/zram0/comp_algorithm\fR for a list of currently loaded compression algorithms, but note that additional ones may be loaded on demand\. +.IP +If unset, none will be configured and the kernel\'s default will be used\. +.IP "\[ci]" 4 +\fBswap\-priority\fR= +.IP +Controls the relative swap priority, a value between \-1 and 32767\. Higher numbers indicate higher priority\. +.IP +If unset, 100 is used\. +.IP "\[ci]" 4 +\fBmount\-point\fR= +.IP +Format the device with a file system (not as swap) and mount this file system over the specified directory\. When neither this option nor \fBfs\-type\fR= is specified, the device will be formatted as swap\. +.IP +Note that the device is temporary: contents will be destroyed automatically after the file system is unmounted (to release the backing memory)\. +.IP "\[ci]" 4 +\fBfs\-type\fR= +.IP +Specifies how the device shall be formatted\. The default is \fIext2\fR if \fBmount\-point\fR is specified, and \fIswap\fR otherwise\. (Effectively, the device will be formatted as swap, if neither \fBfs\-type\fR= nor \fBmount\-point\fR= are specified\.) +.IP +Note that the device is temporary: contents will be destroyed automatically after the file system is unmounted (to release the backing memory)\. +.IP +Also see systemd\-makefs(8)\. +.IP "" 0 +.SH "ENVIRONMENT VARIABLES" +Setting \fBZRAM_GENERATOR_ROOT\fR during parsing will cause \fI/proc/meminfo\fR to be read from \fI$ZRAM_GENERATOR_ROOT/proc/meminfo\fR instead, and \fI{/usr/lib,/usr/local/lib,/etc,/run}/systemd/zram\-generator\.conf\fR to be read from \fI$ZRAM_GENERATOR_ROOT/{/usr/lib,/usr/local/lib,/etc,/run}/systemd/zram\-generator\.conf\fR\. +.SH "EXAMPLES" +The default configuration will yield the following: +.IP "" 4 +.nf + zram device size [MB] + ^ + │ + 4G>│ ooooooooooooo + │ o + │ o + │ o + 2G>│ o + │ o + │ o +512M>│ o + 0───────────────────────> total usable RAM [MB] + ^ ^ ^ + 1G 4G 8G +.fi +.IP "" 0 +.SH "REPORTING BUGS" +<\fIhttps://github\.com/systemd/zram\-generator/issues\fR> +.SH "SEE ALSO" +zram\-generator(8), systemd\.syntax(5), proc(5) +.P +<\fIhttps://github\.com/systemd/zram\-generator\fR> +.P +Linux documentation of zram: <\fIhttps://kernel\.org/doc/html/latest/admin\-guide/blockdev/zram\.html\fR> +.br +and the zram sysfs ABI: <\fIhttps://kernel\.org/doc/Documentation/ABI/testing/sysfs\-block\-zram\fR> diff --git a/SPECS/rust-zram-generator.spec b/SPECS/rust-zram-generator.spec new file mode 100644 index 0000000..15de06c --- /dev/null +++ b/SPECS/rust-zram-generator.spec @@ -0,0 +1,150 @@ +%global crate zram-generator + +Name: rust-%{crate} +Version: 0.3.2 +Release: 7%{?dist} +Summary: Systemd unit generator for zram swap devices + +License: MIT +URL: https://crates.io/crates/%{crate} +Source: %{crates_source} +Source1: %{crate}-v%{version}-vendor.tar.gz +Source2: zram-generator.conf +Source3: zram-generator.8 +Source4: zram-generator.conf.5 + +ExclusiveArch: %{rust_arches} + +BuildRequires: git +BuildRequires: rust-toolset +BuildRequires: systemd-devel systemd-rpm-macros +BuildRequires: /usr/bin/make + +%global _description %{expand: +This is a systemd unit generator that enables swap on zram. +(With zram, there is no physical swap device. Part of the avaialable RAM +is used to store compressed pages, essentially trading CPU cycles for memory.)} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +License: MIT +%description -n %{crate} %{_description} + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +cp -a %{S:2} . +%cargo_prep -V 1 + +%build +export SYSTEMD_UTIL_DIR=%{_systemd_util_dir} +%cargo_build +make systemd_service SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir} +cp -a %{S:3} %{S:4} man/ + +%install +export SYSTEMD_UTIL_DIR=%{_systemd_util_dir} +%cargo_install + +mkdir -p %{buildroot}%{_systemdgeneratordir} +mv -v %{buildroot}%{_bindir}/zram-generator %{buildroot}%{_systemdgeneratordir}/ +install -Dpm0644 -t %{buildroot}%{_unitdir} units/systemd-zram-setup@.service +install -Dpm0644 -t %{buildroot}%{_prefix}/lib/systemd %{SOURCE2} +install -Dpm0644 -t %{buildroot}%{_mandir}/man8 man/zram-generator.8 +install -Dpm0644 -t %{buildroot}%{_mandir}/man5 man/zram-generator.conf.5 + +%files -n %{crate} +%license LICENSE +%doc zram-generator.conf.example +%doc README.md +%{_systemdgeneratordir}/zram-generator +%{_unitdir}/systemd-zram-setup@.service +%{_prefix}/lib/systemd/zram-generator.conf +%{_mandir}/man8/zram-generator.8* +%{_mandir}/man5/zram-generator.conf.5* + +%changelog +* Thu Aug 12 2021 - 0.3.2-7 +- Rebuild (#1990555) + +* Thu Aug 05 2021 - 0.3.2-6 +- Rename binary rpm to zram-generator (#1990555) + +* Thu Jun 24 2021 - 0.3.2-5 +- Adjust packaging to account for differences between Fedora and CentOS/RHEL rust packaging (#1930369) + +* Fri Apr 16 2021 Mohan Boddu +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Mar 23 2021 Zbigniew Jędrzejewski-Szmek - 0.3.2-3 +- Fix missing path to generator dir + +* Fri Mar 19 2021 Vasiliy Glazov - 0.3.2-2 +- Fix max-zram-size value to 8GB + +* Wed Feb 24 2021 Zbigniew Jędrzejewski-Szmek - 0.3.2-1 +- Downgrade logging levels (#1930869) + +* Wed Jan 27 2021 Zbigniew Jędrzejewski-Szmek - 0.3.1-2 +- Implement https://fedoraproject.org/wiki/Changes/Scale_ZRAM_to_full_memory_size (#1921084) + +* Sat Jan 23 13:23:10 CET 2021 Igor Raits - 0.3.1-1 +- Update to 0.3.1 + +* Wed Jan 13 16:57:21 CET 2021 Igor Raits - 0.3.0~rc.1-1 +- Update to 0.3.0-rc.1 + +* Mon Dec 28 13:34:14 CET 2020 Igor Raits - 0.2.0-6 +- Rebuild + +* Mon Nov 23 2020 Fabio Valentini - 0.2.0-5 +- Allow building against rust-ini 0.16. + +* Sun Aug 16 15:02:03 GMT 2020 Igor Raits - 0.2.0-4 +- Rebuild + +* Sat Aug 1 2020 Zbigniew Jędrzejewski-Szmek - 0.2.0-3 +- Obsolete zram package from zram-generator-defaults + +* Wed Jul 29 2020 Fedora Release Engineering - 0.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sat Jul 04 17:30:46 CEST 2020 Igor Raits - 0.2.0-1 +- Update to 0.2.0 + +* Tue Jun 23 19:56:14 CEST 2020 Igor Raits - 0.2.0~rc.1-1 +- Update to 0.2.0-rc.1 + +* Thu Jun 18 11:30:43 CEST 2020 Igor Raits - 0.2.0~beta.1-3 +- Create a subpackage with default configuration + +* Thu Jun 18 10:14:43 CEST 2020 Igor Raits - 0.2.0~beta.1-2 +- Install swap-create unit file + +* Thu Jun 18 09:27:37 CEST 2020 Igor Raits - 0.2.0~beta.1-1 +- Update to 0.2.0-beta.1 + +* Thu Jan 30 2020 Fedora Release Engineering - 0.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Mon Oct 7 2019 Zbigniew Jędrzejewski-Szmek - 0.1.2-1 +- Update to latest version + +* Fri Jul 26 2019 Fedora Release Engineering - 0.1.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Jul 22 21:30:22 CEST 2019 Igor Gnatenko - 0.1.1-4 +- Regenerate + +* Sat Mar 09 2019 Igor Gnatenko - 0.1.1-3 +- Adapt to new packaging + +* Fri Mar 1 2019 Zbigniew Jędrzejewski-Szmek - 0.1.1-2 +- Add crude patch to fix build (#1676154) + +* Sat Feb 02 2019 Fedora Release Engineering - 0.1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Aug 16 2018 Zbigniew Jędrzejewski-Szmek - 0.1.1-1 +- Initial package