1rpkg(1)                          rpm-packager                          rpkg(1)
2
3
4

NAME

6       rpkg - RPM packaging utility
7

SYNOPSIS

9       rpkg [ global_options ] command [ command_options ] [ command_arguments
10       ]
11       rpkg help
12       rpkg command --help
13

DESCRIPTION

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

COMMAND OVERVIEW

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

COMMAND REFERENCE

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. The  directory  of
200       the
201                            template then also becomes search location for the
202                            associated sources and rpkg.conf file. By default,
203       these
204                            files are being looked up in <path>.  Essentially,
205       this
206                            argument  changes  the subpackage we work with and
207       which is
208                            determined by the --path argument initially  (with
209       CWD as
210                            the default value for it).
211           --config CONFIG  Path to an alternative Copr configuration file
212           --wait, -w       Wait for build to finish.
213
214
215   rpkg ci
216         usage:  rpkg  ci  [-h]  [--message  MESSAGE  |  --file  FILE] [--all]
217       [--amend]
218                        [--with-changelog] [--tag] [--push] [--signoff]
219                        [file ...]
220
221         Alias for commit.
222
223         positional arguments:
224           file                  Optional list of specific files to commit
225
226         options:
227           -h, --help            show this help message and exit
228           --message MESSAGE, -m MESSAGE
229                                 Use the given <msg>  as  the  commit  message
230       summary
231           --file FILE, -F FILE  Take the commit message from the given file
232           --all, -a             Tell the command to automatically stage files
233       that
234                                 have been modified or deleted.
235           --amend               Replace the tip of the current branch by cre‐
236       ating a
237                                 new commit.
238           --with-changelog       Get  the  last changelog from SPEC as commit
239       message
240                                 content. This option must be used with -m to‐
241       gether.
242           --tag, -t             Create a tag for this commit
243           --push, -p            Commit and push as one action
244           --signoff, -s         Include a signed-off-by
245
246
247   rpkg clean
248         usage: rpkg clean [-h] [--dry-run] [-x] [--force] [-d]
249
250         This  command  can  be used to clean up your work tree from untracked
251       files and,
252         files described by .gitignore additionally if -x option is passed.
253
254         options:
255           -h, --help     show this help message and exit
256           --dry-run, -n  Don't actually remove anything, just show what would
257       be done.
258           -x              Don't  exclude  files described by .gitignore rules
259       from
260                          deletion.
261           --force, -f    This option is required to perform deletion  of  any
262       files or
263                          directories  if git configuration variable clean.re‐
264       quireForce
265                          is set to true. It is passed by default if rpkg con‐
266       figuration
267                          variable git.clean_force is set to true.
268           -d              Remove whole directories in addition to files. This
269       option is
270                          passed by default if rpkg configuration variable
271                          git.clean_dirs is set to true.
272
273
274   rpkg clog
275         usage: rpkg clog [-h] [--raw]
276
277         This will output the latest rpm changelog entry to stdout. The  lead‐
278       ing "- "
279         text will be stripped.
280
281         options:
282           -h, --help  show this help message and exit
283           --raw        Generate  a more "raw" clog without twiddling the con‐
284       tents
285
286
287   rpkg clone
288         usage: rpkg clone [-h] [--branches] [--branch BRANCH] [--anonymous]
289                           repo_path [directory]
290
291         This command will clone the  named  repository  from  the  configured
292       repository
293         base URL. By default it will also checkout the master branch for your
294       working
295         copy.
296
297         positional arguments:
298           repo_path             Name of the repository to clone or full clone
299       url. If
300                                 just  a  basename is specified, preconfigured
301       git clone
302                                 urls and default namespace is  used  to  con‐
303       struct the
304                                 final clone url.
305           directory             Directory in which to clone the repository
306
307         options:
308           -h, --help            show this help message and exit
309           --branches, -B        Checkout a subdirectory for each branch
310           --branch BRANCH, -b BRANCH
311                                 Check  out a specific branch. This has no ef‐
312       fect if
313                                 --branches/-B is specified.
314           --anonymous, -a       Check out a repository anonymously
315
316
317   rpkg commit
318         usage: rpkg commit [-h] [--message MESSAGE  |  --file  FILE]  [--all]
319       [--amend]
320                            [--with-changelog] [--tag] [--push] [--signoff]
321                            [file ...]
322
323         This  invokes  a  git  commit. All tracked files with changes will be
324       committed
325         unless a specific file list is provided. $EDITOR will be used to gen‐
326       erate a
327         changelog  message  unless one is given to the command. A tag or push
328       can be
329         done at the same time. If you have set git.gpg_keyid rpkg  configura‐
330       tion
331         option, commit and tag will be created signed with the configured GPG
332       key.
333
334         positional arguments:
335           file                  Optional list of specific files to commit
336
337         options:
338           -h, --help            show this help message and exit
339           --message MESSAGE, -m MESSAGE
340                                 Use the given <msg>  as  the  commit  message
341       summary
342           --file FILE, -F FILE  Take the commit message from the given file
343           --all, -a             Tell the command to automatically stage files
344       that
345                                 have been modified or deleted.
346           --amend               Replace the tip of the current branch by cre‐
347       ating a
348                                 new commit.
349           --with-changelog       Get  the  last changelog from SPEC as commit
350       message
351                                 content. This option must be used with -m to‐
352       gether.
353           --tag, -t             Create a tag for this commit
354           --push, -p            Commit and push as one action
355           --signoff, -s         Include a signed-off-by
356
357
358   rpkg compile
359         usage: rpkg compile [-h] [--target TARGET] [--with OPTION] [--without
360       OPTION]
361                             [--outdir OUTDIR] [--spec SPEC]
362                             [--short-circuit SHORT_CIRCUIT] [--nocheck]
363
364         This command calls rpmbuild to compile the  source.  By  default  the
365       prep and
366         configure  stages  will be done as well, unless the short-circuit op‐
367       tion is
368         used.
369
370         options:
371           -h, --help            show this help message and exit
372           --target TARGET       Prep for a specific arch or arch-vendor-os.
373           --with OPTION         Enable %bcond spec OPTION. Can  be  specified
374       multiple
375                                 times.
376           --without  OPTION      Disable %bcond spec OPTION. Can be specified
377       multiple
378                                 times.
379           --outdir OUTDIR       Where to put any generated rpm  content.  Di‐
380       rectory must
381                                 exist.
382           --spec  SPEC            An  input  spec template. If not given, the
383       spec
384                                 template is auto-located in <path> as a  file
385       ending
386                                 either  with  ".spec.rpkg" or ".spec" suffix.
387       The
388                                 directory of the template then  also  becomes
389       search
390                                 location   for  the  associated  sources  and
391       rpkg.conf
392                                 file.  By  default,  these  files  are  being
393       looked up in
394                                 <path>.  Essentially,  this  argument changes
395       the
396                                 subpackage we work with and which  is  deter‐
397       mined by the
398                                 --path  argument  initially  (with CWD as the
399       default
400                                 value for it).
401           --short-circuit SHORT_CIRCUIT
402                                 short-circuit compile
403           --nocheck             nocheck compile
404
405
406   rpkg config
407         usage: rpkg config [-h]
408
409         Do nothing, only output used config.
410
411         options:
412           -h, --help  show this help message and exit
413
414
415   rpkg copr-build
416         usage: rpkg copr-build [-h] [--outdir OUTDIR] [--spec SPEC] [--config
417       CONFIG]
418                                [--wait]
419                                [project]
420
421                 Build package in Copr build system.
422
423                 You  need to have copr-cli installed and also set up Copr API
424       key.
425                 For more information about the API key, see API  KEY  section
426       in
427                 copr-cli(1) man page.
428
429                 NOTE: This method of building the package does not support
430                 with, without, and rpmdefines rpkg configuration options.
431                 These options are used to build an srpm which is then
432                 sent to Copr but rpm build in Copr happens without
433                 these options already, which is important for the
434                 resulting build. If you want these options applied,
435                 you should rather setup auto-rebuilding in Copr
436                 that will react to new pushes into your repository.
437
438
439         positional arguments:
440           project           Name  of the project in format OWNER/PROJECT. You
441       can omit
442                            it if you have specified  copr_project  configura‐
443       tion option.
444
445         options:
446           -h, --help       show this help message and exit
447           --outdir  OUTDIR  Where to put any generated rpm content. Directory
448       must
449                            exist.
450           --spec SPEC      An input spec template. If  not  given,  the  spec
451       template is
452                            auto-located  in  <path>  as  a file ending either
453       with
454                            ".spec.rpkg" or ".spec" suffix. The  directory  of
455       the
456                            template then also becomes search location for the
457                            associated sources and rpkg.conf file. By default,
458       these
459                            files are being looked up in <path>.  Essentially,
460       this
461                            argument  changes  the subpackage we work with and
462       which is
463                            determined by the --path argument initially  (with
464       CWD as
465                            the default value for it).
466           --config CONFIG  Path to an alternative Copr configuration file
467           --wait, -w       Wait for build to finish.
468
469
470   rpkg diff
471         usage: rpkg diff [-h] [--cached] [file ...]
472
473         Use git diff to show changes that have been made to tracked files. By
474       default
475         cached changes (changes that have been git added) will not be shown.
476
477         positional arguments:
478           file        Optionally diff specific files
479
480         options:
481           -h, --help  show this help message and exit
482           --cached    View staged changes
483
484
485   rpkg gimmespec
486         usage: rpkg gimmespec [-h]
487
488         Print auto-located input spec file name
489
490         options:
491           -h, --help  show this help message and exit
492
493
494   rpkg import
495         usage:  rpkg  import  [-h]  [--repo-path  REPO_PATH]   [--skip-diffs]
496       [--offline]
497                            srpm
498
499         This  will  extract  sources, patches, and the spec file from an srpm
500       and
501         overwrites the current package content accordingly. It will import to
502       the
503         current  branch by default. Newly discovered sources will be uploaded
504       and
505         .gitignore and sources file updated accordingly.
506
507         positional arguments:
508           srpm                  Source rpm to import. It can be also  an  URL
509       in which
510                                 case  the  target  srpm  will  be  downloaded
511       first.
512
513         options:
514           -h, --help            show this help message and exit
515           --repo-path REPO_PATH
516                                 Path to git repository for  which  to  upload
517       sources. If
518                                 not  specified,  it will be automatically de‐
519       rived from
520                                 remote URL configured for the current branch.
521           --skip-diffs          Don't show diffs when importing.
522           --offline             Do not actually upload the files but  do  all
523       the rest.
524
525
526   rpkg install
527         usage: rpkg install [-h] [--target TARGET] [--with OPTION] [--without
528       OPTION]
529                             [--outdir OUTDIR] [--spec SPEC]
530                             [--short-circuit SHORT_CIRCUIT] [--nocheck]
531
532         This will call rpmbuild to run the install section. All leading  sec‐
533       tions will
534         be processed as well, unless the short-circuit option is used.
535
536         options:
537           -h, --help            show this help message and exit
538           --target TARGET       Prep for a specific arch or arch-vendor-os.
539           --with  OPTION          Enable %bcond spec OPTION. Can be specified
540       multiple
541                                 times.
542           --without OPTION      Disable %bcond spec OPTION. Can be  specified
543       multiple
544                                 times.
545           --outdir  OUTDIR        Where to put any generated rpm content. Di‐
546       rectory must
547                                 exist.
548           --spec SPEC           An input spec template.  If  not  given,  the
549       spec
550                                 template  is auto-located in <path> as a file
551       ending
552                                 either with ".spec.rpkg" or  ".spec"  suffix.
553       The
554                                 directory  of  the template then also becomes
555       search
556                                 location  for  the  associated  sources   and
557       rpkg.conf
558                                 file.  By  default,  these  files  are  being
559       looked up in
560                                 <path>. Essentially,  this  argument  changes
561       the
562                                 subpackage  we  work with and which is deter‐
563       mined by the
564                                 --path argument initially (with  CWD  as  the
565       default
566                                 value for it).
567           --short-circuit SHORT_CIRCUIT
568                                 short-circuit install
569           --nocheck             nocheck install
570
571
572   rpkg lint
573         usage:  rpkg  lint  [-h]  [--info]  [--rpmlint-config RPMLINT_CONFIG]
574       [target_path]
575
576         Rpmlint can be configured using the --rpmlint-config/-r option or  by
577       setting
578         rpkg.rpmlint_config variable.
579
580         positional arguments:
581           target_path           Directory with rpm items to be linted or just
582       a single
583                                 rpm item like a .spec file. if not specified,
584       the
585                                 latest  package  directory  from  base output
586       path will be
587                                 selected.
588
589         options:
590           -h, --help            show this help message and exit
591           --info, -i            Display explanations for reported messages
592           --rpmlint-config RPMLINT_CONFIG, -r RPMLINT_CONFIG
593                                 Use a specific configuration file for rpmlint
594
595
596   rpkg local
597         usage: rpkg local [-h] [--target TARGET] [--with  OPTION]  [--without
598       OPTION]
599                           [--outdir OUTDIR] [--spec SPEC] [--nocheck]
600
601         Locally test run of rpmbuild producing binary RPMs.
602
603         options:
604           -h, --help        show this help message and exit
605           --target TARGET   Prep for a specific arch or arch-vendor-os.
606           --with  OPTION     Enable %bcond spec OPTION. Can be specified mul‐
607       tiple
608                             times.
609           --without OPTION  Disable %bcond spec OPTION. Can be specified mul‐
610       tiple
611                             times.
612           --outdir OUTDIR   Where to put any generated rpm content. Directory
613       must
614                             exist.
615           --spec SPEC       An input spec template. If not  given,  the  spec
616       template is
617                             auto-located  in  <path>  as a file ending either
618       with
619                             ".spec.rpkg" or ".spec" suffix. The directory  of
620       the
621                             template  then  also  becomes search location for
622       the
623                             associated sources and  rpkg.conf  file.  By  de‐
624       fault, these
625                             files are being looked up in <path>. Essentially,
626       this
627                             argument changes the subpackage we work with  and
628       which is
629                             determined by the --path argument initially (with
630       CWD as
631                             the default value for it).
632           --nocheck         nocheck local build
633
634
635   rpkg log
636         usage: rpkg log [-h] [--graph] [--all] [--show-signature]
637                         [revision ...] [path ...]
638
639         Display git log history.  Can  be  configured  by  git.log_graph  and
640       git.log_all
641         rpkg configuration options.
642
643         positional arguments:
644           revision          Specific revisions or revision range to be shown.
645           path               Limit  commits  to those that touch the specific
646       path(s).
647                             You might need to use a -- to explicitly separate
648       paths
649                             from  revisions.  In  that case, you also need to
650       insert
651                             another -- to first separate options from all the
652                             positional arguments.
653
654         options:
655           -h, --help        show this help message and exit
656           --graph           Draw a text-based graphical representation of the
657       commit
658                             history. By default enabled by rpkg configuration
659       option
660                             git.log_graph.
661           --all             Pretend as if all the refs in refs/,  along  with
662       HEAD, are
663                             listed  on the command line as a revision. By de‐
664       fault
665                             enabled by rpkg configuration option git.log_all.
666           --show-signature  Show gpg signatures and check their validity.
667
668
669   rpkg merge
670         usage: rpkg merge [-h] [--no-commit] [--squash] [--message MESSAGE]
671                           [--file FILE] [--signoff] [--abort] [--continue]
672                           [commit ...]
673
674         Incorporates changes from the named commits  (since  the  time  their
675       histories
676         diverged from the current branch) into the current branch.
677
678         positional arguments:
679           commit                Commits, usually other branch heads, to merge
680       into our
681                                 branch. If no commit is given, merge the  re‐
682       mote-
683                                 tracking branches that the current branch is
684                                 configured to use as its upstream.
685
686         options:
687           -h, --help            show this help message and exit
688           --no-commit           Perform the merge but do not auto-commit.
689           --squash               Produce  the working tree and index state as
690       if a real
691                                 merge happened but do  not  auto-commit.  The
692       next commit
693                                 will  have  only  a single parent and contain
694       all the
695                                 merged changes.
696           --message MESSAGE, -m MESSAGE
697                                 Use the given <msg>  as  the  commit  message
698       summary.
699           --file FILE, -F FILE  Take the commit message from the given file.
700           --signoff             Add Signed-off-by line by the committer.
701           --abort                 Abort   the   current  conflict  resolution
702       process, and try
703                                 to reconstruct the pre-merge state.
704           --continue            When all your merge conflicts have  been  re‐
705       solved, you
706                                 can  conclude  the merge by running this com‐
707       mand.
708
709
710   rpkg new
711         usage: rpkg new [-h] [--outdir OUTDIR] [--spec SPEC]
712
713         This will use git to show a diff of all the changes (even uncommitted
714       changes)
715         since the last package tag was created.
716
717         options:
718           -h, --help       show this help message and exit
719           --outdir  OUTDIR  Where to put any generated rpm content. Directory
720       must
721                            exist.
722           --spec SPEC      An input spec template. If  not  given,  the  spec
723       template is
724                            auto-located  in  <path>  as  a file ending either
725       with
726                            ".spec.rpkg" or ".spec" suffix. The  directory  of
727       the
728                            template then also becomes search location for the
729                            associated sources and rpkg.conf file. By default,
730       these
731                            files are being looked up in <path>.  Essentially,
732       this
733                            argument  changes  the subpackage we work with and
734       which is
735                            determined by the --path argument initially  (with
736       CWD as
737                            the default value for it).
738
739
740   rpkg nvr
741         usage: rpkg nvr [-h] [--outdir OUTDIR] [--spec SPEC]
742
743         Print package name-version-release
744
745         options:
746           -h, --help       show this help message and exit
747           --outdir  OUTDIR  Where to put any generated rpm content. Directory
748       must
749                            exist.
750           --spec SPEC      An input spec template. If  not  given,  the  spec
751       template is
752                            auto-located  in  <path>  as  a file ending either
753       with
754                            ".spec.rpkg" or ".spec" suffix. The  directory  of
755       the
756                            template then also becomes search location for the
757                            associated sources and rpkg.conf file. By default,
758       these
759                            files are being looked up in <path>.  Essentially,
760       this
761                            argument  changes  the subpackage we work with and
762       which is
763                            determined by the --path argument initially  (with
764       CWD as
765                            the default value for it).
766
767
768   rpkg prep
769         usage:  rpkg  prep  [-h] [--target TARGET] [--with OPTION] [--without
770       OPTION]
771                          [--outdir OUTDIR] [--spec SPEC]
772
773         Use rpmbuild to "prep" the sources (unpack the source archive(s)  and
774       apply any
775         patches).
776
777         options:
778           -h, --help        show this help message and exit
779           --target TARGET   Prep for a specific arch or arch-vendor-os.
780           --with  OPTION     Enable %bcond spec OPTION. Can be specified mul‐
781       tiple
782                             times.
783           --without OPTION  Disable %bcond spec OPTION. Can be specified mul‐
784       tiple
785                             times.
786           --outdir OUTDIR   Where to put any generated rpm content. Directory
787       must
788                             exist.
789           --spec SPEC       An input spec template. If not  given,  the  spec
790       template is
791                             auto-located  in  <path>  as a file ending either
792       with
793                             ".spec.rpkg" or ".spec" suffix. The directory  of
794       the
795                             template  then  also  becomes search location for
796       the
797                             associated sources and  rpkg.conf  file.  By  de‐
798       fault, these
799                             files are being looked up in <path>. Essentially,
800       this
801                             argument changes the subpackage we work with  and
802       which is
803                             determined by the --path argument initially (with
804       CWD as
805                             the default value for it).
806
807
808   rpkg pull
809         usage: rpkg pull [-h] [--rebase] [--no-rebase]
810
811         This command uses git to fetch remote changes and apply them  to  the
812       current
813         working copy. A rebase option is available which can be used to avoid
814       merges.
815
816         options:
817           -h, --help   show this help message and exit
818           --rebase     Rebase the locally committed changes on top of the re‐
819       mote
820                        changes after fetching. This can avoid a merge commit,
821       but does
822                        rewrite local history.
823           --no-rebase  Do not rebase, overriding .git settings  to  the  con‐
824       trary
825
826
827   rpkg push
828         usage: rpkg push [-h] [--follow-tags] [--force]
829
830         Push changes and annotated tags to remote repository.
831
832         options:
833           -h, --help     show this help message and exit
834           --follow-tags   Push all the refs that would be pushed without this
835       option
836                          and also push annotated tags reachable from the refs
837       that are
838                          pushed  by default. This option is passed by default
839       if
840                          git.push_follow_tags configuration variable  is  set
841       to true.
842           --force, -f    Force push
843
844
845   rpkg reset
846         usage: rpkg reset [-h] [--soft | --mixed | --hard] [commit|path]
847
848         Reset  HEAD  to  the specified commit and update index and/or working
849       tree.
850         Alternatively, if path is passed instead of commit, reset the respec‐
851       tive index
852         entry to its state at HEAD.
853
854         positional arguments:
855           commit|path   Commit or path. If path is passed, the respective in‐
856       dex entry
857                        is updated to its HEAD state, otherwise the action de‐
858       pends on
859                        the specified option switch (--mixed is implicit).
860
861         options:
862           -h, --help   show this help message and exit
863           --soft        Does  not  touch  the index file or the working tree.
864       Only resets
865                        the head to the specified commit.
866           --mixed      Resets the index but not the working tree. This is the
867       default
868                        action.
869           --hard        Resets  the  index  and  working tree. Any changes to
870       tracked files
871                        in the working tree since  the  specified  commit  are
872       discarded.
873
874
875   rpkg sources
876         usage: rpkg sources [-h] [--repo-path REPO_PATH] [--outdir OUTDIR]
877
878         Download source files from lookaside cache.
879
880         options:
881           -h, --help            show this help message and exit
882           --repo-path REPO_PATH
883                                 Path  to git repository for which to download
884       sources.
885                                 If not specified, it  will  be  automatically
886       derived
887                                 from  remote  URL  configured for the current
888       branch.
889           --outdir OUTDIR       Directory to put downloaded files  into  (de‐
890       faults to
891                                 cwd)
892
893
894   rpkg spec
895         usage:  rpkg  spec  [-h]  [--outdir OUTDIR] [--spec SPEC] [--sources]
896       [--print]
897
898         Preprocess a given spec template and put the resulting spec file into
899       outdir.
900         The  spec  template  is simply copied into the outdir if spec prepro‐
901       cessing is
902         turned off or if the input spec template does not  contain  any  pre‐
903       processor
904         macros.
905
906         options:
907           -h, --help       show this help message and exit
908           --outdir  OUTDIR  Where to put any generated rpm content. Directory
909       must
910                            exist.
911           --spec SPEC      An input spec template. If  not  given,  the  spec
912       template is
913                            auto-located  in  <path>  as  a file ending either
914       with
915                            ".spec.rpkg" or ".spec" suffix. The  directory  of
916       the
917                            template then also becomes search location for the
918                            associated sources and rpkg.conf file. By default,
919       these
920                            files are being looked up in <path>.  Essentially,
921       this
922                            argument  changes  the subpackage we work with and
923       which is
924                            determined by the --path argument initially  (with
925       CWD as
926                            the default value for it).
927           --sources         Enable  source  generation by the input spec tem‐
928       plate. By
929                            default disabled.
930           --print, -p      Print rendered spec file to stdout.
931
932
933   rpkg srpm
934         usage: rpkg srpm [-h] [--target TARGET]  [--with  OPTION]  [--without
935       OPTION]
936                          [--outdir OUTDIR] [--spec SPEC]
937
938         Create a source rpm
939
940         options:
941           -h, --help        show this help message and exit
942           --target TARGET   Prep for a specific arch or arch-vendor-os.
943           --with  OPTION     Enable %bcond spec OPTION. Can be specified mul‐
944       tiple
945                             times.
946           --without OPTION  Disable %bcond spec OPTION. Can be specified mul‐
947       tiple
948                             times.
949           --outdir OUTDIR   Where to put any generated rpm content. Directory
950       must
951                             exist.
952           --spec SPEC       An input spec template. If not  given,  the  spec
953       template is
954                             auto-located  in  <path>  as a file ending either
955       with
956                             ".spec.rpkg" or ".spec" suffix. The directory  of
957       the
958                             template  then  also  becomes search location for
959       the
960                             associated sources and  rpkg.conf  file.  By  de‐
961       fault, these
962                             files are being looked up in <path>. Essentially,
963       this
964                             argument changes the subpackage we work with  and
965       which is
966                             determined by the --path argument initially (with
967       CWD as
968                             the default value for it).
969
970
971   rpkg status
972         usage: rpkg status [-h] [pathspec ...]
973
974         Display git status of the current working tree and index.
975
976         positional arguments:
977           pathspec    Limit status information to the specific subpaths.
978
979         options:
980           -h, --help  show this help message and exit
981
982
983   rpkg switch
984         usage:  rpkg  switch  [-h]  [--create]  [--detach]  [--list-branches]
985       [--fetch]
986                            [target]
987
988         Switch  to a given git branch. If --detach option is given, also tag,
989       or a
990         commit can be used as a target for switching. Additionally, this com‐
991       mand can
992         be  used  to  list the existing local and remote branches or to fetch
993       new refs
994         from remote.
995
996         positional arguments:
997           target               Target branch name or alternatively, commit or
998       tag to
999                                switch  to.  If  provided with a remote branch
1000       name that
1001                                does not have a local match,  it  creates  one
1002       and sets it
1003                                to track the corresponding remote branch.
1004
1005         options:
1006           -h, --help           show this help message and exit
1007           --create,  -c         Create a new local branch even if it does not
1008       have the
1009                                corresponding remote and switch to it.
1010           --detach, -d         Detach HEAD at target commit or tag.
1011           --list-branches, -l  List both remote-tracking branches  and  local
1012       branches.
1013                                Implied when target is not specified.
1014           --fetch               Fetch  branches  and  tags from remote before
1015       switch.
1016
1017
1018   rpkg tag
1019         usage: rpkg tag [-h] [--list] [--delete] [--skip-edit] [--name NAME]
1020                         [--version VERSION] [--release RELEASE]
1021                         [tag]
1022
1023         This command uses git to create, list, or delete tags.  If  you  have
1024       set
1025         git.gpg_keyid in rpkg configuraion, the tags will be created signed.
1026
1027         positional arguments:
1028           tag                   Name of the tag. Overrides any of the --name,
1029                                 --version, --release args if specified
1030
1031         options:
1032           -h, --help            show this help message and exit
1033           --list, -l            List all tags with a given pattern, or all if
1034       not
1035                                 pattern is given
1036           --delete, -d          Delete a tag
1037           --skip-edit, -s       Skip changelog editing when creating a tag.
1038           --name NAME, -n NAME  Set package name part of the tag name to spe‐
1039       cific
1040                                 value.
1041           --version VERSION, -v VERSION
1042                                 Set  version part of the tag name to specific
1043       value.
1044           --release RELEASE, -r RELEASE
1045                                 Set release part of the tag name to  specific
1046       value.
1047
1048
1049   rpkg unused-patches
1050         usage: rpkg unused-patches [-h]
1051
1052         Print  list of patches in current working directory not referenced by
1053       name in
1054         the specfile.
1055
1056         options:
1057           -h, --help  show this help message and exit
1058
1059
1060   rpkg upload
1061         usage: rpkg upload  [-h]  [--repo-path  REPO_PATH]  [--offline]  file
1062       [file ...]
1063
1064         This  command  will  upload  new  source  file(s) to lookaside cache.
1065       Source file
1066         names are appended to sources file, and .gitignore will be  also  up‐
1067       dated with
1068         new uploaded file(s). Please remember to commit them.
1069
1070         positional arguments:
1071           file                  List of files to upload
1072
1073         options:
1074           -h, --help            show this help message and exit
1075           --repo-path REPO_PATH
1076                                 Path  to  git  repository for which to upload
1077       sources. If
1078                                 not specified, it will be  automatically  de‐
1079       rived from
1080                                 remote URL configured for the current branch.
1081           --offline              Do  not actually upload the files but do all
1082       the rest,
1083                                 which  involves   updating   .gitignore   and
1084       sources file.
1085
1086
1087   rpkg verify-files
1088         usage: rpkg verify-files [-h] [target_dir]
1089
1090         Locally  run  'rpmbuild  -bl'  to verify the spec file's %%files sec‐
1091       tions. This
1092         requires a successful run of the install commaned in advance.
1093
1094         positional arguments:
1095           target_dir  Directory with build results to verify. If  not  speci‐
1096       fied, the
1097                       latest  package directory from base output path will be
1098       selected.
1099
1100         options:
1101           -h, --help  show this help message and exit
1102
1103

