Compare commits

...

No commits in common. "c9-beta" and "c10s" have entirely different histories.

13 changed files with 203 additions and 262 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

15
.gitignore vendored
View File

@ -1,2 +1,13 @@
SOURCES/zram-generator-0.3.2.crate
SOURCES/zram-generator-v0.3.2-vendor.tar.gz
/zram-generator-0.1.1.crate
/zram-generator-0.1.2.crate
/zram-generator-0.2.0-beta.1.crate
/zram-generator-0.2.0-rc.1.crate
/zram-generator-0.2.0.crate
/zram-generator-0.3.0-rc.1.crate
/zram-generator-0.3.1.crate
/zram-generator-0.3.2.crate
/zram-generator-1.0.1.crate
/zram-generator-1.1.0.crate
/zram-generator-1.1.1.crate
/zram-generator-1.1.2.crate
/zram-generator-1.1.2-vendor.tar.xz

View File

@ -1,2 +0,0 @@
987e5137e6c9c6e64f5a2a452d273c43f1ce5a04 SOURCES/zram-generator-0.3.2.crate
9613428de5eadbcee227c8113d4116feaa205422 SOURCES/zram-generator-v0.3.2-vendor.tar.gz

View File

@ -1,55 +0,0 @@
.\" 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>

View File

@ -1,124 +0,0 @@
.\" 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>

View File

@ -1,81 +1,8 @@
%global crate zram-generator
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
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 <msekleta@redhat.com> - 0.3.2-7
- Rebuild (#1990555)
* Thu Aug 05 2021 <msekleta@redhat.com> - 0.3.2-6
- Rename binary rpm to zram-generator (#1990555)
* Thu Jun 24 2021 <msekleta@redhat.com> - 0.3.2-5
- Adjust packaging to account for differences between Fedora and CentOS/RHEL rust packaging (#1930369)
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu May 27 2021 Fabio Valentini <decathorpe@gmail.com> - 0.3.2-4
- Allow building against rust-ini 0.17 (#1968720)
* Tue Mar 23 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.3.2-3
- Fix missing path to generator dir

1
ci.fmf Normal file
View File

@ -0,0 +1 @@
resultsdb-testcase: separate

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tier1-internal.functional}

10
plans.fmf Normal file
View File

@ -0,0 +1,10 @@
/tier1-internal:
discover:
how: fmf
url: https://pkgs.devel.redhat.com/git/tests/rust-zram-generator
filter: 'tier: 1'
execute:
how: tmt
adjust:
enabled: false
when: distro == centos-stream or distro == fedora

159
rust-zram-generator.spec Normal file
View File

@ -0,0 +1,159 @@
# Generated by rust2rpm 24
%bcond_without check
# RHEL does not have packages for Rust dependencies
%if 0%{?rhel}
%global bundled_rust_deps 1
%else
%global bundled_rust_deps 0
%endif
%global crate zram-generator
Name: rust-zram-generator
Version: 1.1.2
Release: %autorelease
Summary: Systemd unit generator for zram swap devices
License: MIT
URL: https://crates.io/crates/zram-generator
Source0: %{crates_source}
Source1: zram-generator.conf
# To create the vendor tarball:
# tar xf %%{crate}-%%{version}.crate ; pushd %%{crate}-%%{version} ; \
# cargo vendor && tar Jcvf ../%%{crate}-%%{version}-vendor.tar.xz vendor/ ; popd
Source2: %{crate}-%{version}-vendor.tar.xz
%if 0%{?bundled_rust_deps}
BuildRequires: rust-toolset
BuildRequires: make
BuildRequires: /usr/bin/ronn
BuildRequires: pkgconfig(systemd)
BuildRequires: systemd-rpm-macros
%else
BuildRequires: rust-packaging >= 21
%endif
%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 available RAM
is used to store compressed pages, essentially trading CPU cycles for memory.)
To activate, install %{crate}-defaults subpackage.}
%description %{_description}
%package -n %{crate}
Summary: %{summary}
# Apache-2.0 OR MIT
# MIT
# MIT OR Apache-2.0
License: MIT AND (Apache-2.0 OR MIT)
Recommends: %{_sbindir}/zramctl
%description -n %{crate} %{_description}
%files -n %{crate}
%license LICENSE
%license LICENSE.dependencies
%if 0%{?bundled_rust_deps}
%license cargo-vendor.txt
%endif
%doc zram-generator.conf.example
%doc README.md
%{_systemdgeneratordir}/zram-generator
%{_unitdir}/systemd-zram-setup@.service
%{_mandir}/man8/zram-generator.8*
%{_mandir}/man5/zram-generator.conf.5*
%package -n %{crate}-defaults
Summary: Default configuration for %{crate}
Requires: %{crate} = %{version}-%{release}
Obsoletes: zram < 0.4-2
BuildArch: noarch
%description -n %{crate}-defaults
%{summary}.
%files -n %{crate}-defaults
%{_prefix}/lib/systemd/zram-generator.conf
%if ! 0%{?bundled_rust_deps}
%package devel
Summary: %{summary}
BuildArch: noarch
%description devel %{_description}
This package contains library source intended for building other packages which
use the "%{crate}" crate.
%files devel
%license %{crate_instdir}/LICENSE
%doc %{crate_instdir}/README.md
%{crate_instdir}/
%package -n %{name}+default-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+default-devel %{_description}
This package contains library source intended for building other packages which
use the "default" feature of the "%{crate}" crate.
%files -n %{name}+default-devel
%ghost %{crate_instdir}/Cargo.toml
%endif
%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1 %{?bundled_rust_deps:-a2}
cp -a %{S:1} .
%if 0%{?bundled_rust_deps}
%cargo_prep -v vendor
%else
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
echo '/usr/bin/make'
echo '/usr/bin/ronn'
echo 'pkgconfig(systemd)'
echo 'systemd-rpm-macros'
%endif
%build
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
export LC_ALL=C.UTF-8
%cargo_build
%cargo_license_summary
%{cargo_license} > LICENSE.dependencies
%if 0%{?bundled_rust_deps}
%cargo_vendor_manifest
%endif
%make_build SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir} \
systemd-service man
%install
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
%cargo_install
rm %{buildroot}%{_bindir}/zram-generator
%make_install SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir} \
NOBUILD=1
install -Dpm0644 -t %{buildroot}%{_prefix}/lib/systemd %{SOURCE1}
%if %{with check}
%check
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
%cargo_test
: ==============================================================================
%{buildroot}%{_systemdgeneratordir}/zram-generator --help
: ==============================================================================
%{buildroot}%{_systemdgeneratordir}/zram-generator --help | grep -q %{_systemd_util_dir}/systemd-makefs
%endif
%changelog
%autochangelog

6
rust2rpm.conf Normal file
View File

@ -0,0 +1,6 @@
[DEFAULT]
buildrequires =
systemd-rpm-macros
/usr/bin/ronn
/usr/bin/make
pkgconfig(systemd)

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (zram-generator-1.1.2.crate) = dfad7d4384eb4635c33475e4571d33a3135c92cf42138dd1cb50f19aef4b3f2465130783e385a3f544e43a1653273cee9b2d8f45177a8b053acf37805dc939c8
SHA512 (zram-generator-1.1.2-vendor.tar.xz) = 0d628fd3543ea2351d628a0fb61603cb838050050b1766a4c8c45e5de3a6513d724ca4d97081e112cf8accb9c23045a2b0a3de556374020bedb87ead310e9cf2

View File

@ -5,5 +5,4 @@
# To disable, uninstall zram-generator-defaults or create empty
# /etc/systemd/zram-generator.conf file.
[zram0]
zram-fraction = 1.0
max-zram-size = 8192
zram-size = min(ram, 8192)