Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6369967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:52:16+00:00 2026-05-25T00:52:16+00:00

My goal is to come up with a spec file that defines subpackages dynamically.

  • 0

My goal is to come up with a spec file that defines subpackages dynamically.

Currently, I have a macro defined in the spec file so that I can call it with different parameters to generate different %package sections. Eg.

%define create_pkg(n:)\
%package -n subpackage-%1\
Summary: Subpackage %1\
…\
%{nil}

%create_pkg sub1
%create_pkg sub2
%create_pkg sub3

However, I can only hard-code the parameters (sub1, sub2, sub3) of the create_pkg macro in the specfile. Is there a way to make the specfile read a separate file, which would contain the names of the subpackages I want? eg. subpackages.txt would have the following:

sub1
sub2
sub3

and the spec file would read subpackages.txt and call %create_pkg with the names read from the txt file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:52:17+00:00Added an answer on May 25, 2026 at 12:52 am

    Answering my own question. If the rpm has lua script build-in (it’s a build time option I think), then you can use lua scripts in the file

    1) define the sub packages in a separate file, eg. targets.txt:

    %define build_targets sub1 sub2 sub3
    

    2) include targets.txt at the beginning of the spec file:

    %include targets.txt
    

    3) use lua script to iterate through the targets in the preamble section:

    %{lua:
    for target in string.gmatch(rpm.expand("%{build_targets}"), "[%w_-]+")
    do
      print("%package "..target.."\n")
      print("Summary: subpackage "..target.."\n")
      ...
      print("%description "..target.."\n")
    end
    

    then the %package directive for the sub packages will be dynamically generated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've come up with a simple example that hopefully illustrates my goal. I currently
I have few web pages sitting in different directories and my goal is to
For an application, I need to save user logs that come in different formats,
High Level Goal: Create a single Maven Web Application project that can be used
My goal is to come up with a portable urllib2 solution that would POST
I have come unstuck with this goal after successfully using a dataModel when rendering
My goal is to have a formset that lists 5 versions of the same
i have come into quite a funny hole here. i can't seem to be
goal: I have the string 1234432144 I want to only replace the first 2
Goal To use a CREATE TYPE statement in HSQLDB 2.0.0 to create a user-defined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.