CONFIGURATION

1105       rpkg reads configuration options from the following files in  this  or‐
1106       der:
1107
1108           /etc/rpkg.conf,      ~/.config/rpkg.conf,     <git_root>/rpkg.conf,
1109       <pkg_path>/rpkg.conf
1110
1111       Configuration found in <pkg_path>/rpkg.conf has the  highest  priority.
1112       Configuration   found   in  /etc/rpkg.conf  has  the  lowest  priority.
1113       <git_root> placeholder above is the top level of the Git repository  we
1114       are working in. If we are in a plain directory (i.e.  there is not .git
1115       subdir) and all our parent  directories  are  also  plain,  reading  of
1116       <git_root>/rpkg.conf  is skipped. <pkg_path> is CWD, by default, but it
1117       can be overriden with --path argument and --spec argument,  the  latter
1118       having higher priority.
1119
1120       There  are also built-in default values for each variable that are used
1121       if the variable is not specified in any configuration file. You can see
1122       them below together with the variable descriptions.
1123
1124
1125   DEFAULT CONFIGURATION WITH DESCRIPTIONS
1126           [rpkg]
1127           # Whether to enable spec preprocessing,
1128           # that is parsing and evaluation of {{{ ... }}} expressions
1129           # type: bool
1130           preprocess_spec = True
1131
1132           # Base directory where generated files should be put.
1133           # The files will not be put directly there but
1134           # instead into dynamically generated subdirectories
1135           # type: string
1136           base_output_path = /tmp/rpkg
1137
1138           # Path to user preproc macros. You may use ${git_props:root}
1139           # variable to anchor the path to top-level of your git repo.
1140           # type: list of space-separated strings
1141           user_macros =
1142
1143           # rpm bcondition "with" specifier
1144           # type: list of space-separated strings
1145           with =
1146
1147           # rpm bcondition "without" specifier
1148           # type: list of space-separated strings
1149           without =
1150
1151           # Defines rpm variables for spec parsing
1152           #  type:  list  of  space-separated quoted string pairs (e.g. 'dist
1153       %nil')
1154           rpmdefines =
1155
1156           # Defines rpm variables for spec parsing during
1157           # version/release bumping (see the tag subcommand)
1158           # This list is not being concatenated with rpmdefines.
1159           # type: list of space-separated quoted string pairs
1160           bump_rpmdefines = 'dist %nil'
1161
1162           # Path to rpmlint configuration (see the lint subcommand)
1163           # type: string
1164           rpmlint_config =
1165
1166           # Paths to default preproc macros relative to
1167           # /usr/lib/rpkg.macros.d directory
1168           # type: list of space-separated strings
1169           default_macros = git.bash
1170
1171           [git]
1172           # Default Git repository URL, used by `rpkg clone <repo_path>`
1173           # type: string
1174           clone_url =
1175
1176           # Default Git repository URL, used by `rpkg clone -a <repo_path>`
1177           # type: string
1178           anon_clone_url =
1179
1180           # If you clone a project with rpkg clone and specify only
1181           # its basename (i.e. the last part like "dist-git"), then
1182           # default namespace (e.g. rpms) will be automatically
1183           # prepended to it together with ending slash if specified.
1184           # type: string
1185           default_namespace =
1186
1187           # Whether to automatically push tags with rpkg push
1188           # type: bool
1189           push_follow_tags = True
1190
1191           # Allows removing of files and directories
1192           # for rpkg clean operation
1193           # type: bool
1194           clean_force = True
1195
1196           # Whether rpkg clean should descend into
1197           # untracked directories
1198           # type: bool
1199           clean_dirs = True
1200
1201           # Whether rpkg log should be in graph form
1202           # type: bool
1203           log_graph = True
1204
1205           # Whether rpkg log should display all branches
1206           # type: bool
1207           log_all = True
1208
1209           # Key to sign commits and tags with. Specifying
1210           # it enables signing.
1211           # type: bool
1212           gpg_keyid =
1213
1214           # In which Copr project to build a package by using
1215           # rpkg build command, in form: user/project or @group/project
1216           # type: string
1217           copr_project =
1218
1219           [lookaside]
1220           # Download URL for DistGit lookaside cache, used by rpkg sources.
1221           # There are some dynamic variables, you can use:
1222           # %(repo_path)s is a module name (e.g. rpms/rpkg-util)
1223           # %(filename)s, %(hashtype)s,  %(hash)s,  %(filename)s  fields  are
1224       read from 'sources' file, if present
1225           # Further, you can use ${git_props:remote_netloc} interpolation
1226           # variable to base the download URL on git clone URL.
1227           # type: string
1228           download_url =
1229
1230           # Upload URL for DistGit lookaside cache, used by rpkg upload.
1231           # You can use ${git_props:remote_netloc} interpolation
1232           # variable to base the download URL on git clone URL.
1233           # type: string
1234           upload_url =
1235
1236           # For client certificate authentication if employed
1237           # by the server
1238           # type: string
1239           client_cert =
1240
1241           # For client certificate authentication if employed
1242           # by the server
1243           # type: string
1244           client_key =
1245
1246           # For client certificate authentication if employed
1247           # by the server
1248           # type: string
1249           ca_cert =
1250
1251
1252   DYNAMIC CONFIGURATION SECTIONS
1253       There  are  also  other  config sections which are dynamically added by
1254       rpkg during runtime. These are [DEFAULT] (containing  user,  path,  and
1255       pkg_path  properties)  and  [git_props]  (containing lots of git status
1256       specific information). You can print the whole final config  (including
1257       those sections) with rpkg config command.
1258
1259
1260   INTERPOLATION
1261       When specifying configuration values, you can use interpolation to ref‐
1262       erence another configuration variable even from  another  section.  The
1263       syntax is: ${<section name>:<param name>} (e.g. ${git_props:remote_net‐
1264       loc}).
1265
1266       There is also %(<var>)s  interpolation  for  some  fields  like  looka‐
1267       side:download_url.  The variables you can interpolate like this are al‐
1268       ways field-specific.
1269
1270

