Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[RFE] Execute dependency generators on the .spec file which ships them #782

Closed
voxik opened this issue Jul 3, 2019 · 10 comments · Fixed by #2911
Closed

[RFE] Execute dependency generators on the .spec file which ships them #782

voxik opened this issue Jul 3, 2019 · 10 comments · Fixed by #2911
Labels
generator Dependency generation related RFE

Comments

@voxik
Copy link
Contributor

voxik commented Jul 3, 2019

It would be very handy, if the dependency generators shipped by package could be used during build already.

E.g. when we build ruby package, it builds rubygems-devel package, which ships generators for rubygem- packages. But it also provides dozen of rubygem- subpackages and it would be very handy to utilize that generator already.

@ignatenkobrain
Copy link
Contributor

I think if you override %__ruby_provides to %{buildroot}…, that should do the trick...

@ignatenkobrain
Copy link
Contributor

But I agree, it is ugly.

@voxik
Copy link
Contributor Author

voxik commented Jul 3, 2019

I don't think I have anything to override, because I would need to have the *.attr file installed. I can define the %__ruby_provides but is it really that easy? I'd be surprised. Why we would need to have the *.attr file then?

@jasontibbitts
Copy link

I don't believe it's that easy if you don't already have a .attr file. It doesn't look to me as if RPM will look at %__foo_magic or %_foo_provides unless it sees %_fileattrsdir/foo.attr first. Of course, you could override %_fileattrsdir instead, but then you would have to copy the contents of the system directory because RPM looks only in one place. Even if you told RPM to look in the buildroot, the locations of the scripts would be wrong.

Looking at the code, I think that with ugly hacks it might be possible to get around all of that, but I can't imagine the rather small benefit would justify the ugliness given the tiny number of packages which install file attributes.

@pmatilai
Copy link
Member

Yup, this is one of the main shortcomings of the "new" attr-based dependency generator and was just recently discussed again in the context of dynamic buildrequires. Besides self-dependencies (eg modules included in a language standard library and such), it'd be useful for source-based dependencies (automated depgen without shipping an otherwise irrelevant file in the package).
I thought there was a ticket for this already but maybe I'm mixing it up with the recent discussion elsewhere...

@pmatilai pmatilai added the RFE label Jul 30, 2019
@ffesti ffesti moved this to Backlog in RPM Jul 14, 2022
@ffesti ffesti added this to RPM Jul 14, 2022
@pmatilai pmatilai added the generator Dependency generation related label Sep 11, 2023
@voxik
Copy link
Contributor Author

voxik commented Oct 4, 2023

Looking into this again and in more detail, I think it would be enough if there were some dummy.attr file loaded. This would later enable to just define some __dummy_requires macro and this could be enough.

My (probably very silly idea) would be to ship find.attr file with RPM, that would enable to reuse the __find_requires macro used previously for the external helpers. This functionality is controlled by separate macro anyway. But I don't think that RPM protect these macros in any special way.

@voxik
Copy link
Contributor Author

voxik commented Oct 5, 2023

Of course, there is no need to ship a file if the proper keyword (e.g. find as I proposed above) is added into the fc->atypes list right here:

rpm/build/rpmfc.c

Lines 1186 to 1196 in c284d09

if (rpmGlob(attrPath, NULL, &files) == 0) {
nattrs = argvCount(files);
fc->atypes = xcalloc(nattrs + 1, sizeof(*fc->atypes));
for (int i = 0; i < nattrs; i++) {
char *bn = basename(files[i]);
bn[strlen(bn)-strlen(".attr")] = '\0';
fc->atypes[i] = rpmfcAttrNew(bn);
}
fc->atypes[nattrs] = NULL;
argvFree(files);
}

I think that if we had the proper keyword, I could try to come up with a patch

@voxik
Copy link
Contributor Author

voxik commented Oct 5, 2023

Other option for me is to extract the generators into separate package, to have them available in the right place for the build. This has its own pros/cons

@voxik
Copy link
Contributor Author

voxik commented Oct 6, 2023

My (probably very silly idea) would be to ship find.attr file with RPM

Should I create package shipping such file for Fedora 🤪 It would need to be explicitly BRed, so it should not create any havoc 🤔

@voxik
Copy link
Contributor Author

voxik commented Oct 6, 2023

My (probably very silly idea) would be to ship find.attr file with RPM

Should I create package shipping such file for Fedora 🤪 It would need to be explicitly BRed, so it should not create any havoc 🤔

More details including implementation, where I went with local_generator name:

