参考链接:
https://www.zhukun.net/archives/6881
mock
一般初始化命令:
mock -r fedora-15-x86_64 --init
这样在/var/lib/mock/fedora-15-x86_64
目录下会生成 result
以及 root
目录。
但是,有时根目录空间不够,导致无法进行mock
编译。需要手动指定root
目录所在位置。(主要是root
占用空间比较大)
则可以使用下面的命令,在编译时指定root
目录到/mnt/disk
mock -r fedora-15-x86_64 --rootdir=/mnt/disk/
mock
帮助内容:[adams@localhost ~]$ mock --help
Usage: mock [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
--rebuild rebuild the specified SRPM(s)
--chain build multiple RPMs in chain loop
--buildsrpm Build a SRPM from spec (--spec ...) and
sources(--sources ...) or from SCM
--debug-config Prints all options in config_opts
--shell run the specified command interactively within the
chroot. Default command: /bin/sh
--chroot run the specified command noninteractively within the
chroot.
--clean completely remove the specified chroot
--scrub=[all|chroot|cache|root-cache|c-cache|yum-cache|dnf-cache]
completely remove the specified chroot or cache dir or
all of the chroot and cache
--init initialize the chroot, do not build anything
--installdeps install build dependencies for a specified SRPM or
SPEC file
-i, --install install packages using package manager
--update update installed packages using package manager
--remove remove packages using package manager
--orphanskill Kill all processes using specified buildroot.
--copyin Copy file(s) into the specified chroot
--copyout Copy file(s) from the specified chroot
--pm-cmd Execute package management command (with yum or dnf)
--yum-cmd Execute package management command with yum
--dnf-cmd Execute package management command with dnf
--snapshot Create a new LVM/overlayfs snapshot with given name
--remove-snapshot Remove LVM/overlayfs snapshot with given name
--rollback-to Rollback to given snapshot
--umount Umount the buildroot if it's mounted from separate
device (LVM/overlayfs)
--mount Mount the buildroot if it's mounted from separate
device (LVM/overlayfs)
--localrepo=LOCALREPO
local path for the local repo, defaults to making its
own (--chain mode only)
-c, --continue if a pkg fails to build, continue to the next one
-a REPOS, --addrepo=REPOS
add these repo baseurls to the chroot's yum config
--recurse if more than one pkg and it fails to build, try to
build the rest and come back to it
--tmp_prefix=TMP_PREFIX
tmp dir prefix - will default to username-pid if not
specified
-r CONFIG, --root=CONFIG
chroot config file name or path. Taken as a path if it
ends in .cfg, otherwise looked up in the configdir.
default: default
--offline activate 'offline' mode.
-n, --no-clean do not clean chroot before building
--cleanup-after Clean chroot after building. Use with --resultdir.
Only active for 'rebuild'.
-N, --no-cleanup-after
Don't clean chroot after building. If automatic
cleanup is enabled, use this to disable.
--cache-alterations Rebuild the root cache after making alterations to the
chroot (i.e. --install). Only useful when using tmpfs
plugin.
--nocheck pass --nocheck to rpmbuild to skip 'make check' tests
--arch=ARCH Sets kernel personality().
--forcearch=FORCEARCH
Force architecture to DNF (pass --forcearch to DNF).
--target=RPMBUILD_ARCH
passed to rpmbuild as --target
-D 'MACRO EXPR', --define='MACRO EXPR'
define an rpm macro (may be used more than once)
--macro-file=MACROFILE
Use pre-defined rpm macro file
--with=option enable configure option for build (may be used more
than once)
--without=option disable configure option for build (may be used more
than once)
--resultdir=RESULTDIR
path for resulting files to be put
--rootdir=ROOTDIR Path for where the chroot should be built
--uniqueext=UNIQUEEXT
Arbitrary, unique extension to append to buildroot
directory name
--configdir=CONFIGDIR
Change where config files are found
--config-opts=CLI_CONFIG_OPTS
Override configuration option.
--rpmbuild_timeout=RPMBUILD_TIMEOUT
Fail build if rpmbuild takes longer than 'timeout'
seconds
--unpriv Drop privileges before running command when using
--chroot
--cwd=DIR Change to the specified directory (relative to the
chroot) before running command when using --chroot
--spec=SPEC Specifies spec file to use to build an SRPM
--sources=SOURCES Specifies sources (either a single file or a directory
of files)to use to build an SRPM (used only with
--buildsrpm)
--symlink-dereference
Follow symlinks in sources (used only with
--buildsrpm)
--short-circuit=SHORT_CIRCUIT
Pass short-circuit option to rpmbuild to skip already
complete stages. Warning: produced packages are
unusable. Implies --no-clean. Valid options: build,
install, binary
--rpmbuild-opts=RPMBUILD_OPTS
Pass additional options to rpmbuild
--enablerepo=[repo] Pass enablerepo option to yum/dnf
--disablerepo=[repo] Pass disablerepo option to yum/dnf
--old-chroot Obsoleted. Use --isolation=simple
--new-chroot Obsoleted. Use --isolation=nspawn
--isolation=ISOLATION
what level of isolation to use. Valid option: simple,
nspawn
--enable-network enable networking.
--postinstall Try to install built packages in the same buildroot
right after build
-v, --verbose verbose build
-q, --quiet quiet build
--trace Enable internal mock tracing output.
--enable-plugin=ENABLED_PLUGINS
Enable plugin. Currently-available plugins: ['tmpfs',
'root_cache', 'yum_cache', 'mount', 'bind_mount',
'ccache', 'selinux', 'package_state', 'chroot_scan',
'lvm_root', 'compress_logs', 'sign', 'pm_request',
'hw_info', 'procenv']
--disable-plugin=DISABLED_PLUGINS
Disable plugin. Currently-available plugins: ['tmpfs',
'root_cache', 'yum_cache', 'mount', 'bind_mount',
'ccache', 'selinux', 'package_state', 'chroot_scan',
'lvm_root', 'compress_logs', 'sign', 'pm_request',
'hw_info', 'procenv']
--plugin-option=PLUGIN:KEY=VALUE
define an plugin option (may be used more than once)
-p, --print-root-path
print path to chroot root
-l, --list-snapshots list LVM/overlayfs snapshots associated with buildroot
--scm-enable build from SCM repository
--scm-option=SCM_OPTS
define an SCM option (may be used more than once)
--yum use yum as package manager
--dnf use dnf as package manager
--bootstrap-chroot build in two stages, using chroot rpm for creating the
build chroot
--no-bootstrap-chroot
build in a single stage, using system rpm for creating
the build chroot
--use-bootstrap-image
create bootstrap chroot from container image (turns
--bootstrap-chroot on)
--no-bootstrap-image don't create bootstrap chroot from container image
[adams@localhost ~]$