EXAMPLES

1272       Run %prep phase of an rpm build:
1273
1274           $ rpkg prep
1275           git_dir_pack: packing path /home/clime/rpkg-util
1276           git_dir_pack:   Wrote:   /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util-
1277       f01b36d7-dirty.tar.gz
1278           Wrote: /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util.spec
1279           Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.iqrI6z
1280           + umask 022
1281           + cd /tmp/rpkg/rpkg-util-12-ft3gm2mw
1282           + cd /tmp/rpkg/rpkg-util-12-ft3gm2mw
1283           + rm -rf rpkg-util
1284           +   /usr/bin/gzip   -dc  /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util-
1285       f01b36d7-dirty.tar.gz
1286           + /usr/bin/tar -xof -
1287           + STATUS=0
1288           + '[' 0 -ne 0 ']'
1289           + cd rpkg-util
1290           + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
1291           + RPM_EC=0
1292           ++ jobs -p
1293           + exit 0
1294
1295       Generate spec file from a template:
1296
1297           $ rpkg spec
1298           Wrote: /tmp/rpkg/rpkg-util-13-53194610/rpkg-util.spec
1299
1300       Build srpm:
1301
1302           $ rpkg srpm
1303           git_dir_pack: packing path /home/clime/rpkg-util
1304           git_dir_pack:   Wrote:   /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util-
1305       f01b36d7-dirty.tar.gz
1306           Wrote: /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util.spec
1307           Wrote:           /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util-3.proto‐
1308       type.git.229.f01b36d7.dirty.02idw5-1.fc31.src.rpm
1309
1310