https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/3MHROKOM53HM6NF7RGGLFBIQFG5IEIQG/

voxik added a commit to voxik/rpm that referenced this issue Oct 24, 2023
This generator can be used by .spec file, which ships their own
generators:

~~~
Source1: generator.req
%global __local_generator_requires bash %{SOURCE1}
~~~

Resolves rpm-software-management#782
voxik added a commit to voxik/rpm that referenced this issue Oct 25, 2023
This generator can be used by .spec file, which ships their own
generators:

~~~
Source1: generator.req
%global __local_generator_requires bash %{SOURCE1}
~~~

Resolves rpm-software-management#782
voxik added a commit to voxik/rpm that referenced this issue Oct 25, 2023
This generator can be used by .spec file, which ships their own
generators:

~~~
Source1: generator.req
%global __local_generator_requires bash %{SOURCE1}
%global __local_generator_path .*
~~~

Resolves rpm-software-management#782
voxik added a commit to voxik/rpm that referenced this issue Oct 25, 2023
This generator can be used by .spec file, which ships their own
generators:

~~~
Source1: generator.req
%global __local_generator_requires bash %{SOURCE1}
%global __local_generator_path .*
~~~

Resolves rpm-software-management#782
ffesti added a commit to voxik/rpm that referenced this issue Feb 6, 2024
This can declare file attributes which details can be defined in the
spec file. This allows enabling file attributes and their dependency
generators even if they are only shipped in the package itself and are
not yet installed.

The names need to be separated by colons (:).

Co-authored-by: Florian Festi <ffesti@redhat.com>
Resolves: rpm-software-management#782
ffesti added a commit to voxik/rpm that referenced this issue Feb 13, 2024
This can declare file attributes which details can be defined in the
spec file. This allows enabling file attributes and their dependency
generators even if they are only shipped in the package itself and are
not yet installed.

The names need to be separated by colons (:).

Co-authored-by: Florian Festi <ffesti@redhat.com>
Resolves: rpm-software-management#782
ffesti added a commit to voxik/rpm that referenced this issue Feb 14, 2024
This can declare file attributes which details can be defined in the
spec file. This allows enabling file attributes and their dependency
generators even if they are only shipped in the package itself and are
not yet installed.

The names need to be separated by colons (:).

Co-authored-by: Florian Festi <ffesti@redhat.com>
Resolves: rpm-software-management#782
ffesti added a commit to voxik/rpm that referenced this issue Feb 14, 2024
This can declare file attributes which details can be defined in the
spec file. This allows enabling file attributes and their dependency
generators even if they are only shipped in the package itself and are
not yet installed.

The names need to be separated by colons (:).

Co-authored-by: Florian Festi <ffesti@redhat.com>
Resolves: rpm-software-management#782
pmatilai pushed a commit to pmatilai/rpm that referenced this issue Feb 15, 2024
This can declare file attributes which details can be defined in the
spec file. This allows enabling file attributes and their dependency
generators even if they are only shipped in the package itself and are
not yet installed.

The names need to be separated by colons (:).

Co-authored-by: Florian Festi <ffesti@redhat.com>
Resolves: rpm-software-management#782
pmatilai pushed a commit to pmatilai/rpm that referenced this issue Feb 15, 2024
This can declare file attributes which details can be defined in the
spec file. This allows enabling file attributes and their dependency
generators even if they are only shipped in the package itself and are
not yet installed.

The names need to be separated by colons (:).

Co-authored-by: Florian Festi <ffesti@redhat.com>
Resolves: rpm-software-management#782
pmatilai pushed a commit to pmatilai/rpm that referenced this issue Feb 15, 2024
Allow declaring file attributes from the spec via %_local_file_attrs
macro. This allows enabling file attributes and their dependency
generators even if they are only shipped in the package itself and are
not yet installed.

The names need to be separated by colons (:).

Co-authored-by: Florian Festi <ffesti@redhat.com>
Resolves: rpm-software-management#782
ffesti added a commit that referenced this issue Feb 15, 2024
Allow declaring file attributes from the spec via %_local_file_attrs
macro. This allows enabling file attributes and their dependency
generators even if they are only shipped in the package itself and are
not yet installed.

The names need to be separated by colons (:).

Co-authored-by: Florian Festi <ffesti@redhat.com>
Resolves: #782
@github-project-automation github-project-automation bot moved this from Backlog to Done in RPM Feb 15, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
generator Dependency generation related RFE
Projects
Status: Done
4 participants