Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-09 Thread Panu Matilainen
Merged #1485 into master. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485#event-7774057590 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-09 Thread Panu Matilainen
@pmatilai approved this pull request. Okay the spec parse stuff looks a whole lot nicer now - it actually looks like an improvement. I intended to do some more practical testing with this, but enough is enough :sweat_smile: -- Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-09 Thread Florian Festi
Rebased on top of #2270 and squashed latest fixes. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485#issuecomment-1308683146 You are receiving this because you are subscribed to this thread. Message ID:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-09 Thread Florian Festi
@ffesti pushed 3 commits. a1056d0b1487ee921db9de8d53bf693976e1f0b5 Split actual parsing of spec into its own function a2592627c300ddbe9af1632d0681391567213791 Allow starting new spec parts with PART_EMPTY 26de93c844ee13d456542e867cf35a60e574c90b Add Dynamic Spec generation -- View it on

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-09 Thread Michal Domonkos
OK, seems like all the comments are now addressed. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485#issuecomment-1308622418 You are receiving this because you are subscribed to this thread. Message ID:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-09 Thread Michal Domonkos
> Added alternative error handling. Turns out to be less of a change than I > expected. So it's probably just the way to go. Yup, looks good. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485#issuecomment-1308613037 You are receiving

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-09 Thread Florian Festi
@ffesti pushed 1 commit. 5b4d7065b2f720dd098db92234f496ae59a03882 Dynamic Specs: Add order of specparts reading -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485/files/a2ec843b8dbc11ece43f057092b0f768931c933c..5b4d7065b2f720dd098db92234f496ae59a03882 You are

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -1129,3 +1155,29 @@ rpmSpec rpmSpecParse(const char *specFile, > rpmSpecFlags flags, { return parseSpec(specFile, flags, buildRoot, 0); } + +rpmRC parseGeneratedSpecs(rpmSpec spec) +{ +ARGV_t argv = NULL; +int argc = 0; +int i;

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Panu Matilainen
@pmatilai commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Florian Festi
Added alternative error handling. Turns out to be less of a change than I expected. So it's probably just the way to go. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485#issuecomment-1307049064 You are receiving this because you are

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Florian Festi
@ffesti pushed 1 commit. a2ec843b8dbc11ece43f057092b0f768931c933c Move rpmSpecFree out of parseSpecSection -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485/files/a07501c24c391ed091f72c2933f259bb617c6185..a2ec843b8dbc11ece43f057092b0f768931c933c You are receiving

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Florian Festi
@ffesti commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Florian Festi
@ffesti commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Florian Festi
- Removed u2p macro - Added _prefix to test case - Removed unnneccessary rpmSpecFree call -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485#issuecomment-1306984561 You are receiving this because you are subscribed to this thread.

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Florian Festi
@ffesti commented on this pull request. > + +runroot rpmbuild -ba /data/SPECS/dynamic.spec +], +[0], +[ignore], +[ignore]) + +AT_CHECK([ + +runroot rpm -qp --qf "%{Summary}\n" /build/RPMS/noarch/dynamic-docs-1.0-1.noarch.rpm +runroot rpm -ql /build/RPMS/noarch/dynamic-docs-1.0-1.noarch.rpm +],

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Florian Festi
@ffesti commented on this pull request. > @@ -715,7 +715,8 @@ package or when debugging this package.\ RPM_ARCH=\"%{_arch}\"\ RPM_OS=\"%{_os}\"\ RPM_BUILD_NCPUS=\"%{_smp_build_ncpus}\"\ - export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_BUILD_NCPUS\ +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Florian Festi
@ffesti pushed 3 commits. 825d644e5654c1898849c54eb2b7327a9044f7da Split actual parsing of spec into its own function a3f967656ccdec466653a12301c7449f9f746975 Allow starting new spec parts with PART_EMPTY a07501c24c391ed091f72c2933f259bb617c6185 Add Dynamic Spec generation -- View it on

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-08 Thread Panu Matilainen
@pmatilai commented on this pull request. > + +runroot rpmbuild -ba /data/SPECS/dynamic.spec +], +[0], +[ignore], +[ignore]) + +AT_CHECK([ + +runroot rpm -qp --qf "%{Summary}\n" /build/RPMS/noarch/dynamic-docs-1.0-1.noarch.rpm +runroot rpm -ql /build/RPMS/noarch/dynamic-docs-1.0-1.noarch.rpm

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -715,7 +715,8 @@ package or when debugging this package.\ RPM_ARCH=\"%{_arch}\"\ RPM_OS=\"%{_os}\"\ RPM_BUILD_NCPUS=\"%{_smp_build_ncpus}\"\ - export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_BUILD_NCPUS\ +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Panu Matilainen
@pmatilai commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -273,6 +273,15 @@ static int doSetupMacro(rpmSpec spec, const char *line) free(buf); } +/* mkdir for dynamic specparts */ +buf = rpmExpand("%{__mkdir} SPECPARTS", NULL); +appendBuf(spec, buf, 1); +free(buf); + +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
OK, addressed all the comments above except the issue with the signature of `parseSpecSection()` where I not quite see what a better solution would be. Fixed for now: - Reworded documentation - Merged spec files for test cases - Failing test case checks rpmbuild output - removed spurious u2p

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
@ffesti commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
@ffesti commented on this pull request. > @@ -273,6 +273,15 @@ static int doSetupMacro(rpmSpec spec, const char *line) free(buf); } +/* mkdir for dynamic specparts */ +buf = rpmExpand("%{__mkdir} SPECPARTS", NULL); +appendBuf(spec, buf, 1); +free(buf); + +buf

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
@ffesti commented on this pull request. > +layout: default +title: rpm.org - Package Build Process +--- +# Dynamic Spec Generation + +Since rpm 4.19 RPM supports parsing dynamically generated specs. This +allows the build scripts (**%build** or **%install**) to create parts +of the spec file.

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
@ffesti commented on this pull request. > +%description +Simple rpm demonstration. + +%prep +%setup -q -T -c + +%build +echo "Q: Why?\nA: Because we can!" > FAQ + +%install +mkdir -p $RPM_BUILD_ROOT/usr/local/bin +echo " " > $RPM_BUILD_ROOT/usr/local/bin/hello + + +echo "%package docs" >>

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
@ffesti commented on this pull request. > @@ -273,6 +273,15 @@ static int doSetupMacro(rpmSpec spec, const char *line) free(buf); } +/* mkdir for dynamic specparts */ +buf = rpmExpand("%{__mkdir} SPECPARTS", NULL); +appendBuf(spec, buf, 1); +free(buf); + +buf

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
@ffesti commented on this pull request. > + +%prep +%setup -q -T -c + +%build +echo "Q: Why?\nA: Because we can!" > FAQ + +%install +mkdir -p $RPM_BUILD_ROOT/usr/local/bin +echo " " > $RPM_BUILD_ROOT/usr/local/bin/hello + + +echo "%package docs" >> %{specpartsdir}/docs.specpart +echo "Summary:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
@ffesti commented on this pull request. > @@ -2272,3 +2272,44 @@ runroot rpmbuild \ ], [ignore]) AT_CLEANUP + +# -- +# Check if dynamic spec generation works +AT_SETUP([rpmbuild with dynamic spec generation]) +AT_KEYWORDS([build]) +RPMDB_INIT +AT_CHECK([ +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Florian Festi
@ffesti pushed 1 commit. 387da564de03e2c12200d09abf746690b103af86 Add Dynamic Spec generation -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485/files/ab78270fca71149a42fdead2b8dd14a0f2d0898c..387da564de03e2c12200d09abf746690b103af86 You are receiving this because

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Panu Matilainen
@pmatilai commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Michal Domonkos
@dmnks commented on this pull request. > +%description +Simple rpm demonstration. + +%prep +%setup -q -T -c + +%build +echo "Q: Why?\nA: Because we can!" > FAQ + +%install +mkdir -p $RPM_BUILD_ROOT/usr/local/bin +echo " " > $RPM_BUILD_ROOT/usr/local/bin/hello + + +echo "%package docs" >>

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Panu Matilainen
@pmatilai commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -2272,3 +2272,44 @@ runroot rpmbuild \ ], [ignore]) AT_CLEANUP + +# -- +# Check if dynamic spec generation works +AT_SETUP([rpmbuild with dynamic spec generation]) +AT_KEYWORDS([build]) +RPMDB_INIT +AT_CHECK([ +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Panu Matilainen
@pmatilai commented on this pull request. > +%description +Simple rpm demonstration. + +%prep +%setup -q -T -c + +%build +echo "Q: Why?\nA: Because we can!" > FAQ + +%install +mkdir -p $RPM_BUILD_ROOT/usr/local/bin +echo " " > $RPM_BUILD_ROOT/usr/local/bin/hello + + +echo "%package docs" >>

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-07 Thread Panu Matilainen
@pmatilai commented on this pull request. > + +%prep +%setup -q -T -c + +%build +echo "Q: Why?\nA: Because we can!" > FAQ + +%install +mkdir -p $RPM_BUILD_ROOT/usr/local/bin +echo " " > $RPM_BUILD_ROOT/usr/local/bin/hello + + +echo "%package docs" >> %{specpartsdir}/docs.specpart +echo

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-06 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -273,6 +273,15 @@ static int doSetupMacro(rpmSpec spec, const char *line) free(buf); } +/* mkdir for dynamic specparts */ +buf = rpmExpand("%{__mkdir} SPECPARTS", NULL); +appendBuf(spec, buf, 1); +free(buf); + +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-06 Thread Florian Festi
@ffesti commented on this pull request. > @@ -1129,3 +1157,26 @@ rpmSpec rpmSpecParse(const char *specFile, > rpmSpecFlags flags, { return parseSpec(specFile, flags, buildRoot, 0); } + +rpmRC parseGeneratedSpecs(rpmSpec spec) +{ +ARGV_t argv = NULL; +int argc = 0; +int i; +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-06 Thread Panu Matilainen
> Yes, this is super ugly but nothing I am touching while adding this new > feature. Anyone feel free to clean that up afterwards. Do stuff for others to clean up is not an attitude us maintainers can afford you know. -- Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-04 Thread Michal Domonkos
@dmnks commented on this pull request. LGTM now, only little nitpicks, see comments. > +layout: default +title: rpm.org - Package Build Process +--- +# Dynamic Spec Generation + +Since rpm 4.19 RPM supports parsing dynamically generated specs. This +allows the build scripts (**%build** or

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-04 Thread Florian Festi
OK, fixed the error handling and added a failing test case. Added $RPM_SPECPARTS_DIR to the build scripts and removed the true directory name from the docs. Turns out there is a reason that `parseSpecSection()` returns a `Spec` object: The BUILDARCHITECTURES magic may return a different Spec

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-04 Thread Florian Festi
@ffesti pushed 3 commits. a63662e1558a086a850a2da382bd7c5759a1d7ca Split actual parsing of spec into its own function 05e784b9b576aefd88522c88ab06133048c7904d Allow starting new spec parts with PART_EMPTY ab78270fca71149a42fdead2b8dd14a0f2d0898c Add Dynamic Spec generation -- View it on

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-03 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -273,6 +273,15 @@ static int doSetupMacro(rpmSpec spec, const char *line) free(buf); } +/* mkdir for dynamic specparts */ +buf = rpmExpand("%{__mkdir} SPECPARTS", NULL); +appendBuf(spec, buf, 1); +free(buf); + +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-03 Thread Panu Matilainen
...or maybe we should get into the habit of including these design docs in a directory someplace in the source tree. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485#issuecomment-1301768925 You are receiving this because you are

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-03 Thread Panu Matilainen
> Final patch might still deserve a bit longer commit message. Otoh there is > docs on this and there is no need to duplicated that in the patch. Yep, there's no point duplicating the user docs in the commit message. What belongs in the commit message is a condensed version of the design spec:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-03 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -1129,3 +1157,26 @@ rpmSpec rpmSpecParse(const char *specFile, > rpmSpecFlags flags, { return parseSpec(specFile, flags, buildRoot, 0); } + +rpmRC parseGeneratedSpecs(rpmSpec spec) +{ +ARGV_t argv = NULL; +int argc = 0; +int i;

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-03 Thread Panu Matilainen
@pmatilai commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-11-03 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -273,6 +273,15 @@ static int doSetupMacro(rpmSpec spec, const char *line) free(buf); } +/* mkdir for dynamic specparts */ +buf = rpmExpand("%{__mkdir} SPECPARTS", NULL); +appendBuf(spec, buf, 1); +free(buf); + +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Michal Domonkos
@dmnks commented on this pull request. > @@ -273,6 +273,15 @@ static int doSetupMacro(rpmSpec spec, const char *line) free(buf); } +/* mkdir for dynamic specparts */ +buf = rpmExpand("%{__mkdir} SPECPARTS", NULL); +appendBuf(spec, buf, 1); +free(buf); + +buf =

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Michal Domonkos
Oh, and apologies for the noise here, I should've raised this a while ago in the design [document](https://github.com/rpm-software-management/rpm/discussions/2032) instead, and have it answered there. -- Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Michal Domonkos
There's another reason *not* to mess with the semantics of `%include`, which is, most people likely understand it as a C preprocessor-like counterpart to `#include`, rather than some kind of dynamic feature. Therefore separating those two (also by using different naming conventions) is arguably

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Michal Domonkos
> There are a few reasons why this is not wired into `%include`. The first > being that `%include` includes a file in place and then continues to read, > expand and parse the rest of the file. This is something that just cannot be > done afterwards. All kind of things could change by re-parsing

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Michal Domonkos
@dmnks commented on this pull request. > + if (checkForEncoding(pkg->header, 0) != RPMRC_OK) { + badenc = 1; + } + } + if (badenc) + goto errxit; +} + +closeSpec(spec); + +exit: +return spec; + +errxit: +if (!secondary) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Florian Festi
There are a few reasons why this is not wired into `%include`. The first being that `%include` includes a file in place and then continues to read, expand and parse the rest of the file. This is something that just cannot be done afterwards. All kind of things could change by re-parsing the

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Michal Domonkos
... Point being, this is just another `%include`-like mechanism, one that happens at a very specific point during the build, yet it's completely separate from `%include`. OTOH, as I'm writing this, I realize that maybe that's a good thing, since the semantics of `%include` really is "include

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Michal Domonkos
I'm a bit late to the party, but couldn't we "just" add an `%include` alternative (e.g. as a parameter) such that it would be parsed post-`%install`? I'm pretty sure I'm missing some obvious reason why it couldn't be done (easily), but I meant to ask anyway :smile:. Of course, the current

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Florian Festi
- Rebased - Added `specpartsdir` macro - Changed name of dir to `SPECPARTS` - Fixed white space issues - Use noarch package in test case - Merged patches Final patch might still deserve a bit longer commit message. Otoh there is docs on this and there is no need to duplicated that in the patch.

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Florian Festi
@ffesti pushed 1 commit. 06c764a2625fe2daea62598075bac2d10fc42317 Read in spec pieces generated during builds -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1485/files/7e43a675d518fbe41fab8c456cb73d26a95c8af3..06c764a2625fe2daea62598075bac2d10fc42317 You are

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-31 Thread Florian Festi
@ffesti pushed 3 commits. ae3a952f96aa84c7eed1cd10ee86d56017a8968b Split actual parsing of spec into its own function 28834422d628f5ad7381d18bdbb13e91dc3fc223 Allow starting new spec parts with PART_EMPTY 7e43a675d518fbe41fab8c456cb73d26a95c8af3 Read in spec pieces generated during builds

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-26 Thread Panu Matilainen
Hmm, so the SPECPARTS directory (whether its empty or not at the end of %install) could be used for determining whether the feature was used during a build, so it could be recorded as an rpmlib() dependnecy on src.rpm files similar to DynamicBuildRequires. If we want to - we obviously do not

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-26 Thread Panu Matilainen
> Well, the sub directory is mainly there so placing specparts on older > rpmbuild versions will fail and they won't just be silently ignored. Yup, I got that. > What about SPECPARTS as dir name. It's loud, but at least it's to the point. Add a %_specpartsdir macro, point it to that and we

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-26 Thread Florian Festi
> > The patch now uses a SPECS sub dir in the buildsubdir > > Names are hard, but this directory is nothing at all like SPECS in > %{_topdir}, I don't think it should share that name. SPEC, maybe. Except, I > think we may want to use such a directory for other purposes too, which is > why the

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-26 Thread Panu Matilainen
As for the directory name: add a macro for it, and document *that* instead of the hardcoded value. Otherwise, two weeks from the release of 4.19 we'll have a ticket requesting for one. Been there. Also that gives us at least a fleeting chance to rename it should such a thing be needed someday,

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-26 Thread Panu Matilainen
On the positive side, spec parse with and without this produce identical results on texlive.spec and kernel.spec (both fairly complicated beasts), except for the expected mkdir on the SPECS dir. -- Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-26 Thread Panu Matilainen
@pmatilai commented on this pull request. > +# Check if dynamic spec generation works +AT_SETUP([rpmbuild with dynamic spec generation]) +AT_KEYWORDS([build]) +RPMDB_INIT +AT_CHECK([ + +run rpmbuild --noclean\ + -ba "${abs_srcdir}"/data/SPECS/dynamic.spec +], +[0], +[ignore], +[ignore]) +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-26 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -2272,3 +2272,27 @@ runroot rpmbuild \ ], [ignore]) AT_CLEANUP + +# -- +# Check if dynamic spec generation works +AT_SETUP([rpmbuild with dynamic spec generation]) +AT_KEYWORDS([build]) +RPMDB_INIT +AT_CHECK([ + +run

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-26 Thread Panu Matilainen
> The patch now uses a SPECS sub dir in the buildsubdir Names are hard, but this directory is nothing at all like SPECS in %{_topdir}, I don't think it should use this name. SPEC, maybe. Except, I think we may want to use such a directory for other purposes too, which is why the spec snippets

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-24 Thread Florian Festi
OK, added test case and some docs. In addition I stripped the find-lang patch as this needs to g into it's own PR and was only there as a demonstration piece. The patch now uses a `SPECS` sub dir in the `buildsubdir` to allow detecting whether the feature is supported. I also removed the code to

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-24 Thread Florian Festi
@ffesti pushed 5 commits. 4320abf21b4d228b446fb679f0fa2e9f992e5985 Split actual parsing of the spec into its own function d8f830518e70e1bae31fab10c75720185446c5ba Allow starting new spec parts with PART_EMPTY 29708e32c8e2fb9f2b758d97fda24f23e1506ca6 Read in spec pieces generated during

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2022-10-18 Thread Panu Matilainen
@pmatilai requested changes on this pull request. Okay so to recoup the on-off discussions over many moons: there are further details to sort out. While we can work on the details later, the bare minimum requirements for merging are: - documentation - a test-case or two For clarity, flagging

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-03-03 Thread Sundeep Anand
thanks @ffesti this groups `.mo` files by `language_id`, for example, in `__rpmbuild_gettext-runtime.lang.specpart` :+1: ```%package lang-en@quot Summary: en@quot translations for %{name} %description lang-en@quot Translations for package %{name} in en@quot %files lang-en@quot %lang(en@quot)

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-02-23 Thread Panu Matilainen
> I guess I really need to write a proper design document... Please do. I'm clearly thinking on somewhat different lines from you. Which is not to say either one is wrong, just that there are so many possible scenarios that they're easy to miss entirely, and/or don't easily fit inside ones

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-02-23 Thread Florian Festi
I guess I really need to write a proper design document... When I think about distribution level sub package creation I think about something very close to an brp-script - most likely a literal brp-script. Not that I am a big fan of the way brp scripts are currently run. But I'd rather improve

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-02-23 Thread Panu Matilainen
I'd think there needs to be a global switch for at least case 2, but in addition individual scripts could/should be possible to disable case-by-case. Which might get tricky. Of course, just `rm -f` the bits you dislike/break at end of `%install` achieves that, but then you might want to prevent

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-02-23 Thread Florian Festi
When it comes to the distribution automagically generating sub packages I agree that the package need to be able to over write the behaviour. But I wonder if this really should be done on the "automatic sub packages off/on" level. Similar to what we have with debuginfo sub packages I'd rather

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-02-23 Thread Panu Matilainen
Wrt implicit/explicitness of it all, it occurred to me that there are two quite distinct cases: 1. spec invoking a script that does something - such as invoke %find_lang with extra flags 2. upstream build system (makefiles etc) doing something For 1. you want it to "just work" without further

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-02-04 Thread Panu Matilainen
And yeah, docs + a test-case or two needed. Once that is there we can do a fine-comb review, but generally this is so remarkably tiny amount of code that I wouldn't expect any major issues there. -- You are receiving this because you are subscribed to this thread. Reply to this email directly

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-02-04 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -1118,3 +1146,25 @@ rpmSpec rpmSpecParse(const char *specFile, > rpmSpecFlags flags, { return parseSpec(specFile, flags, buildRoot, 0); } + +rpmRC parseGeneratedSpecs(rpmSpec spec) +{ + +ARGV_t argv = NULL; +int argc = 0; +

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-21 Thread Jens Petersen
It would be nice to see some simple example(s) :-) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-19 Thread Florian Festi
@ffesti pushed 3 commits. b7b472b3e4ff284e260a581749c6fb30f24f38cc Parse spec snippets before running %check 3e4d486e415f603b2403eae7faa8a5325eedf39e Use __rpmbuild_*.specpart in BUILDDIR instead of __rpm sub dir ce3c6e97be69c6febcd3fd2f6424099eb8e7bdd2 Add support for

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-15 Thread Florian Festi
> Is there a reason we can't just push it back into `rpmbuild` itself directly? > Like perhaps by exposing something via Lua that lets you programmatically > define binary packages? Yes, we could. I have thinking about this quite a lot. But this is much more complicated and harder to use.

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-14 Thread Florian Festi
> Do I understand it correctly that you'd essentially do a `my_spec_generator > > %_builddir/__rpm/subpac.spec` which would e.g. contain a new subpackage > definition? Basically yes. As this is run in the %build or %install section you would need to modify your spec generator to not output

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-14 Thread ニール・ゴンパ
> * The generated spec fragments need to have some other suffix than *.spec to > avoid confusion. Call it .specpart or whatever, but they are not spec files > so they must not be mistaken as such, either by humans or the computer (eg > multiple .spec files in a tarball will confuse rpm) > * If

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-14 Thread Dan Čermák
This looks intriguing! Do I understand it correctly that you'd essentially do a `my_spec_generator > %_builddir/__rpm/subpac.spec` which would e.g. contain a new subpackage definition? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-14 Thread ニール・ゴンパ
cc: @dcermak -- 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/1485#issuecomment-760169523___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-14 Thread Panu Matilainen
More random thoughts as they trickle through this old-but-not-obsolete (yet) processor of mine... :brain: - This is too implicit as it is. Existing carefully hand-crafted packages can't start behaving differently because somebody else somewhere did something (unless that something creates new

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-13 Thread Panu Matilainen
A couple of random thoughts: - I think we'd want the generated specs parse occur before `%check` because you want to get possible packaging errors as soon as possible, and test-suites can take significant amount of time. And actually, I don't think we should allow `%check` to affect the actual

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-12 Thread Panu Matilainen
Didn't look with a microscope yet (some whitespace and spelling issues there at least) but on the whole this looks really neat set of patches. Which is usually a good sign :+1: Do add some test-case(s) though, no matter how artificial. -- You are receiving this because you are subscribed to

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-12 Thread Igor Raits
cc @davide125 -- 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/1485#issuecomment-758602337___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-12 Thread Florian Festi
@ffesti pushed 1 commit. 89402a09e08d19c93cbd800e7ba53814f0c90aac Remove stupid warning -- You are receiving this because you are subscribed to this thread. View it on GitHub:

[Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-12 Thread Florian Festi
This is an alternative to #1239 Instead of extending the spec syntax with dynamic elements allow the build process to generate their own spec file snippets that get read in after executing `%build` (technically after `%check`) from `$BUILDDIR/__rpm/*.spec`. This allows tricks like generating