Re: [Rpm-maint] [rpm-software-management/rpm] Discussion: How to handle Python extras (#1061)
Here's my idea: ```lua %python_extras_subpkg(n:i:f:) %{expand:%{lua: local value_n = rpm.expand('%{-n*}') local value_i = rpm.expand('%{-i*}') local value_f = rpm.expand('%{-f*}') local args = rpm.expand('%{*}') if value_n == '' then rpm.expand('%{error:%%%0: missing option -n (name of the base package)}') end if value_i == '' and value_f == '' then rpm.expand('%{error:%%%0: missing option -i (buildroot path to metadata) or -f (builddir path to a filelist)}') end if value_i ~= '' and value_f ~= '' then rpm.expand('%{error:%%%0: simultaneous -i (buildroot path to metadata) and -f (builddir path to a filelist) is not supported}') end if args == '' then rpm.expand('%{error:%%%0 requires at least one argument with "extras" name}') end local requires = 'Requires: ' .. value_n .. ' = %{?epoch:%{epoch}:}%{version}-%{release}' for extras in args:gmatch('%w+') do local rpmname = value_n .. '+' .. extras local pyname = value_n .. '[' .. extras .. ']' local pkgdef = '%package -n ' .. rpmname local summary = 'Summary: Metapackage requiring requires for ' .. pyname local description = '%description -n ' .. rpmname .. '\\\n' .. 'This is a metapackage bringing in requires for ' .. pyname .. '.\\\n' .. 'It contains no code, just makes sure the dependencies are installed.\\\n' local files if value_i ~= '' then files = '%files -n ' .. rpmname .. '\\\n' .. '%ghost ' .. value_i else files = '%files -n ' .. rpmname .. ' -f ' .. value_f end for i, line in ipairs({pkgdef, summary, requires, description, files, ''}) do print(line .. '\\\n') end end }} ``` You'd put this to your specfile near other subpackage declarations: ``` %python_extras_subpkg -n python3-setuptools_scm -i %{python3_sitelib}/*.egg-info toml ``` It expands to: ``` %package -n python3-setuptools_scm+toml Summary: Metapackage requiring requires for python3-setuptools_scm[toml] Requires: python3-setuptools_scm = %{?epoch:%{epoch}:}%{version}-%{release} %description -n python3-setuptools_scm+toml This is a metapackage bringing in requires for python3-setuptools_scm[toml]. It contains no code, just makes sure the dependencies are installed. %files -n python3-setuptools_scm+toml %ghost /usr/lib/python3.8/site-packages/*.egg-info ``` The rest would be handled by the Python dist dependency generator (taking package name as argument, parsing out the `+toml` part of it, and finding extras named `toml` in the package, eventually providing `python3dist(setuptools_scm[toml]) = 1.2.3` and requiring whatever that requires. If extras `toml` is not found, the dependency generator will error ([somehow](https://github.com/rpm-software-management/rpm/issues/1183)). Side note: The `-f` option allows to do: ``` %python_extras_subpkg -n python3-setuptools_scm -f %{python_extras_filelist} toml ``` When other automation is at play. Side note 2: The subpackage should really require `python3-setuptools_scm%{?_isa}` if arched, but I am unsure how to detect if `python3-setuptools_scm` is arched or noarch, so I will just hope for the best :crossed_fingers: -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/1061#issuecomment-631023401___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@pmatilai commented on this pull request. > You can use the standard operators to combine terms: logical operators &&, ||, !, relational operators !=, ==, <, > , <=, >=, arithmetic operators +, -, /, *, the ternary operator ? :, and parentheses. For example, "%[ 3 + 4 * (1 + %two) ]" will expand -to "15" if "%two" expands to "2". +to "15" if "%two" expands to "2". Version terms are compared using +rpm version comparison algorith, rather than regular string comparison. Well, to me rpm version comparison algorithm *is* EVR comparison, but okay clarified + typo fixed. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233#discussion_r427320978___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@pmatilai commented on this pull request. > @@ -241,15 +241,17 @@ newline is deleted). Note the 2nd % needed to escape > the arguments to Expression expansion can be performed using "%[expression]". An expression consists of terms that can be combined using -operators. Rpm supports two kinds of terms, numbers made up -from digits and strings enclosed in double quotes. Rpm will -expand macros when evaluating terms. +operators. Rpm supports three kinds of terms, numbers made up +from digits, strings enclosed in double quotes (eg "somestring") and +versions enclosed in double quotes preceded by (eg v"3:1.2-1"). Fixed, thanks. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233#discussion_r427320275___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@pmatilai pushed 1 commit. 27d30c2a7566becc31d9048781f9f56115a424dd Support rpm version comparison in expressions -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233/files/6e97d6cd8598c57c927c0bdf9a8755a6643ec68f..27d30c2a7566becc31d9048781f9f56115a424dd ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
> So, this basically compares evrs, correct? Yes. It also has provisions for validating EVR strings, but the only validation currently done is that an EVR string cannot be empty. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233#issuecomment-630820676___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@hroncok commented on this pull request. > @@ -241,15 +241,17 @@ newline is deleted). Note the 2nd % needed to escape > the arguments to Expression expansion can be performed using "%[expression]". An expression consists of terms that can be combined using -operators. Rpm supports two kinds of terms, numbers made up -from digits and strings enclosed in double quotes. Rpm will -expand macros when evaluating terms. +operators. Rpm supports three kinds of terms, numbers made up +from digits, strings enclosed in double quotes (eg "somestring") and +versions enclosed in double quotes preceded by (eg v"3:1.2-1"). ```suggestion versions enclosed in double quotes preceded by v (eg v"3:1.2-1"). ``` > You can use the standard operators to combine terms: logical operators &&, ||, !, relational operators !=, ==, <, > , <=, >=, arithmetic operators +, -, /, *, the ternary operator ? :, and parentheses. For example, "%[ 3 + 4 * (1 + %two) ]" will expand -to "15" if "%two" expands to "2". +to "15" if "%two" expands to "2". Version terms are compared using +rpm version comparison algorith, rather than regular string comparison. ```suggestion rpm epoch:version-release comparison algorithm, rather than regular string comparison. ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233#pullrequestreview-414441468___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
So, this basically compares evrs, correct? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233#issuecomment-630815654___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFC: support rpm version comparison in expression parser (#1220)
Thanks for the feeback folks, submitted a proper version as #1233 now. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1220#issuecomment-630813215___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
This is on top of #1221 as that is required for this to work, but in a separate PR to hopefully keep it more reviewable. We might want to add s"" as an alias to regular "" just for symmetry if/when this goes in, but leaving that out for now as it doesn't add anything new. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233#issuecomment-630812107___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
Adds rpm version as a new expression value type, denoted by v (similar to Python u, b etc), which are compared using rpm version comparison algorithm rather than regular string comparison. For example in specs: ``` %if v%{python_version} v3.9 ... %endif ``` ...but also command lines, arbitrary macros etc: `rpm --eval %[v1:1.2 v2.0]` Fixes: #1217 You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1233 -- Commit Summary -- * Move rpmVersionCompare() to headerutil.c for better layer match * Move rpmvercmp() to librpmio * Consolidate our Lua-bindings to librpmio now that we can * Axe --nopromote and most of the related infrastructure * Add (beginnings of) a rpm version API (parsing, comparison) * Refactor rpmdsCompare() to use the new version API * Refactor python labelCompare() to use the new version API, add more tests * Fix Lua rpm.vercmp() to compare actual EVRs instead of segments (#897) * Refactor expression parser comparisons to use common logic for all types * Handle expression value reset centrally * Support rpm version comparison in expressions -- File Changes -- M Makefile.am (1) M doc/librpm/Doxyheader.h (3) M doc/manual/macros (10) M lib/Makefile.am (8) M lib/depends.c (6) M lib/headerutil.c (21) M lib/poptALL.c (5) M lib/rpmds.c (137) M lib/rpmds.h (28) M lib/rpmds_internal.h (3) M lib/rpmlib.h (10) D lib/rpmliblua.c (41) D lib/rpmliblua.h (18) M lib/rpmrc.c (6) M lib/rpmtypes.h (1) M lib/transaction.c (2) M po/POTFILES.in (2) M preinstall.am (4) M python/header-py.c (34) M python/rpmmodule.c (11) M rpmio/Makefile.am (2) M rpmio/expression.c (165) M rpmio/rpmlua.c (26) A rpmio/rpmver.c (214) A rpmio/rpmver.h (99) R rpmio/rpmvercmp.c (20) M tests/rpmmacro.at (21) M tests/rpmpython.at (25) -- Patch Links -- https://github.com/rpm-software-management/rpm/pull/1233.patch https://github.com/rpm-software-management/rpm/pull/1233.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFC: support rpm version comparison in expression parser (#1220)
Closed #1220. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1220#event-3351694149___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Size check is too strict (#1232)
Well, normally rpm saves the new file to disk first and then moves it over the old file. So it actually does need this space. The latest version has some optimization for SSDs where files that are unchanged are only checksummed. This may be why you don't see an error message here. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/1232#issuecomment-630793756___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] Size check is too strict (#1232)
With VM in OpenStack or in AWS, it happens quite often that the rpm tells me: ``` installing package FOO needs 220MB on the / filesystem ``` It quite often happens to me with `linux-firmware` which is big and needs nearly 300 MB unpacked, which is on 3GB of cloud image a lot. This statement is nearly always false because it is counted with a worse case scenario, where all files in the new package are different. Which is rarely true. Usually, it is quite opposite - very few files changes. In such cases the calculation is incorrect. Here is a reproducer: 1) download packages from http://miroslav.suchy.cz/fedora/rpm-size-reproducer/ Both packages install two files in `/var/tmp/`. Both install `/var/tmp/big-file` which is 830 MB big (made out of zeros, so the compressed rpm is very small). Version one contains /var/tmp/one.txt and version two contains /var/tmp/two.txt. Both are small text files with different content. 2) ``` sudo rpm -Uvh /home/mirek/rpmbuild/RPMS/x86_64/big-file-1-1.x86_64.rpm Verifying... # [100%] Preparing... # [100%] Updating / installing... 1:big-file-1-1 # [100%] ``` 3) Now run something like: ``` dd if=/dev/zero of=/var/tmp/foo1 ``` tune this so you do not consume whole disk space, and leave few hundred of free space. In my case: ``` $ df -h /var/tmp/ Filesystem Size Used Avail Use% Mounted on /dev/mapper/fedora-root 50G 47G 197M 100% / ``` 4) Now try to upgrade: ``` $ sudo rpm -Uvh /home/mirek/rpmbuild/RPMS/x86_64/big-file-2-1.x86_64.rpm Verifying... # [100%] Preparing... # [100%] installing package big-file-2-1.x86_64 needs 674MB on the / filesystem ``` This is obviously incorrect as `/var/tmp/big-file` does not change. Definitely not the size. 5) Let's try to ignore size-check: ``` $ sudo rpm -Uvh /home/mirek/rpmbuild/RPMS/x86_64/big-file-2-1.x86_64.rpm --ignoresize Verifying... # [100%] Preparing... # [100%] Updating / installing... 1:big-file-2-1 # [ 50%] Cleaning up / removing... 2:big-file-1-1 # [100%] ``` Version: `rpm-4.15.1-3.fc32.1.x86_64` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/1232___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add %toolchain macro to differentiate C/C++ toolchains (#1231)
The issue is certainly valid and applies broadly to all sorts of things, including but not limited to compiler flags from %optflags. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/1231#issuecomment-630709345___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] Add %toolchain macro to differentiate C/C++ toolchains (#1231)
This is often needed when supporting builds with multiple compilers. Simply looking at `%__cc` is not enough since the actual executable might be called differently, but might still be gcc. Or clang. Doing a substring search is also problematic since "g++" is a substring of "clang++". So it would be nice if rpm provided a standard macro for this. Does this make sense for RPM and does `%toolchain` sound fine? If so, I can work on the actual implementation. It does seem like the value of `%toolchain` would have to be set for every compiler specially though. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/1231___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Check date/time for consistently using unsigned ints (#1228)
Also check the cpio payload format for issues. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/1228#issuecomment-630636191___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: elfdeps: Filter Python subdirectories (#1227)
Yeah negating the entire ELF class would require handling (some of) it in the python generator instead. It's a blunt tool, maybe suitable for something but we do need something more subtle to correctly and sanely handle this. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/1227#issuecomment-630619607___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint