Skip to content

Commit

Permalink
packaging: refactor download list generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jbertran committed Sep 17, 2019
1 parent e551997 commit cff6b58
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions buildchain/buildchain/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def clean() -> None:
'_build_rpm_container'
],
'clean': [clean],
'uptodate': [config_changed(_TO_DOWNLOAD_CONFIG)],
'uptodate': [config_changed(_TO_DOWNLOAD_RPM_CONFIG)],
# Prevent Docker from polluting our output.
'verbosity': 0,
}
Expand Down Expand Up @@ -324,18 +324,27 @@ def _deb_package(name: str, sources: Path) -> targets.DEBPackage:
)


def _list_packages_to_download(
package_versions: Tuple[versions.Package, ...],
packages_to_build: List[str]
) -> Dict[str,str]:
return {
pkg.name: "{p.version}-{p.release}".format(p=pkg)
for pkg in package_versions
if pkg.name not in packages_to_build
}

# Store these versions in a dict to use with doit.tools.config_changed
_TO_DOWNLOAD_CONFIG : Dict[str, str] = {
pkg.name: "{p.version}-{p.release}".format(p=pkg)
for pkg in versions.RPM_PACKAGES
if pkg.name not in _RPM_TO_BUILD_PKG_NAMES
}
_TO_DOWNLOAD_RPM_CONFIG : Dict[str, str] = _list_packages_to_download(
versions.PACKAGES,
_RPM_TO_BUILD_PKG_NAMES
)

_TO_DOWNLOAD_DEB_CONFIG : Dict[str, str] = {
pkg.name: "{p.version}-{p.release}".format(p=pkg)
for pkg in versions.DEB_PACKAGES
if pkg.name not in _DEB_TO_BUILD_PKG_NAMES
}
# Store these versions in a dict to use with doit.tools.config_changed
_TO_DOWNLOAD_DEB_CONFIG : Dict[str, str] = _list_packages_to_download(
versions.DEB_PACKAGES,
_DEB_TO_BUILD_PKG_NAMES
)


SCALITY_RPM_REPOSITORY = targets.RPMRepository(
Expand Down

0 comments on commit cff6b58

Please sign in to comment.