SPEC TEMPLATES

1312       Apart from being useful as a means to handle unpacked as well as packed
1313       content,  they  also make it possible to generate certain parts of your
1314       spec file automatically from a Git repository where your spec  file  is
1315       located. You need to have "preprocess_spec" configuration option set to
1316       True in rpkg config to use this functionality.
1317
1318
1319   BASIC EXAMPLE
1320           Name:       {{{ git_dir_name }}}
1321           Version:    {{{ git_dir_version }}}
1322           Release:    1%{?dist}
1323           Summary:    This is a test package.
1324
1325           License:    GPLv2+
1326           URL:        https://someurl.org
1327           VCS:        {{{ git_dir_vcs }}}
1328
1329           Source:     {{{ git_dir_pack }}}
1330
1331           %description
1332           This is a test package.
1333
1334           %prep
1335           {{{ git_dir_setup_macro }}}
1336
1337           %changelog
1338           {{{ git_dir_changelog }}}
1339
1340       Having a spec template like this in your project  (instead  of  just  a
1341       plain  spec file) allows you to build source and rpm packages automati‐
1342       cally following git history of your project.
1343
1344
1345   MACRO REFERENCE
1346       Please, see dedicated rpkg-macros page.
1347
1348

USER-DEFINED MACROS

1350       You can define your own rpkg macros. They are basically  just  standard
1351       bash functions read from file specified by user_macros config variable.
1352       When used, standard output of your custom macro will  be  captured  and
1353       the  {{{  <macro_name> }}} invocation in an input spec file will be re‐
1354       placed with it.
1355
1356       Example of a custom macro placed in repo-specific rpkg.macros file:
1357
1358           function my_git_commits_no {
1359               total_commits=$(git rev-list --all --count)
1360               echo -n "$total_commits"
1361           }
1362
1363       If you have got rpkg.macros file with this content in git top-level di‐
1364       rectory  for your project, then also create rpkg.conf file in your top-
1365       level dir with at least the following content:
1366
1367           [rpkg]
1368           user_macros = ${git_props:root}/rpkg.macros
1369
1370       This will enable reading of the custom user macros. In the  spec  file,
1371       you can then e.g. use this snippet:
1372
1373       Release: {{{ my_git_commits_no }}}
1374
1375       to enable generating release based on total number of commits.
1376
1377

SEE ALSO

1379       https://pagure.io/rpkg-util/
1380
1381
1382
1383                                  2021-07-23                           rpkg(1)
Impressum