3 Copyright (C) 2008-2010 Sam Liddicott <sam@liddicott.com>
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program. If not, see <[1]http://www.gnu.org/licenses/>.
19 This documentation is licensed under the
21 make-srpm documentation
23 Copyright (C) 2008-2010 Sam Liddicott <sam@liddicott.com>
25 Permission is granted to copy, distribute and/or modify this document
26 under the terms of the GNU Free Documentation License, Version 1.3 or
27 any later version published by the Free Software Foundation; with no
28 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
29 copy of the license is included in the section entitled "GNU Free
30 Documentation License".
34 Here are some scripts which I use to produce a src.rpm from a git tree.
35 In accordance with rpm philosphy, a pristine source tar.gz is produced,
36 with a series of patches up to the current released. The svn backend is
37 less developed, as I am not so familiar with svn as I am with git, but
38 it works enough for my use with the [2]openchange project.
41 make-srpm [options] project.spec [...]
43 and this should be invoked from within or below the git/svn checkout
45 Note: make-srpm will cd to the top-level git/svn directory before
46 working. Multiple .spec files can be specified, and these can be
47 absolute paths or relative to the current directory (not the top level
49 make-srpm will generate a new .spec file based on the on you provide,
50 and then use this spec file along with the specified environment it
51 will build the binary RPMS.
52 make-srpm creates a folder called dist-export in the top level git
54 Into this folder it will export the pristine source as specified by the
55 RELEASE variable, along with any other files in the $EXTRA_SOURCE
56 directory (relative to the spec file).
57 Numbered patches are then produced, starting after the highest patch
58 already in the spec file.
59 dist-export then contains everything required, and the src.rpm is build
60 using rpmbuild --nodeps
64 The operation of make-srpm is generally controlled by shell variables
65 which may be set explicitly in the environment before calling
66 make-srpm, or specified as command arguments in makefile fashion; e.g.
68 make-srpm ORIGIN_PATTERN="*alpha*" project.spec
70 or from within the specfile from specially formed comments.
71 The Name: and Version: fields are always extracted and stored in the
72 environment variables Name and Version.
73 The following comments are also searched:
74 #make-srpm-SOURCE_PATHS:
76 #make-srpm-ORIGIN_PATTERN:
78 #make-srpm-PATCH_LEVEL:
80 #makesrpm-GIT_CHECKOUT: HEAD
82 to set environment variables named without the lower case prefix. The
83 meaning of these is explained below:
84 SOURCE_PATHS - this is a space-separated list of directories relative
85 to the top level git folder, and specifies the folders to be exported.
86 Some git trees contain source for more than one project and so it can
87 be convenient to reduce the size of the source tar.gz by putting a line
88 like this in the sub-project spec file:
90 #make-srpm-SOURCE_PATHS: sub_project_dir includes
92 ORIGIN - this is a git reference to the commit that represents the
93 pristine source and should probably be the most recent tag before the
94 git rebase point. This can be a tag or a commit hash.
95 ORIGIN_PATTERN - more useful than origin, can be a git tag glob so that
96 make-srpm can select the current ORIGIN automatically. It can be
97 convenient to have a line in a spec file like:
99 #make-srpm-ORIGIN_PATTERN=*release*
101 RELEASE - is a git reference to the release that you want to build;
102 thus patches will be emitted from ORIGIN to RELEASE. This can be a tag
103 or a commit hash, or the value HEAD (meaning whatever is currently
104 checked out), or the special value LOCAL which means that uncommitted
105 changes are also included.
106 PATCH_LEVEL - indicates the value of the -p argument that will need
107 passing to patch and depends on what level of subdirectory your source
108 sits at from the top level git directory. As the value is not likely to
109 change for a project, it can be convenient to add a line like this to a
112 #make-srpm-PATCH_LEVEL=2
114 The new spec file will also contain some convenient macro definitions
115 at the top of the file, like:
117 %define makesrpm_tarname samba-release-4-0-0alpha7.tar.gz
118 %define makesrpm_tarprefix samba-release-4-0-0alpha7
120 which you can use as a basis for your own macro definitions or package
122 make-srpm will also allow you to pass your own spec file macro
123 definitions. Macros may be literal macros, or interpolated macros which
124 are be defined in terms of values calculated during execution. This is
125 similar to defining evironment variables, except that define_ or
126 _define_ is prefixed to the name.
129 make-srpm [3]define_project_builder=sam@liddicott.com \
130 _define_project_version='$VERSION' \
134 will replace the macro de
136 GIT_CLONE - a git URL is cloned into a temporary folder, and then used.
137 This allows make-srpm to run against a base spec file, and checkout the
138 appropriate git tree. The -c flag can be used to specify a temp folder
139 to use, which will be deleted afterwards (if empty). -C specifys a temp
140 path to use but does not deleted it afterwards - useful to avoid
141 repeated slow checkouts. See GIT_CHECKOUT
143 GIT_CHECKOUT - a branch or tag or hash to checkout after GIT_CLONE
147 git rev-parse is used to sanitize external git references in this
150 RELEASE_COMMIT="$(git rev-parse "$RELEASE^{commit}")"
154 awk is used for enormous speed in some cases.
155 git_linearize is implemented in awk and solves the problem that the
156 output of git format-patch A..B will often fail when applied to A if
157 there have been merges. git_linearize will instead take the longest
158 path from A..B and then perform git diff between successive points in
160 git_fix_empty_files is implemented in awk. It processes all the outputs
161 of git diff in order to cope with patches generated by git diff that
162 patch cannot handle; including addition or removal of empty files and
163 meta-data changes. Some of the metadata changes probably ought to
164 generate shell commands to be executed once the patches have been
166 git_check_empty_patch used to be grep '^' which returns non-zero on
167 empty files while passing through the entire file. Because some commits
168 only have meta-data changes, we need to detect files without any hunks
169 while still passing the entire output, so awk is used.
171 GNU Free Documentation License
173 Version 1.3, 3 November 2008
175 Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
178 Everyone is permitted to copy and distribute verbatim copies of this
179 license document, but changing it is not allowed.
183 The purpose of this License is to make a manual, textbook, or other
184 functional and useful document "free" in the sense of freedom: to
185 assure everyone the effective freedom to copy and redistribute it, with
186 or without modifying it, either commercially or noncommercially.
187 Secondarily, this License preserves for the author and publisher a way
188 to get credit for their work, while not being considered responsible
189 for modifications made by others.
191 This License is a kind of "copyleft", which means that derivative works
192 of the document must themselves be free in the same sense. It
193 complements the GNU General Public License, which is a copyleft license
194 designed for free software.
196 We have designed this License in order to use it for manuals for free
197 software, because free software needs free documentation: a free
198 program should come with manuals providing the same freedoms that the
199 software does. But this License is not limited to software manuals; it
200 can be used for any textual work, regardless of subject matter or
201 whether it is published as a printed book. We recommend this License
202 principally for works whose purpose is instruction or reference.
204 1. APPLICABILITY AND DEFINITIONS
206 This License applies to any manual or other work, in any medium, that
207 contains a notice placed by the copyright holder saying it can be
208 distributed under the terms of this License. Such a notice grants a
209 world-wide, royalty-free license, unlimited in duration, to use that
210 work under the conditions stated herein. The "Document", below, refers
211 to any such manual or work. Any member of the public is a licensee, and
212 is addressed as "you". You accept the license if you copy, modify or
213 distribute the work in a way requiring permission under copyright law.
215 A "Modified Version" of the Document means any work containing the
216 Document or a portion of it, either copied verbatim, or with
217 modifications and/or translated into another language.
219 A "Secondary Section" is a named appendix or a front-matter section of
220 the Document that deals exclusively with the relationship of the
221 publishers or authors of the Document to the Document's overall subject
222 (or to related matters) and contains nothing that could fall directly
223 within that overall subject. (Thus, if the Document is in part a
224 textbook of mathematics, a Secondary Section may not explain any
225 mathematics.) The relationship could be a matter of historical
226 connection with the subject or with related matters, or of legal,
227 commercial, philosophical, ethical or political position regarding
230 The "Invariant Sections" are certain Secondary Sections whose titles
231 are designated, as being those of Invariant Sections, in the notice
232 that says that the Document is released under this License. If a
233 section does not fit the above definition of Secondary then it is not
234 allowed to be designated as Invariant. The Document may contain zero
235 Invariant Sections. If the Document does not identify any Invariant
236 Sections then there are none.
238 The "Cover Texts" are certain short passages of text that are listed,
239 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
240 the Document is released under this License. A Front-Cover Text may be
241 at most 5 words, and a Back-Cover Text may be at most 25 words.
243 A "Transparent" copy of the Document means a machine-readable copy,
244 represented in a format whose specification is available to the general
245 public, that is suitable for revising the document straightforwardly
246 with generic text editors or (for images composed of pixels) generic
247 paint programs or (for drawings) some widely available drawing editor,
248 and that is suitable for input to text formatters or for automatic
249 translation to a variety of formats suitable for input to text
250 formatters. A copy made in an otherwise Transparent file format whose
251 markup, or absence of markup, has been arranged to thwart or discourage
252 subsequent modification by readers is not Transparent. An image format
253 is not Transparent if used for any substantial amount of text. A copy
254 that is not "Transparent" is called "Opaque".
256 Examples of suitable formats for Transparent copies include plain ASCII
257 without markup, Texinfo input format, LaTeX input format, SGML or XML
258 using a publicly available DTD, and standard-conforming simple HTML,
259 PostScript or PDF designed for human modification. Examples of
260 transparent image formats include PNG, XCF and JPG. Opaque formats
261 include proprietary formats that can be read and edited only by
262 proprietary word processors, SGML or XML for which the DTD and/or
263 processing tools are not generally available, and the machine-generated
264 HTML, PostScript or PDF produced by some word processors for output
267 The "Title Page" means, for a printed book, the title page itself, plus
268 such following pages as are needed to hold, legibly, the material this
269 License requires to appear in the title page. For works in formats
270 which do not have any title page as such, "Title Page" means the text
271 near the most prominent appearance of the work's title, preceding the
272 beginning of the body of the text.
274 The "publisher" means any person or entity that distributes copies of
275 the Document to the public.
277 A section "Entitled XYZ" means a named subunit of the Document whose
278 title either is precisely XYZ or contains XYZ in parentheses following
279 text that translates XYZ in another language. (Here XYZ stands for a
280 specific section name mentioned below, such as "Acknowledgements",
281 "Dedications", "Endorsements", or "History".) To "Preserve the Title"
282 of such a section when you modify the Document means that it remains a
283 section "Entitled XYZ" according to this definition.
285 The Document may include Warranty Disclaimers next to the notice which
286 states that this License applies to the Document. These Warranty
287 Disclaimers are considered to be included by reference in this License,
288 but only as regards disclaiming warranties: any other implication that
289 these Warranty Disclaimers may have is void and has no effect on the
290 meaning of this License.
294 You may copy and distribute the Document in any medium, either
295 commercially or noncommercially, provided that this License, the
296 copyright notices, and the license notice saying this License applies
297 to the Document are reproduced in all copies, and that you add no other
298 conditions whatsoever to those of this License. You may not use
299 technical measures to obstruct or control the reading or further
300 copying of the copies you make or distribute. However, you may accept
301 compensation in exchange for copies. If you distribute a large enough
302 number of copies you must also follow the conditions in section 3.
304 You may also lend copies, under the same conditions stated above, and
305 you may publicly display copies.
307 3. COPYING IN QUANTITY
309 If you publish printed copies (or copies in media that commonly have
310 printed covers) of the Document, numbering more than 100, and the
311 Document's license notice requires Cover Texts, you must enclose the
312 copies in covers that carry, clearly and legibly, all these Cover
313 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
314 the back cover. Both covers must also clearly and legibly identify you
315 as the publisher of these copies. The front cover must present the full
316 title with all words of the title equally prominent and visible. You
317 may add other material on the covers in addition. Copying with changes
318 limited to the covers, as long as they preserve the title of the
319 Document and satisfy these conditions, can be treated as verbatim
320 copying in other respects.
322 If the required texts for either cover are too voluminous to fit
323 legibly, you should put the first ones listed (as many as fit
324 reasonably) on the actual cover, and continue the rest onto adjacent
327 If you publish or distribute Opaque copies of the Document numbering
328 more than 100, you must either include a machine-readable Transparent
329 copy along with each Opaque copy, or state in or with each Opaque copy
330 a computer-network location from which the general network-using public
331 has access to download using public-standard network protocols a
332 complete Transparent copy of the Document, free of added material. If
333 you use the latter option, you must take reasonably prudent steps, when
334 you begin distribution of Opaque copies in quantity, to ensure that
335 this Transparent copy will remain thus accessible at the stated
336 location until at least one year after the last time you distribute an
337 Opaque copy (directly or through your agents or retailers) of that
338 edition to the public.
340 It is requested, but not required, that you contact the authors of the
341 Document well before redistributing any large number of copies, to give
342 them a chance to provide you with an updated version of the Document.
346 You may copy and distribute a Modified Version of the Document under
347 the conditions of sections 2 and 3 above, provided that you release the
348 Modified Version under precisely this License, with the Modified
349 Version filling the role of the Document, thus licensing distribution
350 and modification of the Modified Version to whoever possesses a copy of
351 it. In addition, you must do these things in the Modified Version:
352 * A. Use in the Title Page (and on the covers, if any) a title
353 distinct from that of the Document, and from those of previous
354 versions (which should, if there were any, be listed in the History
355 section of the Document). You may use the same title as a previous
356 version if the original publisher of that version gives permission.
357 * B. List on the Title Page, as authors, one or more persons or
358 entities responsible for authorship of the modifications in the
359 Modified Version, together with at least five of the principal
360 authors of the Document (all of its principal authors, if it has
361 fewer than five), unless they release you from this requirement.
362 * C. State on the Title page the name of the publisher of the
363 Modified Version, as the publisher.
364 * D. Preserve all the copyright notices of the Document.
365 * E. Add an appropriate copyright notice for your modifications
366 adjacent to the other copyright notices.
367 * F. Include, immediately after the copyright notices, a license
368 notice giving the public permission to use the Modified Version
369 under the terms of this License, in the form shown in the Addendum
371 * G. Preserve in that license notice the full lists of Invariant
372 Sections and required Cover Texts given in the Document's license
374 * H. Include an unaltered copy of this License.
375 * I. Preserve the section Entitled "History", Preserve its Title, and
376 add to it an item stating at least the title, year, new authors,
377 and publisher of the Modified Version as given on the Title Page.
378 If there is no section Entitled "History" in the Document, create
379 one stating the title, year, authors, and publisher of the Document
380 as given on its Title Page, then add an item describing the
381 Modified Version as stated in the previous sentence.
382 * J. Preserve the network location, if any, given in the Document for
383 public access to a Transparent copy of the Document, and likewise
384 the network locations given in the Document for previous versions
385 it was based on. These may be placed in the "History" section. You
386 may omit a network location for a work that was published at least
387 four years before the Document itself, or if the original publisher
388 of the version it refers to gives permission.
389 * K. For any section Entitled "Acknowledgements" or "Dedications",
390 Preserve the Title of the section, and preserve in the section all
391 the substance and tone of each of the contributor acknowledgements
392 and/or dedications given therein.
393 * L. Preserve all the Invariant Sections of the Document, unaltered
394 in their text and in their titles. Section numbers or the
395 equivalent are not considered part of the section titles.
396 * M. Delete any section Entitled "Endorsements". Such a section may
397 not be included in the Modified Version.
398 * N. Do not retitle any existing section to be Entitled
399 "Endorsements" or to conflict in title with any Invariant Section.
400 * O. Preserve any Warranty Disclaimers.
402 If the Modified Version includes new front-matter sections or
403 appendices that qualify as Secondary Sections and contain no material
404 copied from the Document, you may at your option designate some or all
405 of these sections as invariant. To do this, add their titles to the
406 list of Invariant Sections in the Modified Version's license notice.
407 These titles must be distinct from any other section titles.
409 You may add a section Entitled "Endorsements", provided it contains
410 nothing but endorsements of your Modified Version by various
411 parties--for example, statements of peer review or that the text has
412 been approved by an organization as the authoritative definition of a
415 You may add a passage of up to five words as a Front-Cover Text, and a
416 passage of up to 25 words as a Back-Cover Text, to the end of the list
417 of Cover Texts in the Modified Version. Only one passage of Front-Cover
418 Text and one of Back-Cover Text may be added by (or through
419 arrangements made by) any one entity. If the Document already includes
420 a cover text for the same cover, previously added by you or by
421 arrangement made by the same entity you are acting on behalf of, you
422 may not add another; but you may replace the old one, on explicit
423 permission from the previous publisher that added the old one.
425 The author(s) and publisher(s) of the Document do not by this License
426 give permission to use their names for publicity for or to assert or
427 imply endorsement of any Modified Version.
429 5. COMBINING DOCUMENTS
431 You may combine the Document with other documents released under this
432 License, under the terms defined in section 4 above for modified
433 versions, provided that you include in the combination all of the
434 Invariant Sections of all of the original documents, unmodified, and
435 list them all as Invariant Sections of your combined work in its
436 license notice, and that you preserve all their Warranty Disclaimers.
438 The combined work need only contain one copy of this License, and
439 multiple identical Invariant Sections may be replaced with a single
440 copy. If there are multiple Invariant Sections with the same name but
441 different contents, make the title of each such section unique by
442 adding at the end of it, in parentheses, the name of the original
443 author or publisher of that section if known, or else a unique number.
444 Make the same adjustment to the section titles in the list of Invariant
445 Sections in the license notice of the combined work.
447 In the combination, you must combine any sections Entitled "History" in
448 the various original documents, forming one section Entitled "History";
449 likewise combine any sections Entitled "Acknowledgements", and any
450 sections Entitled "Dedications". You must delete all sections Entitled
453 6. COLLECTIONS OF DOCUMENTS
455 You may make a collection consisting of the Document and other
456 documents released under this License, and replace the individual
457 copies of this License in the various documents with a single copy that
458 is included in the collection, provided that you follow the rules of
459 this License for verbatim copying of each of the documents in all other
462 You may extract a single document from such a collection, and
463 distribute it individually under this License, provided you insert a
464 copy of this License into the extracted document, and follow this
465 License in all other respects regarding verbatim copying of that
468 7. AGGREGATION WITH INDEPENDENT WORKS
470 A compilation of the Document or its derivatives with other separate
471 and independent documents or works, in or on a volume of a storage or
472 distribution medium, is called an "aggregate" if the copyright
473 resulting from the compilation is not used to limit the legal rights of
474 the compilation's users beyond what the individual works permit. When
475 the Document is included in an aggregate, this License does not apply
476 to the other works in the aggregate which are not themselves derivative
477 works of the Document.
479 If the Cover Text requirement of section 3 is applicable to these
480 copies of the Document, then if the Document is less than one half of
481 the entire aggregate, the Document's Cover Texts may be placed on
482 covers that bracket the Document within the aggregate, or the
483 electronic equivalent of covers if the Document is in electronic form.
484 Otherwise they must appear on printed covers that bracket the whole
489 Translation is considered a kind of modification, so you may distribute
490 translations of the Document under the terms of section 4. Replacing
491 Invariant Sections with translations requires special permission from
492 their copyright holders, but you may include translations of some or
493 all Invariant Sections in addition to the original versions of these
494 Invariant Sections. You may include a translation of this License, and
495 all the license notices in the Document, and any Warranty Disclaimers,
496 provided that you also include the original English version of this
497 License and the original versions of those notices and disclaimers. In
498 case of a disagreement between the translation and the original version
499 of this License or a notice or disclaimer, the original version will
502 If a section in the Document is Entitled "Acknowledgements",
503 "Dedications", or "History", the requirement (section 4) to Preserve
504 its Title (section 1) will typically require changing the actual title.
508 You may not copy, modify, sublicense, or distribute the Document except
509 as expressly provided under this License. Any attempt otherwise to
510 copy, modify, sublicense, or distribute it is void, and will
511 automatically terminate your rights under this License.
513 However, if you cease all violation of this License, then your license
514 from a particular copyright holder is reinstated (a) provisionally,
515 unless and until the copyright holder explicitly and finally terminates
516 your license, and (b) permanently, if the copyright holder fails to
517 notify you of the violation by some reasonable means prior to 60 days
520 Moreover, your license from a particular copyright holder is reinstated
521 permanently if the copyright holder notifies you of the violation by
522 some reasonable means, this is the first time you have received notice
523 of violation of this License (for any work) from that copyright holder,
524 and you cure the violation prior to 30 days after your receipt of the
527 Termination of your rights under this section does not terminate the
528 licenses of parties who have received copies or rights from you under
529 this License. If your rights have been terminated and not permanently
530 reinstated, receipt of a copy of some or all of the same material does
531 not give you any rights to use it.
533 10. FUTURE REVISIONS OF THIS LICENSE
535 The Free Software Foundation may publish new, revised versions of the
536 GNU Free Documentation License from time to time. Such new versions
537 will be similar in spirit to the present version, but may differ in
538 detail to address new problems or concerns. See
539 [5]http://www.gnu.org/copyleft/.
541 Each version of the License is given a distinguishing version number.
542 If the Document specifies that a particular numbered version of this
543 License "or any later version" applies to it, you have the option of
544 following the terms and conditions either of that specified version or
545 of any later version that has been published (not as a draft) by the
546 Free Software Foundation. If the Document does not specify a version
547 number of this License, you may choose any version ever published (not
548 as a draft) by the Free Software Foundation. If the Document specifies
549 that a proxy can decide which future versions of this License can be
550 used, that proxy's public statement of acceptance of a version
551 permanently authorizes you to choose that version for the Document.
555 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
556 World Wide Web server that publishes copyrightable works and also
557 provides prominent facilities for anybody to edit those works. A public
558 wiki that anybody can edit is an example of such a server. A "Massive
559 Multiauthor Collaboration" (or "MMC") contained in the site means any
560 set of copyrightable works thus published on the MMC site.
562 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
563 license published by Creative Commons Corporation, a not-for-profit
564 corporation with a principal place of business in San Francisco,
565 California, as well as future copyleft versions of that license
566 published by that same organization.
568 "Incorporate" means to publish or republish a Document, in whole or in
569 part, as part of another Document.
571 An MMC is "eligible for relicensing" if it is licensed under this
572 License, and if all works that were first published under this License
573 somewhere other than this MMC, and subsequently incorporated in whole
574 or in part into the MMC, (1) had no cover texts or invariant sections,
575 and (2) were thus incorporated prior to November 1, 2008.
577 The operator of an MMC Site may republish an MMC contained in the site
578 under CC-BY-SA on the same site at any time before August 1, 2009,
579 provided the MMC is eligible for relicensing.
583 1. http://www.gnu.org/licenses/
584 2. http://www.openchange.org/
585 3. file://localhost/webcit/display_enter?force_room=_MAIL_&recp=define_project_builder=sam@liddicott.com
587 5. http://www.gnu.org/copyleft/