1rpkg(1) rpm-packager rpkg(1)
2
3
4
6 rpkg - RPM packaging utility
7
9 rpkg [ global_options ] command [ command_options ] [ command_arguments
10 ]
11 rpkg help
12 rpkg command --help
13
15 rpkg is a script to manage spec enriched Git repositories - meaning any
16 repositories which contain an rpm spec file. It is designed to work
17 with expanded application sources as well as with standard DistGit tar‐
18 balls and patches. Note that you should trust the .spec files you work
19 with because many operations (like `rpkg srpm` or `rpkg lint`) involve
20 parsing the spec file, which brings along evaluation of any shell or
21 lua scriplets present in it.
22
23 Global Options
24 --config CONFIG, -C CONFIG
25 Specify a config file to use.
26 --module-name MODULE_NAME
27 Override the module name. Otherwise it is dis‐
28 covered
29 from: Git push URL or Git URL.
30 --user USER Override the discovered user name.
31 --path PATH Define the directory to work in (defaults to
32 cwd).
33 --verbose, -v Run with verbose debug output.
34 --debug, -d Run with debug output.
35 -q Run quietly only displaying errors.
36
38 rpkg build [-h] [--config CONFIG] [-w] [--outdir OUTDIR] [--spec SPEC]
39 [project]
40 Alias for copr-build
41
42 rpkg ci [-h] [-m MESSAGE] [--with-changelog] [-t] [-F FILE] [-p] [-s]
43 [files [files ...]]
44 Alias for commit
45
46 rpkg clean [-h] [--dry-run] [-x]
47 Remove untracked files
48
49 rpkg clog [-h] [--raw] [--outdir OUTDIR] [--spec SPEC]
50 Make a clog file containing top changelog entry
51
52 rpkg clone [-h] [--branches] [--branch BRANCH] [--anonymous] repo
53 [clone_target]
54 Clone and checkout a repository
55
56 rpkg co [-h] [--branches] [--branch BRANCH] [--anonymous] repo
57 [clone_target]
58 Alias for clone
59
60 rpkg commit [-h] [-m MESSAGE] [--with-changelog] [-t] [-F FILE] [-p]
61 [-s] [files [files ...]]
62 Commit changes
63
64 rpkg compile [-h] [--target TARGET] [--with OPTION] [--without OPTION]
65 [--short-circuit] [--nocheck] [--outdir OUTDIR] [--spec SPEC]
66 Local test rpmbuild compile
67
68 rpkg copr-build [-h] [--config CONFIG] [-w] [--outdir OUTDIR] [--spec
69 SPEC] [project]
70 Build package in Copr Build System
71
72 rpkg diff [-h] [--cached] [files [files ...]]
73 Show changes between commits, commit and working tree, etc
74
75 rpkg gimmespec [-h]
76 Print the spec file name
77
78 rpkg help [-h]
79 Show usage
80
81 rpkg import [-h] [--skip-diffs] srpm
82 Import srpm content into a module
83
84 rpkg install [-h] [--target TARGET] [--with OPTION] [--without OPTION]
85 [--short-circuit] [--nocheck] [--outdir OUTDIR] [--spec SPEC]
86 Local test rpmbuild install
87
88 rpkg is-packed [-h] [--outdir OUTDIR] [--spec SPEC]
89 Deprecated. Tell user whether content is packed
90
91 rpkg lint [-h] [--info] [--rpmlintconf RPMLINTCONF] [--outdir OUTDIR]
92 Run rpmlint against local spec and build output if present.
93
94 rpkg local [-h] [--target TARGET] [--with OPTION] [--without OPTION]
95 [--outdir OUTDIR] [--spec SPEC]
96 Local test rpmbuild binary
97
98 rpkg make-source [-h] [--outdir OUTDIR] [--spec SPEC]
99 Deprecated. Create Source0 from the content of the current work‐
100 ing directory after downloading any external sources. The con‐
101 tent must be of unpacked type.
102
103 rpkg new [-h]
104 Diff against last tag
105
106 rpkg new-sources [-h] files [files ...]
107 Upload source files
108
109 rpkg prep [-h] [--target TARGET] [--with OPTION] [--without OPTION]
110 [--outdir OUTDIR] [--spec SPEC]
111 Local test rpmbuild prep
112
113 rpkg pull [-h] [--rebase] [--no-rebase]
114 Pull changes from the remote repository and update the working
115 copy.
116
117 rpkg push [-h] [--force]
118 Push changes and annotated tags to remote repository.
119
120 rpkg sources [-h] [--outdir OUTDIR]
121 Download source files
122
123 rpkg spec [-h] [--sources] [--outdir OUTDIR] [--spec SPEC]
124 Generate spec file from a spec template
125
126 rpkg srpm [-h] [--target TARGET] [--with OPTION] [--without OPTION]
127 [--outdir OUTDIR] [--spec SPEC]
128 Create a source rpm
129
130 rpkg switch-branch [-h] [-l] [--fetch] [branch]
131 Work with branches
132
133 rpkg tag [-h] [-l] [-d] [-s] [--outdir OUTDIR] [--spec SPEC] [tag]
134 Management of git tags
135
136 rpkg unused-patches [-h] [--outdir OUTDIR] [--spec SPEC]
137 Print list of patches not referenced by name in the specfile
138
139 rpkg upload [-h] files [files ...]
140 Upload source files
141
142 rpkg verify-files [-h] [--outdir OUTDIR]
143 Locally verify %%files section
144
145 rpkg verrel [-h] [--outdir OUTDIR] [--spec SPEC]
146 Print the name-version-release
147
149 rpkg build
150 usage: rpkg build [-h] [--config CONFIG] [-w] [--outdir OUTDIR]
151 [--spec SPEC]
152 [project]
153
154 Build package in Copr Build System. You need to have copr-cli
155 installed and
156 also set up Copr api key. For more information about the api key, see
157 API KEY
158 section in copr-cli(1) man page.
159
160 positional arguments:
161 project Name of the project in format OWNER/PROJECT. If
162 not
163 specified, project will be set to module name.
164
165 optional arguments:
166 -h, --help show this help message and exit
167 --config CONFIG Path to an alternative Copr configuration file
168 -w, --wait Wait for build to finish.
169 --outdir OUTDIR Where to put any generated rpm content. Directory
170 must
171 exist.
172 --spec SPEC An input spec template. If not given, the spec
173 template is
174 auto-located in path as a file ending with
175 ".spec.rpkg" or
176 ".spec" suffix in this order.
177
178
179 rpkg ci
180 usage: rpkg ci [-h] [-m MESSAGE] [--with-changelog] [-t] [-F FILE]
181 [-p] [-s]
182 [files [files ...]]
183
184 Alias for commit.
185
186 positional arguments:
187 files Optional list of specific files to commit
188
189 optional arguments:
190 -h, --help show this help message and exit
191 -m MESSAGE, --message MESSAGE
192 Use the given <msg> as the commit message
193 summary
194 --with-changelog Get the last changelog from SPEC as commit
195 message
196 content. This option must be used with -m
197 together.
198 -t, --tag Create a tag for this commit
199 -F FILE, --file FILE Take the commit message from the given file
200 -p, --push Commit and push as one action
201 -s, --signoff Include a signed-off-by
202
203
204 rpkg clean
205 usage: rpkg clean [-h] [--dry-run] [-x]
206
207 This command can be used to clean up your working directory. By
208 default it
209 will follow .gitignore rules.
210
211 optional arguments:
212 -h, --help show this help message and exit
213 --dry-run, -n Perform a dry-run
214 -x Do not follow .gitignore rules
215
216
217 rpkg clog
218 usage: rpkg clog [-h] [--raw] [--outdir OUTDIR] [--spec SPEC]
219
220 This will create a file named "clog" that contains the latest rpm
221 changelog
222 entry. The leading "- " text will be stripped.
223
224 optional arguments:
225 -h, --help show this help message and exit
226 --raw Generate a more "raw" clog without twiddling the
227 contents
228 --outdir OUTDIR Where to put any generated rpm content. Directory
229 must
230 exist.
231 --spec SPEC An input spec template. If not given, the spec
232 template is
233 auto-located in path as a file ending with
234 ".spec.rpkg" or
235 ".spec" suffix in this order.
236
237
238 rpkg clone
239 usage: rpkg clone [-h] [--branches] [--branch BRANCH] [--anonymous]
240 repo [clone_target]
241
242 This command will clone the named repository from the configured
243 repository
244 base URL. By default it will also checkout the master branch for your
245 working
246 copy.
247
248 positional arguments:
249 repo Name of the repository to clone
250 clone_target Directory in which to clone the repository
251
252 optional arguments:
253 -h, --help show this help message and exit
254 --branches, -B Do an old style checkout with subdirs for
255 branches
256 --branch BRANCH, -b BRANCH
257 Check out a specific branch
258 --anonymous, -a Check out a module anonymously
259
260
261 rpkg co
262 usage: rpkg co [-h] [--branches] [--branch BRANCH] [--anonymous]
263 repo [clone_target]
264
265 Alias for clone.
266
267 positional arguments:
268 repo Name of the repository to clone
269 clone_target Directory in which to clone the repository
270
271 optional arguments:
272 -h, --help show this help message and exit
273 --branches, -B Do an old style checkout with subdirs for
274 branches
275 --branch BRANCH, -b BRANCH
276 Check out a specific branch
277 --anonymous, -a Check out a module anonymously
278
279
280 rpkg commit
281 usage: rpkg commit [-h] [-m MESSAGE] [--with-changelog] [-t] [-F
282 FILE] [-p]
283 [-s]
284 [files [files ...]]
285
286 This invokes a git commit. All tracked files with changes will be
287 committed
288 unless a specific file list is provided. $EDITOR will be used to gen‐
289 erate a
290 changelog message unless one is given to the command. A tag or push
291 can be
292 done at the same time.
293
294 positional arguments:
295 files Optional list of specific files to commit
296
297 optional arguments:
298 -h, --help show this help message and exit
299 -m MESSAGE, --message MESSAGE
300 Use the given <msg> as the commit message
301 summary
302 --with-changelog Get the last changelog from SPEC as commit
303 message
304 content. This option must be used with -m
305 together.
306 -t, --tag Create a tag for this commit
307 -F FILE, --file FILE Take the commit message from the given file
308 -p, --push Commit and push as one action
309 -s, --signoff Include a signed-off-by
310
311
312 rpkg compile
313 usage: rpkg compile [-h] [--target TARGET] [--with OPTION] [--without
314 OPTION]
315 [--short-circuit] [--nocheck] [--outdir OUTDIR]
316 [--spec SPEC]
317
318 This command calls rpmbuild to compile the source. By default the
319 prep and
320 configure stages will be done as well, unless the short-circuit
321 option is
322 used.
323
324 optional arguments:
325 -h, --help show this help message and exit
326 --target TARGET Prep for a specific arch or arch-vendor-os.
327 --with OPTION Enable %bcond spec OPTION. Can be specified mul‐
328 tiple
329 times.
330 --without OPTION Disable %bcond spec OPTION. Can be specified mul‐
331 tiple
332 times.
333 --short-circuit short-circuit compile
334 --nocheck nocheck compile
335 --outdir OUTDIR Where to put any generated rpm content. Directory
336 must
337 exist.
338 --spec SPEC An input spec template. If not given, the spec
339 template is
340 auto-located in path as a file ending with
341 ".spec.rpkg" or
342 ".spec" suffix in this order.
343
344
345 rpkg copr-build
346 usage: rpkg copr-build [-h] [--config CONFIG] [-w] [--outdir OUTDIR]
347 [--spec SPEC]
348 [project]
349
350 Build package in Copr Build System. You need to have copr-cli
351 installed and
352 also set up Copr api key. For more information about the api key, see
353 API KEY
354 section in copr-cli(1) man page.
355
356 positional arguments:
357 project Name of the project in format OWNER/PROJECT. If
358 not
359 specified, project will be set to module name.
360
361 optional arguments:
362 -h, --help show this help message and exit
363 --config CONFIG Path to an alternative Copr configuration file
364 -w, --wait Wait for build to finish.
365 --outdir OUTDIR Where to put any generated rpm content. Directory
366 must
367 exist.
368 --spec SPEC An input spec template. If not given, the spec
369 template is
370 auto-located in path as a file ending with
371 ".spec.rpkg" or
372 ".spec" suffix in this order.
373
374
375 rpkg diff
376 usage: rpkg diff [-h] [--cached] [files [files ...]]
377
378 Use git diff to show changes that have been made to tracked files. By
379 default
380 cached changes (changes that have been git added) will not be shown.
381
382 positional arguments:
383 files Optionally diff specific files
384
385 optional arguments:
386 -h, --help show this help message and exit
387 --cached View staged changes
388
389
390 rpkg gimmespec
391 usage: rpkg gimmespec [-h]
392
393 Print the spec file name.
394
395 optional arguments:
396 -h, --help show this help message and exit
397
398
399 rpkg help
400 usage: rpkg help [-h]
401
402 Show usage.
403
404 optional arguments:
405 -h, --help show this help message and exit
406
407
408 rpkg import
409 usage: rpkg import [-h] [--skip-diffs] srpm
410
411 This will extract sources, patches, and the spec file from an srpm
412 and update
413 the current module accordingly. It will import to the current branch
414 by
415 default.
416
417 positional arguments:
418 srpm Source rpm to import
419
420 optional arguments:
421 -h, --help show this help message and exit
422 --skip-diffs Don't show diffs when import srpms
423
424
425 rpkg install
426 usage: rpkg install [-h] [--target TARGET] [--with OPTION] [--without
427 OPTION]
428 [--short-circuit] [--nocheck] [--outdir OUTDIR]
429 [--spec SPEC]
430
431 This will call rpmbuild to run the install section. All leading sec‐
432 tions will
433 be processed as well, unless the short-circuit option is used.
434
435 optional arguments:
436 -h, --help show this help message and exit
437 --target TARGET Prep for a specific arch or arch-vendor-os.
438 --with OPTION Enable %bcond spec OPTION. Can be specified mul‐
439 tiple
440 times.
441 --without OPTION Disable %bcond spec OPTION. Can be specified mul‐
442 tiple
443 times.
444 --short-circuit short-circuit install
445 --nocheck nocheck install
446 --outdir OUTDIR Where to put any generated rpm content. Directory
447 must
448 exist.
449 --spec SPEC An input spec template. If not given, the spec
450 template is
451 auto-located in path as a file ending with
452 ".spec.rpkg" or
453 ".spec" suffix in this order.
454
455
456 rpkg is-packed
457 usage: rpkg is-packed [-h] [--outdir OUTDIR] [--spec SPEC]
458
459 Deprecated. Determine whether the package content in the working
460 directory is
461 packed or unpacked and print that information to the screen.
462
463 optional arguments:
464 -h, --help show this help message and exit
465 --outdir OUTDIR Where to put any generated rpm content. Directory
466 must
467 exist.
468 --spec SPEC An input spec template. If not given, the spec
469 template is
470 auto-located in path as a file ending with
471 ".spec.rpkg" or
472 ".spec" suffix in this order.
473
474
475 rpkg lint
476 usage: rpkg lint [-h] [--info] [--rpmlintconf RPMLINTCONF] [--outdir
477 OUTDIR]
478
479 Rpmlint can be configured using the --rpmlintconf/-r option or by
480 setting a
481 .rpmlint file in the working directory.
482
483 optional arguments:
484 -h, --help show this help message and exit
485 --info, -i Display explanations for reported messages
486 --rpmlintconf RPMLINTCONF, -r RPMLINTCONF
487 Use a specific configuration file for rpmlint
488 --outdir OUTDIR Directory with rpm items to be linted or just
489 a single
490 rpm item like a .spec file. If not specified,
491 a
492 directory from base output path will be
493 selected.
494
495
496 rpkg local
497 usage: rpkg local [-h] [--target TARGET] [--with OPTION] [--without
498 OPTION]
499 [--outdir OUTDIR] [--spec SPEC]
500
501 Locally test run of rpmbuild producing binary RPMs. The rpmbuild out‐
502 put will
503 be logged into a file named .build-%{version}-%{release}.log
504
505 optional arguments:
506 -h, --help show this help message and exit
507 --target TARGET Prep for a specific arch or arch-vendor-os.
508 --with OPTION Enable %bcond spec OPTION. Can be specified mul‐
509 tiple
510 times.
511 --without OPTION Disable %bcond spec OPTION. Can be specified mul‐
512 tiple
513 times.
514 --outdir OUTDIR Where to put any generated rpm content. Directory
515 must
516 exist.
517 --spec SPEC An input spec template. If not given, the spec
518 template is
519 auto-located in path as a file ending with
520 ".spec.rpkg" or
521 ".spec" suffix in this order.
522
523
524 rpkg make-source
525 usage: rpkg make-source [-h] [--outdir OUTDIR] [--spec SPEC]
526
527 Deprecated. Puts content of the current working directory into a
528 gzip-
529 compressed archive named according to Source0 filename as specified
530 in the
531 .spec file. The content must be of unpacked type, otherwise no action
532 is
533 taken. Unpacked content is such that it contains a .spec file that
534 references
535 no present source or patch (typically it contains only Source0 being
536 generated
537 automatically) and there is at least one file not in the list of
538 ignored
539 content (README, README.md, sources, LICENSE, tito.props, hidden
540 files, .spec
541 file). Note that by invoking this command with --outdir ./, the
542 directory
543 content becomes "packed".
544
545 optional arguments:
546 -h, --help show this help message and exit
547 --outdir OUTDIR Where to put any generated rpm content. Directory
548 must
549 exist.
550 --spec SPEC An input spec template. If not given, the spec
551 template is
552 auto-located in path as a file ending with
553 ".spec.rpkg" or
554 ".spec" suffix in this order.
555
556
557 rpkg new
558 usage: rpkg new [-h]
559
560 This will use git to show a diff of all the changes (even uncommitted
561 changes)
562 since the last git tag was applied.
563
564 optional arguments:
565 -h, --help show this help message and exit
566
567
568 rpkg new-sources
569 usage: rpkg new-sources [-h] files [files ...]
570
571 This will upload new source file(s) to lookaside cache, and all file
572 names
573 listed in sources file will be replaced. .gitignore will be also
574 updated with
575 new uploaded file(s). Please remember to commit them.
576
577 positional arguments:
578 files
579
580 optional arguments:
581 -h, --help show this help message and exit
582
583
584 rpkg prep
585 usage: rpkg prep [-h] [--target TARGET] [--with OPTION] [--without
586 OPTION]
587 [--outdir OUTDIR] [--spec SPEC]
588
589 Use rpmbuild to "prep" the sources (unpack the source archive(s) and
590 apply any
591 patches.)
592
593 optional arguments:
594 -h, --help show this help message and exit
595 --target TARGET Prep for a specific arch or arch-vendor-os.
596 --with OPTION Enable %bcond spec OPTION. Can be specified mul‐
597 tiple
598 times.
599 --without OPTION Disable %bcond spec OPTION. Can be specified mul‐
600 tiple
601 times.
602 --outdir OUTDIR Where to put any generated rpm content. Directory
603 must
604 exist.
605 --spec SPEC An input spec template. If not given, the spec
606 template is
607 auto-located in path as a file ending with
608 ".spec.rpkg" or
609 ".spec" suffix in this order.
610
611
612 rpkg pull
613 usage: rpkg pull [-h] [--rebase] [--no-rebase]
614
615 This command uses git to fetch remote changes and apply them to the
616 current
617 working copy. A rebase option is available which can be used to avoid
618 merges.
619
620 optional arguments:
621 -h, --help show this help message and exit
622 --rebase Rebase the locally committed changes on top of the
623 remote
624 changes after fetching. This can avoid a merge commit,
625 but does
626 rewrite local history.
627 --no-rebase Do not rebase, overriding .git settings to the con‐
628 trary
629
630 See git pull --help for more details
631
632
633 rpkg push
634 usage: rpkg push [-h] [--force]
635
636 Push changes and annotated tags to remote repository.
637
638 optional arguments:
639 -h, --help show this help message and exit
640 --force, -f Force push
641
642
643 rpkg sources
644 usage: rpkg sources [-h] [--outdir OUTDIR]
645
646 Download source files
647
648 optional arguments:
649 -h, --help show this help message and exit
650 --outdir OUTDIR Directory to download files into (defaults to pwd)
651
652
653 rpkg spec
654 usage: rpkg spec [-h] [--sources] [--outdir OUTDIR] [--spec SPEC]
655
656 Preprocess a given spec template and put the resulting spec file into
657 outdir.
658 The spec template is simply copied into the outdir if spec prepro‐
659 cessing is
660 turned off or if the input spec template does not contain any pre‐
661 processor
662 macros.
663
664 optional arguments:
665 -h, --help show this help message and exit
666 --sources Enable source generation by the input spec tem‐
667 plate. By
668 default disabled.
669 --outdir OUTDIR Where to put any generated rpm content. Directory
670 must
671 exist.
672 --spec SPEC An input spec template. If not given, the spec
673 template is
674 auto-located in path as a file ending with
675 ".spec.rpkg" or
676 ".spec" suffix in this order.
677
678
679 rpkg srpm
680 usage: rpkg srpm [-h] [--target TARGET] [--with OPTION] [--without
681 OPTION]
682 [--outdir OUTDIR] [--spec SPEC]
683
684 Create a source rpm
685
686 optional arguments:
687 -h, --help show this help message and exit
688 --target TARGET Prep for a specific arch or arch-vendor-os.
689 --with OPTION Enable %bcond spec OPTION. Can be specified mul‐
690 tiple
691 times.
692 --without OPTION Disable %bcond spec OPTION. Can be specified mul‐
693 tiple
694 times.
695 --outdir OUTDIR Where to put any generated rpm content. Directory
696 must
697 exist.
698 --spec SPEC An input spec template. If not given, the spec
699 template is
700 auto-located in path as a file ending with
701 ".spec.rpkg" or
702 ".spec" suffix in this order.
703
704
705 rpkg switch-branch
706 usage: rpkg switch-branch [-h] [-l] [--fetch] [branch]
707
708 This command can switch to a local git branch. If provided with a
709 remote
710 branch name that does not have a local match it will create one. It
711 can also
712 be used to list the existing local and remote branches.
713
714 positional arguments:
715 branch Branch name to switch to
716
717 optional arguments:
718 -h, --help show this help message and exit
719 -l, --list List both remote-tracking branches and local branches
720 --fetch Fetch new data from remote before switch
721
722
723 rpkg tag
724 usage: rpkg tag [-h] [-l] [-d] [-s] [--outdir OUTDIR] [--spec SPEC]
725 [tag]
726
727 This command uses git to create, list, or delete tags.
728
729 positional arguments:
730 tag Name of the tag
731
732 optional arguments:
733 -h, --help show this help message and exit
734 -l, --list List all tags with a given pattern, or all if not
735 pattern
736 is given
737 -d, --delete Delete a tag
738 -s, --skip-edit Skips changelog editing when creating a tag.
739 --outdir OUTDIR Where to put any generated rpm content. Directory
740 must
741 exist.
742 --spec SPEC An input spec template. If not given, the spec
743 template is
744 auto-located in path as a file ending with
745 ".spec.rpkg" or
746 ".spec" suffix in this order.
747
748
749 rpkg unused-patches
750 usage: rpkg unused-patches [-h] [--outdir OUTDIR] [--spec SPEC]
751
752 Print list of patches not referenced by name in the specfile.
753
754 optional arguments:
755 -h, --help show this help message and exit
756 --outdir OUTDIR Where to put any generated rpm content. Directory
757 must
758 exist.
759 --spec SPEC An input spec template. If not given, the spec
760 template is
761 auto-located in path as a file ending with
762 ".spec.rpkg" or
763 ".spec" suffix in this order.
764
765
766 rpkg upload
767 usage: rpkg upload [-h] files [files ...]
768
769 This command will upload new source file(s) to lookaside cache.
770 Source file
771 names are appended to sources file, and .gitignore will be also
772 updated with
773 new uploaded file(s). Please remember to commit them.
774
775 positional arguments:
776 files
777
778 optional arguments:
779 -h, --help show this help message and exit
780
781
782 rpkg verify-files
783 usage: rpkg verify-files [-h] [--outdir OUTDIR]
784
785 Locally run 'rpmbuild -bl' to verify the spec file's %files sections.
786 This
787 requires a successful run of 'rpkg install' in advance.
788
789 optional arguments:
790 -h, --help show this help message and exit
791 --outdir OUTDIR Output directory with build results.
792
793
794 rpkg verrel
795 usage: rpkg verrel [-h] [--outdir OUTDIR] [--spec SPEC]
796
797 Print the name-version-release.
798
799 optional arguments:
800 -h, --help show this help message and exit
801 --outdir OUTDIR Where to put any generated rpm content. Directory
802 must
803 exist.
804 --spec SPEC An input spec template. If not given, the spec
805 template is
806 auto-located in path as a file ending with
807 ".spec.rpkg" or
808 ".spec" suffix in this order.
809
810
812 rpkg reads configuration options from the following files in this
813 order:
814
815 /etc/rpkg.conf, ~/.config/rpkg.conf, <gitroot>/rpkg.conf,
816 ./rpkg.conf
817
818 Configuration found in ./rpkg.conf has the highest priority. Configura‐
819 tion in /etc/rpkg.conf has the lowest priority. <gitroot> placeholder
820 above means the top level of the Git repository we are working in. If
821 we are in a plain directory and all our parent directories are also
822 plain, reading of <gitroot>/rpkg.conf is simply skipped.
823
824
825 DEFAULT COMMENTED CONFIGURATION
826 [rpkg]
827 # whether to enable spec preprocessing,
828 # that is parsing and evaluation of {{{ ... }}} expressions
829 preprocess_spec = True
830
831 # generate tarball from sources named
832 # according to Source0 definition in
833 # a spec file. Used by `rpkg srpm`.
834 # Deprecated by spec templates.
835 auto_pack = False
836
837 # base directory where results should be stored
838 base_output_path = /tmp/rpkg
839
840 # sets permanent value for --module-name option
841 # for each executed rpkg command
842 # module_name = @group/project
843
844 [git]
845 # download URL for DistGit lookaside cache, used by `rpkg sources`
846 command
847 # %(ns1)s, %(pkg)s are parts of a module name (e.g. rpms/rpkg-util)
848 # %(filename)s, %(hashtype)s, %(hash)s, %(filename)s fields are
849 read from 'sources' file if present
850 lookaside = https://src.fedorapro‐
851 ject.org/repo/pkgs/%(ns1)s/%(pkg)s/%(file‐
852 name)s/%(hashtype)s/%(hash)s/%(filename)s
853
854 # upload URL for DistGit lookaside cache, used by `rpkg upload`
855 lookaside_cgi = https://src.fedoraproject.org/repo/pkgs/upload.cgi
856
857 # default Git repository URL, used by `rpkg clone <module>`
858 gitbaseurl = ssh://%(user)s@pkgs.fedoraproject.org/%(module)s
859
860 # default anonymous Git repository URL, used by `rpkg clone -a
861 <module>`
862 anongiturl = https://src.fedoraproject.org/%(module)s
863
864
866 Run %prep phase of an rpm build:
867
868 $ rpkg prep
869 git_pack: packing directory /home/clime/rpkg-util
870 git_pack: Wrote: /tmp/rpkg/rpkg-util-1-j8x35rb3/rpkg-
871 util-2.2.git.18.5b6a884.tar.gz
872 Wrote: /tmp/rpkg/rpkg-util-1-j8x35rb3/rpkg-util.spec
873 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.vE42SH
874 + umask 022
875 + cd /tmp/rpkg/rpkg-util-1-j8x35rb3
876 + cd /tmp/rpkg/rpkg-util-1-j8x35rb3
877 + rm -rf rpkg-util-2.2.git.18.5b6a884
878 + /usr/bin/gzip -dc /tmp/rpkg/rpkg-util-1-j8x35rb3/rpkg-
879 util-2.2.git.18.5b6a884.tar.gz
880 + /usr/bin/tar -xof -
881 + STATUS=0
882 + '[' 0 -ne 0 ']'
883 + cd rpkg-util-2.2.git.18.5b6a884
884 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
885 + exit 0
886
887 For the following command, you need to have a project in COPR created.
888 See quick tutorial at
889
890 https://docs.pagure.org/copr.copr/user_documentation.html#quick-start
891
892 on how to do it.
893
894 $ rpkg build
895 git_pack: packing directory /home/clime/rpkg-util
896 git_pack: Wrote: /tmp/rpkg/rpkg-util-2-ab6awb8y/rpkg-
897 util-2.2.git.18.0cb6974.tar.gz
898 Wrote: /tmp/rpkg/rpkg-util-2-ab6awb8y/rpkg-util.spec
899 Wrote: /tmp/rpkg/rpkg-util-2-ab6awb8y/rpkg-
900 util-2.2.git.18.0cb6974-1.fc28.src.rpm
901 Uploading package /tmp/rpkg/rpkg-util-2-ab6awb8y/rpkg-
902 util-2.2.git.18.0cb6974-1.fc28.src.rpm
903 100% |################################| 122kB 359kB/s eta 0:00:00
904 Build was added to rpkg-util:
905 https://copr.fedorainfracloud.org/coprs/build/782327/
906 Created builds: 782327
907
908 Here you can see a simple operation of generation spec file from a tem‐
909 plate:
910
911 $ rpkg spec
912 Wrote: /tmp/rpkg/rpkg-util-3-1u34plfx/rpkg-util.spec
913
914
916 Apart from being useful as a means to handle unpacked as well as packed
917 content, they also make it possible to generate certain parts of your
918 spec file automatically from a Git repository where your spec file is
919 located. You need to have "spec_preprocess" configuration option set to
920 True in rpkg config to use this functionality.
921
922
923 BASIC EXAMPLE
924 Name: {{{ git_name }}}
925 Version: {{{ git_version }}}
926 Release: 1%{?dist}
927 Summary: This is a test package.
928
929 License: GPLv2+
930 URL: https://someurl.org
931 VCS: {{{ git_vcs }}}
932
933 Source: {{{ git_pack }}}
934
935 %description
936 This is a test package.
937
938 %prep
939 {{{ git_setup_macro }}}
940
941 %changelog
942 {{{ git_changelog }}}
943
944 Having a spec template like this in your project (instead of just a
945 plain spec file) allows you to build source and rpm packages automati‐
946 cally following git history of your project.
947
948
949 MACRO REFERENCE
950 BASE GIT MACROS
951
952 Without any parameters, these macros work on repository level
953 and use globally available repository information.
954
955 NOTE: If your local repository is not properly initialized or
956 if, for example, the .git metadata directory in your local tree
957 has been renamed or removed, operation of the base macros can
958 get out of the intended scope. It is therefore recommended to
959 use more specific git_dir_* macros where possible, which are
960 always bound to the directory where the input spec file is
961 located. This is mainly relevant for git_pack and git_archive
962 macros (see below).
963
964 Output of every git macro call is cached and other macros are
965 made to take those cached values into account by default. You
966 can see that a macro uses a cached value as a default input
967 parameter value by looking at its function header definition and
968 searching for the `cached` keyword.
969
970 E.g.
971
972 git_version [name="$(cached git_name)"] [lead=0] [follow=]
973
974 Default value for name in this definition is derived from the
975 cached output of the previously invoked `git_name` macro. If
976 `git_name` macro has not been invoked or if its output was an
977 empty string, the default value for the `name=` parameter above
978 will be also an empty string.
979
980 Note that $(cached_git_name_version) in the function header def‐
981 initions below is an alias for "$(cached git_name)-$(cached
982 git_version)".
983
984 git_name [name=] [prepend=] [append=]
985
986 Without any parameters, lookup remote URL for the currently
987 active branch and output its basename with .git suffix stripped.
988 If the remote URL could not be determined, use "origin" remote
989 URL instead.
990
991 Optional arguments:
992 name the base name to be output
993 prepend string to be prepended to the base name
994 append string to be appended to the base name
995
996 git_version [name="$(cached git_name)"] [lead=0] [follow=]
997
998 Output version of a subpackage given by ${name}. The version is
999 a string constructed of the following parts:
1000
1001 "${lead}.${follow}${commit_count_appendix}${wtree_appendix}"
1002
1003 ${lead} is a mandatory argument of the macro. By default it is
1004 set to zero.
1005
1006 ${follow} (if not specified) is obtained from the follow part of
1007 the latest tag made for the subpackage given by ${name}.
1008
1009 ${commit_count_appendix} is generated only if the current commit
1010 is not tagged for the given subpackage and it is composed of the
1011 following parts
1012
1013 .git.<commit_count>.<latest_commit_short_hash>
1014
1015 Commit count is a number of commits from the latest tag on the
1016 given subpackage.
1017
1018 ${wtree_appendix} is generated only if the currently checked out
1019 working tree is dirty. It is composed of the following parts:
1020
1021 .wtree.<encoded_latest_file_status_change>
1022
1023 Optional arguments:
1024 name name of a subpackage
1025 lead major version substring
1026 follow minor version substring, dynamically generated
1027 if not specified
1028
1029 Environment variables:
1030 VERSION_BUMP: if set to a non-empty value, the following
1031 procedure is applied
1032 to get the version string:
1033
1034 If $follow is specified by user explicitly, return
1035 $lead.$follow.
1036
1037 Otherwise, extract $follow from the latest tag as the
1038 last version component (after the last dot)
1039 and return $lead.$follow+1. If $follow is not a number,
1040 throw an error (manual setting of follow
1041 is needed).
1042
1043 rpkg sets the VERSION_BUMP variable into the preprocess‐
1044 ing environment during
1045 execution of `rpkg tag` subcommand. Otherwise, it is
1046 unset.
1047
1048 git_vcs [subtree=]
1049
1050 Output pseudo repository URL pointing the currently checked out
1051 tree.
1052
1053 Example output: git+ssh://git@pagure.io/test-
1054 project.git#dadef2a8b9554e94797a7336261192e02d5d9351:
1055
1056 Optional arguments:
1057 subtree path to a subtree to generate the URL for
1058
1059 git_pack [path="$(git rev-parse --show-toplevel)"]
1060 [dir_name="$(cached_git_name_version)"]
1061 [source_name="$(cached_git_name_version).tar.gz"]
1062
1063 Pack the whole working tree content (including untracked con‐
1064 tent) into a gzipped source tarball and output $source_name,
1065 which is a filename of the created tarball. Uses GNU tar to do
1066 the job. Files ignored by git as well as .git metadata directory
1067 will be excluded from the resulting tarball.
1068
1069 Optional arguments:
1070 path path to a specific subdirectory to be
1071 packed
1072 dir_name top-level directory name in the created
1073 tarball
1074 source_name filename of the created source tarball
1075
1076 Enviroment variables:
1077 OUTDIR: if empty, git_pack will not generate any
1078 sources, only the source filename will be output
1079
1080 rpkg sets OUTDIR, only if the tarball is actually needed
1081 to be generated. It does not set it
1082 when `rpkg spec` is called (without any additional argu‐
1083 ments).
1084
1085 git_archive [path="$(git rev-parse --show-toplevel)"]
1086 [dir_name="$(cached_git_name_version)"]
1087 [source_name="$(cached_git_name_version).tar.gz"]
1088
1089 Pack the latest commit tree content into a gzipped source tar‐
1090 ball and output $source_name, which is a filename of the created
1091 tarball. Uses `git archive` to do the job. Note that this macro
1092 will refuse to generate a tarball if your working tree is dirty.
1093
1094 Optional arguments:
1095 path path to a specific subdirectory to be
1096 packed
1097 dir_name top-level directory name in the created
1098 tarball
1099 source_name filename of the created source tarball
1100
1101 Enviroment variables:
1102 OUTDIR: if empty, git_archive will not generate any
1103 sources, only the source filename will be output
1104
1105 rpkg sets OUTDIR, only if the tarball is actually needed
1106 to be generated. It does not set it
1107 when `rpkg spec` is called (without any additional argu‐
1108 ments).
1109
1110 git_setup_macro [dir_name="$(cached_git_name_version)"]
1111
1112 Output %setup rpm macro for the given top-level source-tarball
1113 directory.
1114
1115 Optional arguments:
1116 dir_name name of the top-level directory in the
1117 source-tarball
1118
1119 git_changelog [name="$(cached git_name)"] [since_tag=]
1120 [until_tag=] [header_locale=POSIX] [header_date_format="%a %b %d
1121 %Y"] [body_wrap=80]
1122
1123 Output rpm spec changelog as generated from tag messages for the
1124 subpackage given by ${name}.
1125
1126 Optional arguments:
1127 name name of the subpackage to generate
1128 the changelog for
1129 since_tag start the changelog records with
1130 this tag
1131 until_tag end the changelog records with this
1132 tag
1133 header_locale locale to be used when changelog
1134 record date is being generated
1135 header_date_format date format to be used in the
1136 changelog record headers
1137 body_wrap maximum allowed line length for
1138 changelog body
1139
1140 When `rpkg tag` is called, it allows you to specify a tag mes‐
1141 sage. This is the message that will be used as a changelog
1142 record body.
1143
1144
1145
1146 GIT_DIR MACROS
1147
1148 These macros operate on a directory level. In particular, on a
1149 directory where the input spec file template is located. They
1150 are basically aliases to the GIT BASE MACROS with some input
1151 values set specifically for the directory-level operation. The
1152 input spec template location is given by INPUT_PATH environment
1153 variable set by rpkg. You can influence it from the command line
1154 by explicitly specifying --spec <template_path> argument for
1155 rpkg subcommands that support it.
1156
1157 Below you can see to what the GIT DIR macros expand. In some
1158 cases, the macro is a direct alias to the underlying git base
1159 macro.
1160
1161 git_dir_name
1162
1163 git_name append="-$(git -C "$(dirname "$INPUT_PATH")" rev-
1164 parse --show-prefix | path_to_name_suffix)"
1165
1166 Outputs repository origin URL basename appended with the
1167 path (after slash to dash substitution) from the repository
1168 root to the spec file's directory.
1169
1170 git_dir_version
1171
1172 git_version
1173
1174 git_dir_vcs
1175
1176 git_vcs subtree="$(git -C "$(dirname "$INPUT_PATH")" rev-
1177 parse --show-prefix)"
1178
1179 Outputs VCS pseudo URL pointing to the spec file's subdirec‐
1180 tory.
1181
1182 git_dir_pack
1183
1184 git_pack path="$(dirname "$INPUT_PATH")"
1185
1186 Packs spec file's subdirectory by using GNU tar.
1187
1188 git_dir_archive
1189
1190 git_archive path="$(dirname "$INPUT_PATH")"
1191
1192 Packs spec file's subdirectory by using `git archive`.
1193
1194 git_dir_setup_macro
1195
1196 git_setup_macro
1197
1198 git_dir_changelog
1199
1200 git_changelog
1201
1202
1203
1204 GIT_CWD MACROS
1205
1206 These macros operate on a directory level. In particular, on a
1207 rpkg's working directory. Again, they are aliases to the GIT
1208 BASE MACROS with some input values set specifically for the
1209 directory-level operation.
1210
1211 You can influence the rpkg's working dir from the command line
1212 by explicitly specifying its --path argument.
1213
1214 Below you can see to what the GIT_CWD macros expand. In some
1215 cases, the macro is a direct alias for the underlying git base
1216 macro.
1217
1218 git_cwd_name
1219
1220 git_name append="-$(git -C "$(pwd)" rev-parse --show-prefix
1221 | path_to_name_suffix)"
1222
1223 Outputs repository origin URL basename appended with the
1224 rpkg's working directory path (after slash to dash substitu‐
1225 tion).
1226
1227 git_cwd_version
1228
1229 git_version
1230
1231 git_cwd_vcs
1232
1233 git_vcs subtree="$(git -C "$(pwd)" rev-parse --show-prefix)"
1234
1235 Outputs VCS pseudo URL pointing to the rpkg's working direc‐
1236 tory.
1237
1238 git_cwd_pack
1239
1240 git_pack path="$(pwd)"
1241
1242 Packs rpkg's working directory by using GNU tar.
1243
1244 git_cwd_archive
1245
1246 git_archive path="$(pwd)"
1247
1248 Packs rpkg's working directory by using `git archive`.
1249
1250 git_cwd_setup_macro
1251
1252 git_setup_macro
1253
1254 git_cwd_changelog
1255
1256 git_changelog
1257
1258
1260 You can define your own rpkg macros that are basically just standard
1261 bash functions read from rpkg.macros file placed in an rpkg's working
1262 directory. Standard output of your custom macro will be captured and
1263 the {{{ <macro_name> }}} invocation in an input spec file will be
1264 replaced with it.
1265
1266 Example of a custom macro placed in rpkg.macros file:
1267
1268 function git_commits_no {
1269 total_commits="$(git rev-list --all --count)"
1270 echo -n "$total_commits"
1271 }
1272
1273
1275 Auto-packing works only if auto_pack configuration option is set to
1276 True and only if the content you are working with is not packed (see
1277 `rpkg is-packed`).
1278
1279 When invoking `rpkg srpm` on an unpacked content, rpkg will download
1280 external sources (if any) and then it will generate a tarball from the
1281 whole content of the working directory named according to Source0 defi‐
1282 nition present in the associated .spec file. This tarball and the
1283 .spec file are then passed to rpmbuild to generate the resulting srpm.
1284
1285
1287 NOTE: This article relates to deprecated auto_pack feature.
1288
1289 While it is quite intuitive what is packed content (.spec + tarballs +
1290 patches) and what is unpacked content (.spec + original application
1291 source files), it might be useful to know how exactly rpkg differenti‐
1292 ates between these two. You can go through the following examples to
1293 get overview how this tool exactly works.
1294
1295
1296 PACKED CONTENT:
1297 $ cd source0-present-example
1298 $ grep -E '(Source|Patch)' testpkg.spec
1299 Source0: foo.tar.gz
1300 $ ls .
1301 foo.tar.gz testpkg.spec
1302 $ rpkg make-source
1303 Could not execute make_source: Not an unpacked content.
1304 $ rpkg srpm
1305 Failed to get module name from Git url or pushurl.
1306 Wrote: source0-present-example/testpkg-1-1.fc25.src.rpm
1307
1308 The error about module name is caused by running `rpkg`
1309 on a plain directory content and not a Git repo. In this
1310 case, module name is read out from the spec file. The
1311 error about not being able to make source is expected for
1312 packed content (tarballs to be put into srpm are expected
1313 to be present already).
1314
1315 $ cd only-ignored-files-example
1316 $ grep -E '(Source|Patch)' testpkg.spec
1317 Source0: https://example.org/foo.tar.gz
1318 $ ls .
1319 README.md testpkg.spec
1320 $ rpkg make-source
1321 Could not execute make_source: Not an unpacked content.
1322 $ echo '%_disable_source_fetch 0' >> ~/.rpmmacros
1323 $ rpkg srpm
1324 Failed to get module name from Git url or pushurl
1325 warning: Downloading https://example.org/foo.tar.gz to only-
1326 ignored-files-example/foo.tar.gz
1327 Wrote: only-ignored-files-example/testpkg-1-1.fc25.src.rpm
1328
1329 In this example, sources are downloaded from network when
1330 srpm is being built. The %_disable_source_fetch rpm macro
1331 must be set to 0 and the tarball url must be valid for this
1332 to work. The content is recognized as packed because there
1333 are only ignored files in the directory (.spec and readmes).
1334
1335
1336 UNPACKED CONTENT:
1337 $ cd cpp-source-file-present-example
1338 $ git init .
1339 $ git remote add origin https://github.com/testpkg.git
1340 $ grep -E '(Source|Patch)' testpkg.spec
1341 Source0: foo.tar.gz
1342 $ ls .
1343 main.cpp testpkg.spec
1344 $ rpkg make-source
1345 Wrote: cpp-source-file-present-example/foo.tar.gz
1346 $ rpkg srpm
1347 Wrote: cpp-source-file-present-example/testpkg-1-1.fc25.src.rpm
1348
1349 foo.tar.gz (the only Source referenced from the .spec file) is
1350 not present and there is unignored main.cpp file that makes the
1351 content recognized as unpacked. When `rpkg make-source` is invoked,
1352 foo.tar.gz is created and will contain the main.cpp file (as
1353 well as the .spec metadata file but that is just because the
1354 whole content directory is packed). Note that the error about
1355 failing to get module name from Git url disappeared because
1356 we have run `git init .` and `git remote add ...`.
1357
1358
1360 https://pagure.io/rpkg-util/
1361
1362
1363
1364 2019-03-11 rpkg(1)