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
25 rpkg add [-h] [--all] [paths ...]
26 Add changes to index
27
28 rpkg build [-h] [--outdir OUTDIR] [--spec SPEC] [--config CONFIG]
29 [--wait] [project]
30 Alias for copr-build
31
32 rpkg ci [-h] [--message MESSAGE | --file FILE] [--all] [--amend]
33 [--with-changelog] [--tag] [--push] [--signoff] [file ...]
34 Alias for commit
35
36 rpkg clean [-h] [--dry-run] [-x] [--force] [-d]
37 Remove untracked files
38
39 rpkg clog [-h] [--raw]
40 Output top changelog entry to stdout
41
42 rpkg clone [-h] [--branches] [--branch BRANCH] [--anonymous] repo_path
43 [directory]
44 Clone and checkout a repository
45
46 rpkg commit [-h] [--message MESSAGE | --file FILE] [--all] [--amend]
47 [--with-changelog] [--tag] [--push] [--signoff] [file ...]
48 Commit changes
49
50 rpkg compile [-h] [--target TARGET] [--with OPTION] [--without OPTION]
51 [--outdir OUTDIR] [--spec SPEC] [--short-circuit SHORT_CIRCUIT]
52 [--nocheck]
53 Local test rpmbuild compile
54
55 rpkg config [-h]
56 Do nothing, only output used config
57
58 rpkg copr-build [-h] [--outdir OUTDIR] [--spec SPEC] [--config CONFIG]
59 [--wait] [project]
60 Build package in Copr build system
61
62 rpkg diff [-h] [--cached] [file ...]
63 Show changes between the last commit and working tree, etc.
64
65 rpkg gimmespec [-h]
66 Print auto-located input spec file name
67
68 rpkg import [-h] [--repo-path REPO_PATH] [--skip-diffs] [--offline]
69 srpm
70 Import srpm content
71
72 rpkg install [-h] [--target TARGET] [--with OPTION] [--without OPTION]
73 [--outdir OUTDIR] [--spec SPEC] [--short-circuit SHORT_CIRCUIT]
74 [--nocheck]
75 Local test rpmbuild install
76
77 rpkg lint [-h] [--info] [--rpmlint-config RPMLINT_CONFIG] [target_path]
78 Run rpmlint against rendered spec and build products if present.
79 Needs rpmlint to be installed.
80
81 rpkg local [-h] [--target TARGET] [--with OPTION] [--without OPTION]
82 [--outdir OUTDIR] [--spec SPEC] [--nocheck]
83 Local test rpmbuild binary
84
85 rpkg log [-h] [--graph] [--all] [--show-signature] [revision ...] [path
86 ...]
87 Display git log history
88
89 rpkg merge [-h] [--no-commit] [--squash] [--message MESSAGE] [--file
90 FILE] [--signoff] [--abort] [--continue] [commit ...]
91 Incorporates changes from the named commits into the current
92 branch
93
94 rpkg new [-h] [--outdir OUTDIR] [--spec SPEC]
95 Diff against last package tag
96
97 rpkg nvr [-h] [--outdir OUTDIR] [--spec SPEC]
98 Print package name-version-release
99
100 rpkg prep [-h] [--target TARGET] [--with OPTION] [--without OPTION]
101 [--outdir OUTDIR] [--spec SPEC]
102 Prep test rpmbuild binary
103
104 rpkg pull [-h] [--rebase] [--no-rebase]
105 Pull changes from the remote repository and update the working
106 copy
107
108 rpkg push [-h] [--follow-tags] [--force]
109 Push changes and annotated tags to remote repository
110
111 rpkg reset [-h] [--soft | --mixed | --hard] [commit|path]
112 Reset branch tip, index, or the working tree
113
114 rpkg sources [-h] [--repo-path REPO_PATH] [--outdir OUTDIR]
115 Download source files from lookaside cache
116
117 rpkg spec [-h] [--outdir OUTDIR] [--spec SPEC] [--sources] [--print]
118 Generate spec file from a spec template
119
120 rpkg srpm [-h] [--target TARGET] [--with OPTION] [--without OPTION]
121 [--outdir OUTDIR] [--spec SPEC]
122 Create a source rpm
123
124 rpkg status [-h] [pathspec ...]
125 Display git status of the current working tree and index
126
127 rpkg switch [-h] [--create] [--detach] [--list-branches] [--fetch]
128 [target]
129 Work with branches
130
131 rpkg tag [-h] [--list] [--delete] [--skip-edit] [--name NAME] [--ver‐
132 sion VERSION] [--release RELEASE] [tag]
133 Manage git tags
134
135 rpkg unused-patches [-h]
136 Print list of patches in CWD not referenced by name in the spec‐
137 file
138
139 rpkg upload [-h] [--repo-path REPO_PATH] [--offline] file [file ...]
140 Upload source files
141
142 rpkg verify-files [-h] [target_dir]
143 Locally verify %%files section
144
146 rpkg add
147 usage: rpkg add [-h] [--all] [paths ...]
148
149 This command updates the index with changes found in the working
150 tree.
151
152 positional arguments:
153 paths Specific paths to add changes for.
154
155 options:
156 -h, --help show this help message and exit
157 --all, -A Update index with all changes found in the working
158 tree.
159
160
161 rpkg build
162 usage: rpkg build [-h] [--outdir OUTDIR] [--spec SPEC] [--config CON‐
163 FIG]
164 [--wait]
165 [project]
166
167 Build package in Copr build system. You need to have copr-cli in‐
168 stalled and
169 also set up Copr API key. For more information about the API key, see
170 API KEY
171 section in copr-cli(1) man page. NOTE: This method of building the
172 package
173 does not support with, without, and rpmdefines rpkg configuration op‐
174 tions.
175 These options are used to build an srpm which is then sent to Copr
176 but rpm
177 build in Copr happens without these options already, which is impor‐
178 tant for
179 the resulting build. If you want these options applied, you should
180 rather
181 setup auto-rebuilding in Copr that will react to new pushes into your
182 repository.
183
184 positional arguments:
185 project Name of the project in format OWNER/PROJECT. You
186 can omit
187 it if you have specified copr_project configura‐
188 tion option.
189
190 options:
191 -h, --help show this help message and exit
192 --outdir OUTDIR Where to put any generated rpm content. Directory
193 must
194 exist.
195 --spec SPEC An input spec template. If not given, the spec
196 template is
197 auto-located in <path> as a file ending either
198 with
199 ".spec.rpkg" or ".spec" suffix (in this order).
200 The
201 directory of the template then also becomes search
202 location
203 for the associated sources and rpkg.conf file. By
204 default,
205 these files are being looked up in <path>. Essen‐
206 tially,
207 this argument changes the subpackage we work with
208 and which
209 is determined by the --path argument initially
210 (with CWD as
211 the default value for it).
212 --config CONFIG Path to an alternative Copr configuration file
213 --wait, -w Wait for build to finish.
214
215
216 rpkg ci
217 usage: rpkg ci [-h] [--message MESSAGE | --file FILE] [--all]
218 [--amend]
219 [--with-changelog] [--tag] [--push] [--signoff]
220 [file ...]
221
222 Alias for commit.
223
224 positional arguments:
225 file Optional list of specific files to commit
226
227 options:
228 -h, --help show this help message and exit
229 --message MESSAGE, -m MESSAGE
230 Use the given <msg> as the commit message
231 summary
232 --file FILE, -F FILE Take the commit message from the given file
233 --all, -a Tell the command to automatically stage files
234 that
235 have been modified or deleted.
236 --amend Replace the tip of the current branch by cre‐
237 ating a
238 new commit.
239 --with-changelog Get the last changelog from SPEC as commit
240 message
241 content. This option must be used with -m to‐
242 gether.
243 --tag, -t Create a tag for this commit
244 --push, -p Commit and push as one action
245 --signoff, -s Include a signed-off-by
246
247
248 rpkg clean
249 usage: rpkg clean [-h] [--dry-run] [-x] [--force] [-d]
250
251 This command can be used to clean up your work tree from untracked
252 files and,
253 files described by .gitignore additionally if -x option is passed.
254
255 options:
256 -h, --help show this help message and exit
257 --dry-run, -n Don't actually remove anything, just show what would
258 be done.
259 -x Don't exclude files described by .gitignore rules
260 from
261 deletion.
262 --force, -f This option is required to perform deletion of any
263 files or
264 directories if git configuration variable clean.re‐
265 quireForce
266 is set to true. It is passed by default if rpkg con‐
267 figuration
268 variable git.clean_force is set to true.
269 -d Remove whole directories in addition to files. This
270 option is
271 passed by default if rpkg configuration variable
272 git.clean_dirs is set to true.
273
274
275 rpkg clog
276 usage: rpkg clog [-h] [--raw]
277
278 This will output the latest rpm changelog entry to stdout. The lead‐
279 ing "- "
280 text will be stripped.
281
282 options:
283 -h, --help show this help message and exit
284 --raw Generate a more "raw" clog without twiddling the con‐
285 tents
286
287
288 rpkg clone
289 usage: rpkg clone [-h] [--branches] [--branch BRANCH] [--anonymous]
290 repo_path [directory]
291
292 This command will clone the named repository from the configured
293 repository
294 base URL. By default it will also checkout the master branch for your
295 working
296 copy.
297
298 positional arguments:
299 repo_path Name of the repository to clone or full clone
300 url. If
301 just a basename is specified, preconfigured
302 git clone
303 urls and default namespace is used to con‐
304 struct the
305 final clone url.
306 directory Directory in which to clone the repository
307
308 options:
309 -h, --help show this help message and exit
310 --branches, -B Checkout a subdirectory for each branch
311 --branch BRANCH, -b BRANCH
312 Check out a specific branch. This has no ef‐
313 fect if
314 --branches/-B is specified.
315 --anonymous, -a Check out a repository anonymously
316
317
318 rpkg commit
319 usage: rpkg commit [-h] [--message MESSAGE | --file FILE] [--all]
320 [--amend]
321 [--with-changelog] [--tag] [--push] [--signoff]
322 [file ...]
323
324 This invokes a git commit. All tracked files with changes will be
325 committed
326 unless a specific file list is provided. $EDITOR will be used to gen‐
327 erate a
328 changelog message unless one is given to the command. A tag or push
329 can be
330 done at the same time. If you have set git.gpg_keyid rpkg configura‐
331 tion
332 option, commit and tag will be created signed with the configured GPG
333 key.
334
335 positional arguments:
336 file Optional list of specific files to commit
337
338 options:
339 -h, --help show this help message and exit
340 --message MESSAGE, -m MESSAGE
341 Use the given <msg> as the commit message
342 summary
343 --file FILE, -F FILE Take the commit message from the given file
344 --all, -a Tell the command to automatically stage files
345 that
346 have been modified or deleted.
347 --amend Replace the tip of the current branch by cre‐
348 ating a
349 new commit.
350 --with-changelog Get the last changelog from SPEC as commit
351 message
352 content. This option must be used with -m to‐
353 gether.
354 --tag, -t Create a tag for this commit
355 --push, -p Commit and push as one action
356 --signoff, -s Include a signed-off-by
357
358
359 rpkg compile
360 usage: rpkg compile [-h] [--target TARGET] [--with OPTION] [--without
361 OPTION]
362 [--outdir OUTDIR] [--spec SPEC]
363 [--short-circuit SHORT_CIRCUIT] [--nocheck]
364
365 This command calls rpmbuild to compile the source. By default the
366 prep and
367 configure stages will be done as well, unless the short-circuit op‐
368 tion is
369 used.
370
371 options:
372 -h, --help show this help message and exit
373 --target TARGET Prep for a specific arch or arch-vendor-os.
374 --with OPTION Enable %bcond spec OPTION. Can be specified
375 multiple
376 times.
377 --without OPTION Disable %bcond spec OPTION. Can be specified
378 multiple
379 times.
380 --outdir OUTDIR Where to put any generated rpm content. Di‐
381 rectory must
382 exist.
383 --spec SPEC An input spec template. If not given, the
384 spec
385 template is auto-located in <path> as a file
386 ending
387 either with ".spec.rpkg" or ".spec" suffix
388 (in this
389 order). The directory of the template then
390 also
391 becomes search location for the associated
392 sources and
393 rpkg.conf file. By default, these files are
394 being
395 looked up in <path>. Essentially, this argu‐
396 ment
397 changes the subpackage we work with and which
398 is
399 determined by the --path argument initially
400 (with CWD
401 as the default value for it).
402 --short-circuit SHORT_CIRCUIT
403 short-circuit compile
404 --nocheck nocheck compile
405
406
407 rpkg config
408 usage: rpkg config [-h]
409
410 Do nothing, only output used config.
411
412 options:
413 -h, --help show this help message and exit
414
415
416 rpkg copr-build
417 usage: rpkg copr-build [-h] [--outdir OUTDIR] [--spec SPEC] [--config
418 CONFIG]
419 [--wait]
420 [project]
421
422 Build package in Copr build system.
423
424 You need to have copr-cli installed and also set up Copr API
425 key.
426 For more information about the API key, see API KEY section
427 in
428 copr-cli(1) man page.
429
430 NOTE: This method of building the package does not support
431 with, without, and rpmdefines rpkg configuration options.
432 These options are used to build an srpm which is then
433 sent to Copr but rpm build in Copr happens without
434 these options already, which is important for the
435 resulting build. If you want these options applied,
436 you should rather setup auto-rebuilding in Copr
437 that will react to new pushes into your repository.
438
439
440 positional arguments:
441 project Name of the project in format OWNER/PROJECT. You
442 can omit
443 it if you have specified copr_project configura‐
444 tion option.
445
446 options:
447 -h, --help show this help message and exit
448 --outdir OUTDIR Where to put any generated rpm content. Directory
449 must
450 exist.
451 --spec SPEC An input spec template. If not given, the spec
452 template is
453 auto-located in <path> as a file ending either
454 with
455 ".spec.rpkg" or ".spec" suffix (in this order).
456 The
457 directory of the template then also becomes search
458 location
459 for the associated sources and rpkg.conf file. By
460 default,
461 these files are being looked up in <path>. Essen‐
462 tially,
463 this argument changes the subpackage we work with
464 and which
465 is determined by the --path argument initially
466 (with CWD as
467 the default value for it).
468 --config CONFIG Path to an alternative Copr configuration file
469 --wait, -w Wait for build to finish.
470
471
472 rpkg diff
473 usage: rpkg diff [-h] [--cached] [file ...]
474
475 Use git diff to show changes that have been made to tracked files. By
476 default
477 cached changes (changes that have been git added) will not be shown.
478
479 positional arguments:
480 file Optionally diff specific files
481
482 options:
483 -h, --help show this help message and exit
484 --cached View staged changes
485
486
487 rpkg gimmespec
488 usage: rpkg gimmespec [-h]
489
490 Print auto-located input spec file name
491
492 options:
493 -h, --help show this help message and exit
494
495
496 rpkg import
497 usage: rpkg import [-h] [--repo-path REPO_PATH] [--skip-diffs]
498 [--offline]
499 srpm
500
501 This will extract sources, patches, and the spec file from an srpm
502 and
503 overwrites the current package content accordingly. It will import to
504 the
505 current branch by default. Newly discovered sources will be uploaded
506 and
507 .gitignore and sources file updated accordingly.
508
509 positional arguments:
510 srpm Source rpm to import. It can be also an URL
511 in which
512 case the target srpm will be downloaded
513 first.
514
515 options:
516 -h, --help show this help message and exit
517 --repo-path REPO_PATH
518 Path to git repository for which to upload
519 sources. If
520 not specified, it will be automatically de‐
521 rived from
522 remote URL configured for the current branch.
523 --skip-diffs Don't show diffs when importing.
524 --offline Do not actually upload the files but do all
525 the rest.
526
527
528 rpkg install
529 usage: rpkg install [-h] [--target TARGET] [--with OPTION] [--without
530 OPTION]
531 [--outdir OUTDIR] [--spec SPEC]
532 [--short-circuit SHORT_CIRCUIT] [--nocheck]
533
534 This will call rpmbuild to run the install section. All leading sec‐
535 tions will
536 be processed as well, unless the short-circuit option is used.
537
538 options:
539 -h, --help show this help message and exit
540 --target TARGET Prep for a specific arch or arch-vendor-os.
541 --with OPTION Enable %bcond spec OPTION. Can be specified
542 multiple
543 times.
544 --without OPTION Disable %bcond spec OPTION. Can be specified
545 multiple
546 times.
547 --outdir OUTDIR Where to put any generated rpm content. Di‐
548 rectory must
549 exist.
550 --spec SPEC An input spec template. If not given, the
551 spec
552 template is auto-located in <path> as a file
553 ending
554 either with ".spec.rpkg" or ".spec" suffix
555 (in this
556 order). The directory of the template then
557 also
558 becomes search location for the associated
559 sources and
560 rpkg.conf file. By default, these files are
561 being
562 looked up in <path>. Essentially, this argu‐
563 ment
564 changes the subpackage we work with and which
565 is
566 determined by the --path argument initially
567 (with CWD
568 as the default value for it).
569 --short-circuit SHORT_CIRCUIT
570 short-circuit install
571 --nocheck nocheck install
572
573
574 rpkg lint
575 usage: rpkg lint [-h] [--info] [--rpmlint-config RPMLINT_CONFIG]
576 [target_path]
577
578 Rpmlint can be configured using the --rpmlint-config/-r option or by
579 setting
580 rpkg.rpmlint_config variable.
581
582 positional arguments:
583 target_path Directory with rpm items to be linted or just
584 a single
585 rpm item like a .spec file. if not specified,
586 the
587 latest package directory from base output
588 path will be
589 selected.
590
591 options:
592 -h, --help show this help message and exit
593 --info, -i Display explanations for reported messages
594 --rpmlint-config RPMLINT_CONFIG, -r RPMLINT_CONFIG
595 Use a specific configuration file for rpmlint
596
597
598 rpkg local
599 usage: rpkg local [-h] [--target TARGET] [--with OPTION] [--without
600 OPTION]
601 [--outdir OUTDIR] [--spec SPEC] [--nocheck]
602
603 Locally test run of rpmbuild producing binary RPMs.
604
605 options:
606 -h, --help show this help message and exit
607 --target TARGET Prep for a specific arch or arch-vendor-os.
608 --with OPTION Enable %bcond spec OPTION. Can be specified mul‐
609 tiple
610 times.
611 --without OPTION Disable %bcond spec OPTION. Can be specified mul‐
612 tiple
613 times.
614 --outdir OUTDIR Where to put any generated rpm content. Directory
615 must
616 exist.
617 --spec SPEC An input spec template. If not given, the spec
618 template is
619 auto-located in <path> as a file ending either
620 with
621 ".spec.rpkg" or ".spec" suffix (in this order).
622 The
623 directory of the template then also becomes
624 search
625 location for the associated sources and rpkg.conf
626 file. By
627 default, these files are being looked up in
628 <path>.
629 Essentially, this argument changes the subpackage
630 we work
631 with and which is determined by the --path argu‐
632 ment
633 initially (with CWD as the default value for it).
634 --nocheck nocheck local build
635
636
637 rpkg log
638 usage: rpkg log [-h] [--graph] [--all] [--show-signature]
639 [revision ...] [path ...]
640
641 Display git log history. Can be configured by git.log_graph and
642 git.log_all
643 rpkg configuration options.
644
645 positional arguments:
646 revision Specific revisions or revision range to be shown.
647 path Limit commits to those that touch the specific
648 path(s).
649 You might need to use a -- to explicitly separate
650 paths
651 from revisions. In that case, you also need to
652 insert
653 another -- to first separate options from all the
654 positional arguments.
655
656 options:
657 -h, --help show this help message and exit
658 --graph Draw a text-based graphical representation of the
659 commit
660 history. By default enabled by rpkg configuration
661 option
662 git.log_graph.
663 --all Pretend as if all the refs in refs/, along with
664 HEAD, are
665 listed on the command line as a revision. By de‐
666 fault
667 enabled by rpkg configuration option git.log_all.
668 --show-signature Show gpg signatures and check their validity.
669
670
671 rpkg merge
672 usage: rpkg merge [-h] [--no-commit] [--squash] [--message MESSAGE]
673 [--file FILE] [--signoff] [--abort] [--continue]
674 [commit ...]
675
676 Incorporates changes from the named commits (since the time their
677 histories
678 diverged from the current branch) into the current branch.
679
680 positional arguments:
681 commit Commits, usually other branch heads, to merge
682 into our
683 branch. If no commit is given, merge the re‐
684 mote-
685 tracking branches that the current branch is
686 configured to use as its upstream.
687
688 options:
689 -h, --help show this help message and exit
690 --no-commit Perform the merge but do not auto-commit.
691 --squash Produce the working tree and index state as
692 if a real
693 merge happened but do not auto-commit. The
694 next commit
695 will have only a single parent and contain
696 all the
697 merged changes.
698 --message MESSAGE, -m MESSAGE
699 Use the given <msg> as the commit message
700 summary.
701 --file FILE, -F FILE Take the commit message from the given file.
702 --signoff Add Signed-off-by line by the committer.
703 --abort Abort the current conflict resolution
704 process, and try
705 to reconstruct the pre-merge state.
706 --continue When all your merge conflicts have been re‐
707 solved, you
708 can conclude the merge by running this com‐
709 mand.
710
711
712 rpkg new
713 usage: rpkg new [-h] [--outdir OUTDIR] [--spec SPEC]
714
715 This will use git to show a diff of all the changes (even uncommitted
716 changes)
717 since the last package tag was created.
718
719 options:
720 -h, --help show this help message and exit
721 --outdir OUTDIR Where to put any generated rpm content. Directory
722 must
723 exist.
724 --spec SPEC An input spec template. If not given, the spec
725 template is
726 auto-located in <path> as a file ending either
727 with
728 ".spec.rpkg" or ".spec" suffix (in this order).
729 The
730 directory of the template then also becomes search
731 location
732 for the associated sources and rpkg.conf file. By
733 default,
734 these files are being looked up in <path>. Essen‐
735 tially,
736 this argument changes the subpackage we work with
737 and which
738 is determined by the --path argument initially
739 (with CWD as
740 the default value for it).
741
742
743 rpkg nvr
744 usage: rpkg nvr [-h] [--outdir OUTDIR] [--spec SPEC]
745
746 Print package name-version-release
747
748 options:
749 -h, --help show this help message and exit
750 --outdir OUTDIR Where to put any generated rpm content. Directory
751 must
752 exist.
753 --spec SPEC An input spec template. If not given, the spec
754 template is
755 auto-located in <path> as a file ending either
756 with
757 ".spec.rpkg" or ".spec" suffix (in this order).
758 The
759 directory of the template then also becomes search
760 location
761 for the associated sources and rpkg.conf file. By
762 default,
763 these files are being looked up in <path>. Essen‐
764 tially,
765 this argument changes the subpackage we work with
766 and which
767 is determined by the --path argument initially
768 (with CWD as
769 the default value for it).
770
771
772 rpkg prep
773 usage: rpkg prep [-h] [--target TARGET] [--with OPTION] [--without
774 OPTION]
775 [--outdir OUTDIR] [--spec SPEC]
776
777 Use rpmbuild to "prep" the sources (unpack the source archive(s) and
778 apply any
779 patches).
780
781 options:
782 -h, --help show this help message and exit
783 --target TARGET Prep for a specific arch or arch-vendor-os.
784 --with OPTION Enable %bcond spec OPTION. Can be specified mul‐
785 tiple
786 times.
787 --without OPTION Disable %bcond spec OPTION. Can be specified mul‐
788 tiple
789 times.
790 --outdir OUTDIR Where to put any generated rpm content. Directory
791 must
792 exist.
793 --spec SPEC An input spec template. If not given, the spec
794 template is
795 auto-located in <path> as a file ending either
796 with
797 ".spec.rpkg" or ".spec" suffix (in this order).
798 The
799 directory of the template then also becomes
800 search
801 location for the associated sources and rpkg.conf
802 file. By
803 default, these files are being looked up in
804 <path>.
805 Essentially, this argument changes the subpackage
806 we work
807 with and which is determined by the --path argu‐
808 ment
809 initially (with CWD as the default value for it).
810
811
812 rpkg pull
813 usage: rpkg pull [-h] [--rebase] [--no-rebase]
814
815 This command uses git to fetch remote changes and apply them to the
816 current
817 working copy. A rebase option is available which can be used to avoid
818 merges.
819
820 options:
821 -h, --help show this help message and exit
822 --rebase Rebase the locally committed changes on top of the re‐
823 mote
824 changes after fetching. This can avoid a merge commit,
825 but does
826 rewrite local history.
827 --no-rebase Do not rebase, overriding .git settings to the con‐
828 trary
829
830
831 rpkg push
832 usage: rpkg push [-h] [--follow-tags] [--force]
833
834 Push changes and annotated tags to remote repository.
835
836 options:
837 -h, --help show this help message and exit
838 --follow-tags Push all the refs that would be pushed without this
839 option
840 and also push annotated tags reachable from the refs
841 that are
842 pushed by default. This option is passed by default
843 if
844 git.push_follow_tags configuration variable is set
845 to true.
846 --force, -f Force push
847
848
849 rpkg reset
850 usage: rpkg reset [-h] [--soft | --mixed | --hard] [commit|path]
851
852 Reset HEAD to the specified commit and update index and/or working
853 tree.
854 Alternatively, if path is passed instead of commit, reset the respec‐
855 tive index
856 entry to its state at HEAD.
857
858 positional arguments:
859 commit|path Commit or path. If path is passed, the respective in‐
860 dex entry
861 is updated to its HEAD state, otherwise the action de‐
862 pends on
863 the specified option switch (--mixed is implicit).
864
865 options:
866 -h, --help show this help message and exit
867 --soft Does not touch the index file or the working tree.
868 Only resets
869 the head to the specified commit.
870 --mixed Resets the index but not the working tree. This is the
871 default
872 action.
873 --hard Resets the index and working tree. Any changes to
874 tracked files
875 in the working tree since the specified commit are
876 discarded.
877
878
879 rpkg sources
880 usage: rpkg sources [-h] [--repo-path REPO_PATH] [--outdir OUTDIR]
881
882 Download source files from lookaside cache.
883
884 options:
885 -h, --help show this help message and exit
886 --repo-path REPO_PATH
887 Path to git repository for which to download
888 sources.
889 If not specified, it will be automatically
890 derived
891 from remote URL configured for the current
892 branch.
893 --outdir OUTDIR Directory to put downloaded files into (de‐
894 faults to
895 cwd)
896
897
898 rpkg spec
899 usage: rpkg spec [-h] [--outdir OUTDIR] [--spec SPEC] [--sources]
900 [--print]
901
902 Preprocess a given spec template and put the resulting spec file into
903 outdir.
904 The spec template is simply copied into the outdir if spec prepro‐
905 cessing is
906 turned off or if the input spec template does not contain any pre‐
907 processor
908 macros.
909
910 options:
911 -h, --help show this help message and exit
912 --outdir OUTDIR Where to put any generated rpm content. Directory
913 must
914 exist.
915 --spec SPEC An input spec template. If not given, the spec
916 template is
917 auto-located in <path> as a file ending either
918 with
919 ".spec.rpkg" or ".spec" suffix (in this order).
920 The
921 directory of the template then also becomes search
922 location
923 for the associated sources and rpkg.conf file. By
924 default,
925 these files are being looked up in <path>. Essen‐
926 tially,
927 this argument changes the subpackage we work with
928 and which
929 is determined by the --path argument initially
930 (with CWD as
931 the default value for it).
932 --sources Enable source generation by the input spec tem‐
933 plate. By
934 default disabled.
935 --print, -p Print rendered spec file to stdout.
936
937
938 rpkg srpm
939 usage: rpkg srpm [-h] [--target TARGET] [--with OPTION] [--without
940 OPTION]
941 [--outdir OUTDIR] [--spec SPEC]
942
943 Create a source rpm
944
945 options:
946 -h, --help show this help message and exit
947 --target TARGET Prep for a specific arch or arch-vendor-os.
948 --with OPTION Enable %bcond spec OPTION. Can be specified mul‐
949 tiple
950 times.
951 --without OPTION Disable %bcond spec OPTION. Can be specified mul‐
952 tiple
953 times.
954 --outdir OUTDIR Where to put any generated rpm content. Directory
955 must
956 exist.
957 --spec SPEC An input spec template. If not given, the spec
958 template is
959 auto-located in <path> as a file ending either
960 with
961 ".spec.rpkg" or ".spec" suffix (in this order).
962 The
963 directory of the template then also becomes
964 search
965 location for the associated sources and rpkg.conf
966 file. By
967 default, these files are being looked up in
968 <path>.
969 Essentially, this argument changes the subpackage
970 we work
971 with and which is determined by the --path argu‐
972 ment
973 initially (with CWD as the default value for it).
974
975
976 rpkg status
977 usage: rpkg status [-h] [pathspec ...]
978
979 Display git status of the current working tree and index.
980
981 positional arguments:
982 pathspec Limit status information to the specific subpaths.
983
984 options:
985 -h, --help show this help message and exit
986
987
988 rpkg switch
989 usage: rpkg switch [-h] [--create] [--detach] [--list-branches]
990 [--fetch]
991 [target]
992
993 Switch to a given git branch. If --detach option is given, also tag,
994 or a
995 commit can be used as a target for switching. Additionally, this com‐
996 mand can
997 be used to list the existing local and remote branches or to fetch
998 new refs
999 from remote.
1000
1001 positional arguments:
1002 target Target branch name or alternatively, commit or
1003 tag to
1004 switch to. If provided with a remote branch
1005 name that
1006 does not have a local match, it creates one
1007 and sets it
1008 to track the corresponding remote branch.
1009
1010 options:
1011 -h, --help show this help message and exit
1012 --create, -c Create a new local branch even if it does not
1013 have the
1014 corresponding remote and switch to it.
1015 --detach, -d Detach HEAD at target commit or tag.
1016 --list-branches, -l List both remote-tracking branches and local
1017 branches.
1018 Implied when target is not specified.
1019 --fetch Fetch branches and tags from remote before
1020 switch.
1021
1022
1023 rpkg tag
1024 usage: rpkg tag [-h] [--list] [--delete] [--skip-edit] [--name NAME]
1025 [--version VERSION] [--release RELEASE]
1026 [tag]
1027
1028 This command uses git to create, list, or delete tags. If you have
1029 set
1030 git.gpg_keyid in rpkg configuraion, the tags will be created signed.
1031
1032 positional arguments:
1033 tag Name of the tag. Overrides any of the --name,
1034 --version, --release args if specified
1035
1036 options:
1037 -h, --help show this help message and exit
1038 --list, -l List all tags with a given pattern, or all if
1039 not
1040 pattern is given
1041 --delete, -d Delete a tag
1042 --skip-edit, -s Skip changelog editing when creating a tag.
1043 --name NAME, -n NAME Set package name part of the tag name to spe‐
1044 cific
1045 value.
1046 --version VERSION, -v VERSION
1047 Set version part of the tag name to specific
1048 value.
1049 --release RELEASE, -r RELEASE
1050 Set release part of the tag name to specific
1051 value.
1052
1053
1054 rpkg unused-patches
1055 usage: rpkg unused-patches [-h]
1056
1057 Print list of patches in current working directory not referenced by
1058 name in
1059 the specfile.
1060
1061 options:
1062 -h, --help show this help message and exit
1063
1064
1065 rpkg upload
1066 usage: rpkg upload [-h] [--repo-path REPO_PATH] [--offline] file
1067 [file ...]
1068
1069 This command will upload new source file(s) to lookaside cache.
1070 Source file
1071 names are appended to sources file, and .gitignore will be also up‐
1072 dated with
1073 new uploaded file(s). Please remember to commit them.
1074
1075 positional arguments:
1076 file List of files to upload
1077
1078 options:
1079 -h, --help show this help message and exit
1080 --repo-path REPO_PATH
1081 Path to git repository for which to upload
1082 sources. If
1083 not specified, it will be automatically de‐
1084 rived from
1085 remote URL configured for the current branch.
1086 --offline Do not actually upload the files but do all
1087 the rest,
1088 which involves updating .gitignore and
1089 sources file.
1090
1091
1092 rpkg verify-files
1093 usage: rpkg verify-files [-h] [target_dir]
1094
1095 Locally run 'rpmbuild -bl' to verify the spec file's %%files sec‐
1096 tions. This
1097 requires a successful run of the install commaned in advance.
1098
1099 positional arguments:
1100 target_dir Directory with build results to verify. If not speci‐
1101 fied, the
1102 latest package directory from base output path will be
1103 selected.
1104
1105 options:
1106 -h, --help show this help message and exit
1107
1108
1110 rpkg reads configuration options from the following files in this or‐
1111 der:
1112
1113 /etc/rpkg.conf, ~/.config/rpkg.conf, <git_root>/rpkg.conf,
1114 <pkg_path>/rpkg.conf
1115
1116 Configuration found in <pkg_path>/rpkg.conf has the highest priority.
1117 Configuration found in /etc/rpkg.conf has the lowest priority.
1118 <git_root> placeholder above is the top level of the Git repository we
1119 are working in. If we are in a plain directory (i.e. there is not .git
1120 subdir) and all our parent directories are also plain, reading of
1121 <git_root>/rpkg.conf is skipped. <pkg_path> is CWD, by default, but it
1122 can be overriden with --path argument and --spec argument, the latter
1123 having higher priority.
1124
1125 There are also built-in default values for each variable that are used
1126 if the variable is not specified in any configuration file. You can see
1127 them below together with the variable descriptions.
1128
1129
1130 DEFAULT CONFIGURATION WITH DESCRIPTIONS
1131 [rpkg]
1132 # Whether to enable spec preprocessing,
1133 # that is parsing and evaluation of {{{ ... }}} expressions
1134 # type: bool
1135 preprocess_spec = True
1136
1137 # Base directory where generated files should be put.
1138 # The files will not be put directly there but
1139 # instead into dynamically generated subdirectories
1140 # type: string
1141 base_output_path = /tmp/rpkg
1142
1143 # Path to user preproc macros. You may use ${git_props:root}
1144 # variable to anchor the path to top-level of your git repo.
1145 # type: list of space-separated strings
1146 user_macros =
1147
1148 # rpm bcondition "with" specifier
1149 # type: list of space-separated strings
1150 with =
1151
1152 # rpm bcondition "without" specifier
1153 # type: list of space-separated strings
1154 without =
1155
1156 # Defines rpm variables for spec parsing
1157 # type: list of space-separated quoted string pairs (e.g. 'dist
1158 %nil')
1159 rpmdefines =
1160
1161 # Defines rpm variables for spec parsing during
1162 # version/release bumping (see the tag subcommand)
1163 # This list is not being concatenated with rpmdefines.
1164 # type: list of space-separated quoted string pairs
1165 bump_rpmdefines = 'dist %nil'
1166
1167 # Path to rpmlint configuration (see the lint subcommand)
1168 # type: string
1169 rpmlint_config =
1170
1171 # Paths to default preproc macros relative to
1172 # /usr/lib/rpkg.macros.d directory
1173 # type: list of space-separated strings
1174 default_macros = git.bash
1175
1176 [git]
1177 # Default Git repository URL, used by `rpkg clone <repo_path>`
1178 # type: string
1179 clone_url =
1180
1181 # Default Git repository URL, used by `rpkg clone -a <repo_path>`
1182 # type: string
1183 anon_clone_url =
1184
1185 # If you clone a project with rpkg clone and specify only
1186 # its basename (i.e. the last part like "dist-git"), then
1187 # default namespace (e.g. rpms) will be automatically
1188 # prepended to it together with ending slash if specified.
1189 # type: string
1190 default_namespace =
1191
1192 # Whether to automatically push tags with rpkg push
1193 # type: bool
1194 push_follow_tags = True
1195
1196 # Allows removing of files and directories
1197 # for rpkg clean operation
1198 # type: bool
1199 clean_force = True
1200
1201 # Whether rpkg clean should descend into
1202 # untracked directories
1203 # type: bool
1204 clean_dirs = True
1205
1206 # Whether rpkg log should be in graph form
1207 # type: bool
1208 log_graph = True
1209
1210 # Whether rpkg log should display all branches
1211 # type: bool
1212 log_all = True
1213
1214 # Key to sign commits and tags with. Specifying
1215 # it enables signing.
1216 # type: bool
1217 gpg_keyid =
1218
1219 # In which Copr project to build a package by using
1220 # rpkg build command, in form: user/project or @group/project
1221 # type: string
1222 copr_project =
1223
1224 [lookaside]
1225 # Download URL for DistGit lookaside cache, used by rpkg sources.
1226 # There are some dynamic variables that you can use:
1227 # %(repo_path)s is a fully-namespaced repository name (e.g.
1228 rpms/rpkg-util)
1229 # %(ns<n>)s, ..., %(ns2)s, %(ns1)s, %(name)s is %(repo_path)s split
1230 into individual components.
1231 # E.g. forks/praiskup/rpms/passwd path will provide variables:
1232 %(ns3)s == forks, %(ns2)s == praiskup, %(ns1)s == rpms, %(name)s ==
1233 passwd
1234 # %(filename)s, %(hashtype)s, %(hash)s fields are read from
1235 'sources' file, if present.
1236 # Further, you can use ${git_props:remote_netloc} interpolation
1237 # variable to base the download URL on git clone URL.
1238 # type: string
1239 download_url =
1240
1241 # Upload URL for DistGit lookaside cache, used by rpkg upload.
1242 # You can use ${git_props:remote_netloc} interpolation
1243 # variable to base the download URL on git clone URL.
1244 # type: string
1245 upload_url =
1246
1247 # For client certificate authentication if employed
1248 # by the server
1249 # type: string
1250 client_cert =
1251
1252 # For client certificate authentication if employed
1253 # by the server
1254 # type: string
1255 client_key =
1256
1257 # For client certificate authentication if employed
1258 # by the server
1259 # type: string
1260 ca_cert =
1261
1262
1263 DYNAMIC CONFIGURATION SECTIONS
1264 There are also other config sections which are dynamically added by
1265 rpkg during runtime. These are [DEFAULT] (containing user, path, and
1266 pkg_path properties) and [git_props] (containing lots of git status
1267 specific information). You can print the whole final config (including
1268 those sections) with rpkg config command.
1269
1270
1271 INTERPOLATION
1272 When specifying configuration values, you can use interpolation to ref‐
1273 erence another configuration variable even from another section. The
1274 syntax is: ${<section name>:<param name>} (e.g. ${git_props:remote_net‐
1275 loc}).
1276
1277 There is also %(<var>)s interpolation for some fields like looka‐
1278 side:download_url. The variables you can interpolate like this are al‐
1279 ways field-specific.
1280
1281
1283 Run %prep phase of an rpm build:
1284
1285 $ rpkg prep
1286 git_dir_pack: packing path /home/clime/rpkg-util
1287 git_dir_pack: Wrote: /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util-
1288 f01b36d7-dirty.tar.gz
1289 Wrote: /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util.spec
1290 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.iqrI6z
1291 + umask 022
1292 + cd /tmp/rpkg/rpkg-util-12-ft3gm2mw
1293 + cd /tmp/rpkg/rpkg-util-12-ft3gm2mw
1294 + rm -rf rpkg-util
1295 + /usr/bin/gzip -dc /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util-
1296 f01b36d7-dirty.tar.gz
1297 + /usr/bin/tar -xof -
1298 + STATUS=0
1299 + '[' 0 -ne 0 ']'
1300 + cd rpkg-util
1301 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
1302 + RPM_EC=0
1303 ++ jobs -p
1304 + exit 0
1305
1306 Generate spec file from a template:
1307
1308 $ rpkg spec
1309 Wrote: /tmp/rpkg/rpkg-util-13-53194610/rpkg-util.spec
1310
1311 Build srpm:
1312
1313 $ rpkg srpm
1314 git_dir_pack: packing path /home/clime/rpkg-util
1315 git_dir_pack: Wrote: /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util-
1316 f01b36d7-dirty.tar.gz
1317 Wrote: /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util.spec
1318 Wrote: /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util-3.proto‐
1319 type.git.229.f01b36d7.dirty.02idw5-1.fc31.src.rpm
1320
1321
1323 Apart from being useful as a means to handle unpacked as well as packed
1324 content, they also make it possible to generate certain parts of your
1325 spec file automatically from a Git repository where your spec file is
1326 located. You need to have "preprocess_spec" configuration option set to
1327 True in rpkg config to use this functionality.
1328
1329
1330 BASIC EXAMPLE
1331 Name: {{{ git_dir_name }}}
1332 Version: {{{ git_dir_version }}}
1333 Release: 1%{?dist}
1334 Summary: This is a test package.
1335
1336 License: GPLv2+
1337 URL: https://someurl.org
1338 VCS: {{{ git_dir_vcs }}}
1339
1340 Source: {{{ git_dir_pack }}}
1341
1342 %description
1343 This is a test package.
1344
1345 %prep
1346 {{{ git_dir_setup_macro }}}
1347
1348 %changelog
1349 {{{ git_dir_changelog }}}
1350
1351 Having a spec template like this in your project (instead of just a
1352 plain spec file) allows you to build source and rpm packages automati‐
1353 cally following git history of your project.
1354
1355
1356 MACRO REFERENCE
1357 Please, see dedicated rpkg-macros page.
1358
1359
1361 You can define your own rpkg macros. They are basically just standard
1362 bash functions read from file specified by user_macros config variable.
1363 When used, standard output of your custom macro will be captured and
1364 the {{{ <macro_name> }}} invocation in an input spec file will be re‐
1365 placed with it.
1366
1367 Example of a custom macro placed in repo-specific rpkg.macros file:
1368
1369 function my_git_commits_no {
1370 total_commits=$(git rev-list --all --count)
1371 echo -n "$total_commits"
1372 }
1373
1374 If you have got rpkg.macros file with this content in git top-level di‐
1375 rectory for your project, then also create rpkg.conf file in your top-
1376 level dir with at least the following content:
1377
1378 [rpkg]
1379 user_macros = ${git_props:root}/rpkg.macros
1380
1381 This will enable reading of the custom user macros. In the spec file,
1382 you can then e.g. use this snippet:
1383
1384 Release: {{{ my_git_commits_no }}}
1385
1386 to enable generating release based on total number of commits.
1387
1388
1390 https://pagure.io/rpkg-util/
1391
1392
1393
1394 2022-02-03 rpkg(1)