Bug 20912 - Implement instantiation of parameterized spec files with parameters defined by tags
Summary: Implement instantiation of parameterized spec files with parameters defined b...
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: gear (show other bugs)
Version: unstable
Hardware: all Linux
: P3 enhancement
Assignee: Dmitry V. Levin
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks: 26480
  Show dependency tree
 
Reported: 2009-07-29 21:56 MSD by Alexander Bokovoy
Modified: 2012-12-15 02:33 MSK (History)
12 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Bokovoy 2009-07-29 21:56:35 MSD
When multiple products are in the same branch and are built from separate spec files, it is currently impossible to specify which specfile to use for which product.

It would be good to add a spec-match: rule to gear rules that allows to extract specfile name from the tag that is used for build.

Suppose that tag is in specific format (altlinux-<name>-<version>). Something like this
git show-ref -d --tags |grep $main_tree_sha1|cut -d/ -f3|cut -d- -f2
would allow to extract <name> and use that as specfile name.

If spec-match would support a regular expression to replace the latter cut call, it would be a great enhancement.
Comment 1 Dmitry V. Levin 2009-08-18 21:13:52 MSD
(In reply to comment #0)
> When multiple products are in the same branch and are built from separate spec
> files, it is currently impossible to specify which specfile to use for which
> product.
> 
> It would be good to add a spec-match: rule to gear rules that allows to extract
> specfile name from the tag that is used for build.

That is, tag object used for build will provide additional information used for build, besides commit id?
Comment 2 Alexander Bokovoy 2009-08-18 23:55:08 MSD
For example, tag name could be used for that. Suppose I have multiple packages in the same git and branch, and would like to package them separately (this is the case with Samba code, for example). I'd like to have separate gear rules or separate spec files.

When I'd tag the object, I'd use tag's name to encode what I want to parse later in spec-match: rule to get the spec file name.
Comment 3 Dmitry V. Levin 2009-08-19 00:29:49 MSD
Good news: tag name is part of tag object, so it can be calculated from any tag name alias and cannot be changed without changing tag id.  For example,
gear$ git cat-file tag 1.5.3-alt1 |sed '/^tag /!d;s///;q'
1.5.3-alt1

Not so good news: with proposed feature implemented, commit id will no longer be always sufficient to build from.  From another side, in production environment (like girar-builder) gear is invoked only with tag objects anyway.

First gear versions was capable to build from tree id, now commit id is required.
I'm almost convinced that requiring tag id for some use cases is acceptable change.

What say ye?
Comment 4 Alexander Bokovoy 2009-08-19 08:08:06 MSD
From my point of view we anyway end up with tag objects in case we need tracked and proven build history. This, of course, ofsets "temporary commits" approach used in gear for some workflows but the gain is higher.
Comment 5 Dmitry V. Levin 2012-12-14 03:25:12 MSK
I'm slightly changing the subject to describe the idea which is being implemented.
It's essentially the same: tag object not only references to a commit object but also affects the way how its spec file is processed.
Comment 6 Repository Robot 2012-12-15 02:33:10 MSK
gear-2.0.0-alt1 -> sisyphus:

* Fri Dec 14 2012 Dmitry V. Levin <ldv@altlinux> 2.0.0-alt1
- gear-sh-functions (expand_rpm_macros): changed macros expansion
  algorithm to expand those macros that are known and leave unknown
  macros unexpanded.
- Implemented .gear/rules specsubst directive that controls
  instantiation of spec file templates with parameters
  defined by tag objects (closes: #20912).