The number of sub-packages I want to create are so many (about 300 over).
I think.. to make the sub-package, the files should be installed (%install) early. So I installed whole files to some specific directories. Now I want to pack the file for each directory name.
in summaries,
Is it possible to repeat rpm macros? (ex, %package %description %files)
If it's possible, what should I use to repeat? (ex for ??)
As I know, to use %files macro, the real files should be installed previously. then where should I write the codes?
Natively, no there isn't. You'll have to use an external templating language like jinja2 to create the spec file on-the-fly.
That being said, having 300 subpackages is going to be an absolute nightmare for both your CM folks and for your users. You might want to ask another question explaining the use case to see if there are better alternatives.