-
Notifications
You must be signed in to change notification settings - Fork 18
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
tar_git: Support for templated .spec files #5
Comments
I like this idea better than the old spectacle yaml stuff. Also a lot of Mer packages are already using this precheckin.sh approach. |
larstiq
pushed a commit
to larstiq/boss-launcher-webhook
that referenced
this issue
Oct 8, 2015
Follows the specification as laid out by Thomas Perl in MeeGoIntegration#5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have several projects where we build the .spec file from some template via a script (usually called
rpm/precheckin.sh
, but I'm sure there are others) to account for slight differences (e.g. two packages for different device adaptations that differ only in package name and build flags, or multiple variations of the same package, etc..). This is good, but has several problems:precheckin.sh
and patch the generated (=output) files in Git, leading to problems down the line the next time the template is updated andprecheckin.sh
run (I've had this at least two times, and was on the "receiving end" of this issue, meaning I had to merge back changes to generated files somebody else did into the template file)precheckin.sh
has to take care of removing the old file, or the developer has to figure out that the file isn't generated, and has to manuallygit rm
the outdated generated file (e.g. an outdated device variant is removed from being generated, then the associated output file also needs to be manually removed).spec
file, making it harder to figure out which.spec
file is the "template" one (e.g.precheckin.sh
generatesbar.spec
fromfoo.spec
viased -e "s/FooFoo/BarBar/g" <foo.spec >bar.spec
-- one has to read and understandprecheckin.sh
to figure out thatbar.spec
is read fromfoo.spec
, and thatfoo.spec
is used as "template" as well as "output")I hereby propose a feature enhancement for
tar_git
, whereas:.spec
file is not generated, it is stored in Git like now (rpm/<packagename>.spec
), nothing changes.spec
file(s) is/are (to be) generated:.spec
files SHOULD NOT be stored in Git.spec
(suggested:.spec.in
, but not required, as it could theoretically be fully generated byrpm/precheckin.sh
without any template file)rpm/precheckin.sh
that is run bytar_git
using a Bourne shell with the working directory beingrpm/
(think:cd rpm && rm -f *.spec && sh precheckin.sh
) after the Git checkout and that generates one or more.spec
filesrpm/precheckin.sh
script MUST NOT assume that any.spec
file exists, meaning that one cannot generate.spec
file variants out of a base.spec
file - the base.spec
file must always be a template (e.g..spec.in
) -- this is to allowrm -f rpm/*.spec
to remove leftover files, and to avoid situations like withbar.spec
generated fromfoo.spec
as described aboverpm/precheckin.sh
script SHOULD NOT have the executable bit (+x
) set and the shebang line SHOULD BE#!/bin/sh
(but is ignored, as it's run withsh precheckin.sh
as above)rpm/precheckin.sh
script MUST NOT use any bash-isms, only a normal Bourne shell should be assumed.spec
file is stored in Git (as for all projects using generated.spec
files up to now), it WILL BE overwritten byrpm/precheckin.sh
rpm/precheckin.sh
exists, it is always safe to runcd rpm && rm -f *.spec && sh precheckin.sh
, this way, the script doesn't have to take care of removing outdated files (e.g. when a variant for an outdated device is removed, thereby causing less.spec
files to be generated)rpm/precheckin.sh
haverpm/*.spec
(like this, with the glob) in their.gitignore
files, to avoid accidentally adding/checking in generated.spec
files during developmentThis specification allows local build tools such as
mb2
to be eventually extended to generate and update.spec
files on demand, and also provides a consistent way for developers to generate/update the.spec
files manually (cd rpm && sh precheckin.sh
).In short:
rpm/precheckin.sh
exists, any tooling or developer should assume that it/he/she needs to firstrm rpm/*.spec
and then runsh precheckin.sh
(inside therpm/
directory as working directory) before the list of.spec
files is up to date and before any package building can take place. Any change in the source directory - even outside ofrpm/
- should cause a re-run ofrpm/precheckin.sh
, as theprecheckin.sh
script might parse source code files to obtain values used in the.spec
file --tar_git
will run this script after checkoutOr in code (assume
fail
is a function that prints the error message and then exits with non-zero exit status):Advantages that this gives us:
.spec
filesPossible transitional disadvantages (= yes, we can't have nice things, there's a transitional cost):
precheckin.sh
scripts might assume that they are run from the project rootprecheckin.sh
might require parameters, these need to be fixedThe text was updated successfully, but these errors were encountered: