Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Document RPM generator input and output format #1011

Closed
mikhailnov opened this issue Jan 15, 2020 · 7 comments
Closed

Document RPM generator input and output format #1011

mikhailnov opened this issue Jan 15, 2020 · 7 comments

Comments

@mikhailnov
Copy link
Contributor

mikhailnov commented Jan 15, 2020

I have been writing an RPM generator (https://rpm.org/user_doc/dependency_generators.html) and I can't understand which output format it must have.
Script is here: https://abf.io/import/devel-rpm-generators/
It simply does not work, no provides/requires are generated, I have looked into pkgconfigdeps.sh, tried to make the same output format, but it still does not work. Neither stdout not stderr are printed.
UPD. found ther issue and fixed it, but docs require adjustment
But, if I run it locally, it works correctly:

bash-4.4# ls /usr/lib64/*.so | $(rpm --eval %__devel_provides) 2>/dev/null
devel(libBrokenLocale(64bit))
devel(libanl(64bit))
devel(libatomic(64bit))
devel(libc(64bit))
devel(libcrypt(64bit))
devel(libdl(64bit))
<...>

Just as pkgconfigdeps.sh:

bash-4.4# ls /usr/lib64/pkgconfig/*.pc -1v | /usr/lib/rpm/pkgconfigdeps.sh --provides
pkgconfig(libzstd) = 1.4.3
pkgconfig(popt) = 1.16
pkgconfig(rpm) = 4.15.1

Example build log with this generator enabled: https://abf.io/build_lists/3186141

Currently the output method is:

echo -n "$@ "
echo

(https://abf.io/import/devel-rpm-generators/blob/rosa2019.1/develgen.sh#lc-7)
It is like https://github.com/rpm-software-management/rpm/blob/master/scripts/pkgconfigdeps.sh#L34

Please help to understand what is wrong in https://abf.io/import/devel-rpm-generators/ . There is no documentation.

@mikhailnov
Copy link
Contributor Author

I have found what was wrong ("NAME needs to be replaced by the name choosen for the file attribute and needs to be the same as the file name of the macro file itself").

But please document the input and output format. pkgconfigdeps.sh uses echo -n 'value ' and then echo an empty line, find-provides.php uses just echo (https://github.com/rpm-software-management/rpm/blob/master/scripts/find-provides.php#L14).

Also in https://rpm.org/user_doc/dependency_generators.html it is first written:
"generation of Provides: and Requires:"
but then examples are givven for recommends etc.

@mikhailnov
Copy link
Contributor Author

Maybe echo -n is used to additionally print = XXX, then the output format must be just line-by-line values?

@pmatilai
Copy link
Member

Um, input and output format haven't changed since beginning of times, the generator doc says:
"A generator is just an executable that reads file name(s) from stdin and writes out Provides: or Requires: on stdout"

It's always been one per line, but added a note about that to the doc now.

@voxik
Copy link
Contributor

voxik commented Jan 16, 2020

It's always been one per line, but added a note about that to the doc now.

I don't think this is correct neither comprehensible.

Let me use RubyGems requires generator as an example.

If I understand the generators correctly, the generator is called, when the files are processed for the (sub)package. The files, which are matched by the __NAME_path are provided on stdin for the generator.

In case of RubyGems, that should be the only *.gemspec file available in the package [1].

All the submitted files can be used for processing required by generator. In RubyGems, we just need to open the submitted .gemspec file and look in there for its dependencies. All the dependencies are later printed into output. The output can be multiline and it looks similarly to what would be previously written directly in .spec file, although the Requires: is ommited.

This is the processing done for RubyGems [2]. This at miminum prints the dependency on RubyGems [3], which is on subsequent lines followed by all the other requrements which the specific package has [4].

@voxik
Copy link
Contributor

voxik commented Jan 16, 2020

Also, I believe that --rpmfcdebug rpmbuild option should be mentioned in the documentation.

@mikhailnov
Copy link
Contributor Author

Um, input and output format haven't changed since beginning of times, the generator doc says:
"A generator is just an executable that reads file name(s) from stdin and writes out Provides: or Requires: on stdout"

It's always been one per line, but added a note about that to the doc now.

It is better now. But still it is not clear that it must print e.g not Requires: xxx, but just xxx.

@mikhailnov
Copy link
Contributor Author

Btw, there is a typo:

Generators can be declare in the file attributes

declare -> declared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants