pyanaconda.packaging package

Submodules

pyanaconda.packaging.dnfpayload module

class pyanaconda.packaging.dnfpayload.DNFPayload(data)

Bases: pyanaconda.packaging.PackagePayload

addRepo(ksrepo)

Add a repo to dnf and kickstart repo lists

Parameters:ksrepo (Kickstart RepoData object.) – Kickstart Repository to add
Returns:None
baseRepo
checkSoftwareSelection()
disableRepo(repo_id)
enableRepo(repo_id)
environmentDescription(environmentid)
environmentGroups(environmentid, optional=True)
environmentHasOption(environmentid, grpid)
environmentOptionIsDefault(environmentid, grpid)
environments
gatherRepoMetadata()
getRepo(repo_id)

Return the yum repo object.

groupDescription(grpid)

Return name/description tuple for the group specified by id.

groups
install()
isRepoEnabled(repo_id)
languageGroups()
mirrorEnabled
postInstall()

Perform post-installation tasks.

preInstall(packages=None, groups=None)
repos
reset()
spaceRequired
unsetup()
updateBaseRepo(fallback=True, checkmount=True)
class pyanaconda.packaging.dnfpayload.DownloadProgress

Bases: dnf.callback.DownloadProgress

end(payload, status, err_msg)
progress(payload, done)
start(total_files, total_size)
class pyanaconda.packaging.dnfpayload.PayloadRPMDisplay(queue_instance)

Bases: dnf.yum.rpmtrans.LoggingTransactionDisplay

event(package, action, te_current, te_total, ts_current, ts_total)
pyanaconda.packaging.dnfpayload.do_transaction(base, queue_instance)

pyanaconda.packaging.livepayload module

TODO
  • error handling!!!

  • document all methods

  • LiveImagePayload
    • register the live image, either via self.data.method or in setup using storage
class pyanaconda.packaging.livepayload.DownloadProgress

Bases: builtins.object

Provide methods for download progress reporting.

end(bytes_read)

Download complete

Parameters:bytes_read (int) – Bytes read so far
start(url, size)

Start of download

Parameters:
  • url (str) – url of the download
  • size (int) – length of the file
update(bytes_read)

Download update

Parameters:bytes_read (int) – Bytes read so far
class pyanaconda.packaging.livepayload.LiveImageKSPayload(*args, **kwargs)

Bases: pyanaconda.packaging.livepayload.LiveImagePayload

Install using a live filesystem image from the network

install()

Install the payload if it is a tar. Otherwise fall back to rsync of INSTALL_TREE

is_tarfile

Return True if the url ends with a tar suffix

kernelVersionList
postInstall()

Unmount and remove image

If file:// was used, just unmount it.

preInstall(*args, **kwargs)

Get image and loopback mount it.

This is called after partitioning is setup, we now have space to grab the image. If it is a network source Download it to sysroot and provide feedback during the download (using urlgrabber callback).

If it is a file:// source then use the file directly.

setup(storage, instClass)

Check the availability and size of the image.

spaceRequired

We don’t know the filesystem size until it is downloaded.

Default to 1G which should be enough for a minimal image download and install.

unsetup()
writeStorageEarly()
class pyanaconda.packaging.livepayload.LiveImagePayload(*args, **kwargs)

Bases: pyanaconda.packaging.ImagePayload

A LivePayload copies the source image onto the target system.

install()

Install the payload.

kernelVersionList
postInstall()

Perform post-installation tasks.

preInstall(packages=None, groups=None)

Perform pre-installation tasks.

progress()

Monitor the amount of disk space used on the target and source and update the hub’s progress bar.

setup(storage, instClass)
spaceRequired
unsetup()

pyanaconda.packaging.rpmostreepayload module

class pyanaconda.packaging.rpmostreepayload.RPMOSTreePayload(data)

Bases: pyanaconda.packaging.ArchivePayload

A RPMOSTreePayload deploys a tree (possibly with layered packages) onto the target system.

handlesBootloaderConfiguration
install()
kernelVersionList
postInstall()
prepareMountTargets(storage)
recreateInitrds()
spaceRequired
writeStorageEarly()

pyanaconda.packaging.tarpayload module

TODO
  • error handling!!!
  • document all methods
class pyanaconda.packaging.tarpayload.TarPayload(data)

Bases: pyanaconda.packaging.ArchivePayload

A TarPayload unpacks a single tar archive onto the target system.

install()
kernelVersionList
requiredSpace
setup(storage, instClass)
unsetup()

Module contents

TODO
  • error handling!!!
  • document all methods
class pyanaconda.packaging.ArchivePayload(data)

Bases: pyanaconda.packaging.ImagePayload

An ArchivePayload unpacks source archives onto the target system.

exception pyanaconda.packaging.DependencyError

Bases: pyanaconda.packaging.PayloadError

exception pyanaconda.packaging.ImageDirectoryMountError

Bases: pyanaconda.packaging.PayloadSetupError

exception pyanaconda.packaging.ImageMissingError

Bases: pyanaconda.packaging.PayloadSetupError

class pyanaconda.packaging.ImagePayload(data)

Bases: pyanaconda.packaging.Payload

An ImagePayload installs an OS image to the target system.

exception pyanaconda.packaging.MetadataError

Bases: pyanaconda.packaging.PayloadError

exception pyanaconda.packaging.NoNetworkError

Bases: pyanaconda.packaging.PayloadError

exception pyanaconda.packaging.NoSuchGroup(group, adding=True, required=False)

Bases: pyanaconda.packaging.PayloadError

exception pyanaconda.packaging.NoSuchPackage(package, required=False)

Bases: pyanaconda.packaging.PayloadError

class pyanaconda.packaging.PackagePayload(data)

Bases: pyanaconda.packaging.Payload

A PackagePayload installs a set of packages onto the target system.

DEFAULT_REPOS = ['anaconda', 'rawhide']
ISOImage

The location of a mounted ISO repo, or None.

addDriverRepos()

Add driver repositories and packages

environmentAddons
environmentDescription(environmentid)
environmentGroups(environmentid, optional=True)
environmentHasOption(environmentid, grpid)
environmentOptionIsDefault(environmentid, grpid)
environments
groupDescription(groupid)
groups
kernelPackages
kernelVersionList
preInstall(packages=None, groups=None)
repos

A list of repo identifiers, not objects themselves.

reset()
reset_install_device()

Unmount the previous base repo and reset the install_device

rpmMacros

A list of (name, value) pairs to define as macros in the rpm transaction.

selectEnvironment(environmentid, excluded=None)
class pyanaconda.packaging.Payload(data)

Bases: builtins.object

Payload is an abstract class for OS install delivery methods.

data is a kickstart.AnacondaKSHandler class

addOns

A list of addon repo identifiers.

addRepo(newrepo)

Add the repo given by the pykickstart Repo object newrepo to the system. The repo will be automatically enabled and its metadata fetched.

Duplicate repos will not raise an error. They should just silently take the place of the previous value.

baseRepo

Get the identifier of the current base repo. or None

deselectGroup(groupid)
disableRepo(repo_id)
dracutSetupArgs()
enableRepo(repo_id)
gatherRepoMetadata()
getAddOnRepo(repo_id)

Return a ksdata Repo instance matching the specified repo id.

groupSelected(groupid)
install()

Install the payload.

isRepoEnabled(repo_id)

Return True if repo is enabled.

kernelVersionList

An iterable of the kernel versions installed by the payload.

languageGroups()
mirrorEnabled

Is the closest/fastest mirror option enabled? This does not make sense for those payloads that do not support this concept.

needsNetwork
postInstall()

Perform post-installation tasks.

preInstall(packages=None, groups=None)

Perform pre-installation tasks.

preStorage()

Do any payload-specific work necessary before writing the storage configuration. This method need not be provided by all payloads.

prepareMountTargets(storage)

Run when physical storage is mounted, but other mount points may not exist. Used by the RPMOSTreePayload subclass.

recreateInitrds()

Recreate the initrds by calling new-kernel-pkg

This needs to be done after all configuration files have been written, since dracut depends on some of them.

Returns:None
release()

Release any resources in use by this object, but do not do final cleanup. This is useful for dealing with payload backends that do not get along well with multithreaded programs.

removeRepo(repo_id)
reset()

Reset the instance, not including ksdata.

selectGroup(groupid, default=True, optional=False)
setup(storage, instClass)

Do any payload-specific setup.

spaceRequired

The total disk space (Size) required for the current selection.

unsetup()

Invalidate a previously setup paylaod.

updateBaseRepo(fallback=True, checkmount=True)

Update the base repository from ksdata.method.

writeStorageEarly()

Some packaging payloads require that the storage configuration be written out before doing installation. Right now, this is basically just the dnfpayload. Payloads should only implement one of these methods by overriding the unneeded one with a pass.

writeStorageLate()

Some packaging payloads require that the storage configuration be written out after doing installation. Right now, this is basically every payload except for dnf. Payloads should only implement one of these methods by overriding the unneeded one with a pass.

exception pyanaconda.packaging.PayloadError

Bases: builtins.Exception

exception pyanaconda.packaging.PayloadInstallError

Bases: pyanaconda.packaging.PayloadError

class pyanaconda.packaging.PayloadManager

Bases: builtins.object

Framework for starting and watching the payload thread.

This class defines several states, and events can be triggered upon reaching a state. Depending on whether a state has already been reached when a listener is added, the event code may be run in either the calling thread or the payload thread. The event code will block the payload thread regardless, so try not to run anything that takes a long time.

All states except STATE_ERROR are expected to happen linearly, and adding a listener for a state that has already been reached or passed will immediately trigger that listener. For example, if the payload thread is currently in STATE_GROUP_MD, adding a listener for STATE_NETWORK will immediately run the code being added for STATE_NETWORK.

The payload thread data should be accessed using the payloadMgr object, and the running thread can be accessed using threadMgr with the THREAD_PAYLOAD constant, if you need to wait for it or something. The thread should be started using payloadMgr.restartThread.

ERROR_MD = 'Error downloading package metadata'
ERROR_SETUP = 'Failed to set up installation source'
ERROR_SOURCE = 'No installation source available'
STATE_ERROR = -1
STATE_FINISHED = 5
STATE_GROUP_MD = 4
STATE_NETWORK = 2
STATE_PACKAGE_MD = 3
STATE_START = 0
STATE_STORAGE = 1
addListener(event_id, func)

Add a listener for an event.

Parameters:
  • event_id (int) – The event to listen for, one of the EVENT_* constants
  • func (function) – An object to call when the event is reached
error
restartThread(storage, ksdata, payload, instClass, fallback=False, checkmount=True)

Start or restart the payload thread.

This method starts a new thread to restart the payload thread, so this method’s return is not blocked by waiting on the previous payload thread. If there is already a payload thread restart pending, this method has no effect.

Parameters:
  • storage (blivet.Blivet) – The blivet storage instance
  • ksdata (kickstart.AnacondaKSHandler) – The kickstart data instance
  • payload (packaging.Payload) – The payload instance
  • instClass (installclass.BaseInstallClass) – The install class instance
  • fallback (bool) – Whether to fall back to the default repo in case of error
  • checkmount (bool) – Whether to check for valid mounted media
exception pyanaconda.packaging.PayloadSetupError

Bases: pyanaconda.packaging.PayloadError

pyanaconda.packaging.versionCmp(v1, v2)

Compare two version number strings.