Skip to content

Commit

Permalink
Merge pull request #5 from LeTabouret/fix-pipeline-build-steam
Browse files Browse the repository at this point in the history
Fix build failling.
  • Loading branch information
LeTabouret authored May 19, 2024
2 parents 797cf6d + c6f7187 commit b997b2f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
24 changes: 10 additions & 14 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ RELEASE="$(rpm -E %fedora)"
PACKAGE_LIST="up"
FEDORA_MAJOR_VERSION=$RELEASE

# build list of all packages requested for inclusion
# Build list of all packages requested for inclusion
INCLUDED_PACKAGES=($(jq -r "[(.all.include | (select(.\"$PACKAGE_LIST\" != null).\"$PACKAGE_LIST\")[]), \
(select(.\"$FEDORA_MAJOR_VERSION\" != null).\"$FEDORA_MAJOR_VERSION\".include | (select(.\"$PACKAGE_LIST\" != null).\"$PACKAGE_LIST\")[])] \
| sort | unique[]" /tmp/packages.json))

# build list of all packages requested for override
# Build list of all packages requested for override
CONFLICTED_PACKAGES=($(jq -r "[(.all.conflictedpackages | (select(.\"$PACKAGE_LIST\" != null).\"$PACKAGE_LIST\")[]), \
(select(.\"$FEDORA_MAJOR_VERSION\" != null).\"$FEDORA_MAJOR_VERSION\".conflictedpackages | (select(.\"$PACKAGE_LIST\" != null).\"$PACKAGE_LIST\")[])] \
| sort | unique[]" /tmp/packages.json))

# build list of all packages requested for exclusion
# Build list of all packages requested for exclusion
EXCLUDED_PACKAGES=($(jq -r "[(.all.exclude | (select(.\"$PACKAGE_LIST\" != null).\"$PACKAGE_LIST\")[]), \
(select(.\"$FEDORA_MAJOR_VERSION\" != null).\"$FEDORA_MAJOR_VERSION\".exclude | (select(.\"$PACKAGE_LIST\" != null).\"$PACKAGE_LIST\")[])] \
| sort | unique[]" /tmp/packages.json))


# ensure exclusion list only contains packages already present on image
# Ensure exclusion list only contains packages already present on image
if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
EXCLUDED_PACKAGES=($(rpm -qa --queryformat='%{NAME} ' ${EXCLUDED_PACKAGES[@]}))
fi
Expand All @@ -36,31 +36,27 @@ if [[ "${#CONFLICTED_PACKAGES[@]}" -gt 0 ]]; then
done
fi

# simple case to install where no packages need excluding
# Simple case to install where no packages need excluding
if [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#EXCLUDED_PACKAGES[@]}" -eq 0 ]]; then
rpm-ostree install \
${INCLUDED_PACKAGES[@]}

# install/excluded packages both at same time
# Install/excluded packages both at same time
elif [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override remove \
${EXCLUDED_PACKAGES[@]} \
$(printf -- "--install=%s " ${INCLUDED_PACKAGES[@]})

else
echo "No packages to install."

fi

# Install conflicted packages to resolve dependencies
if [[ "${#CONFLICTED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override replace \
--experimental \
--from repo=updates \
${CONFLICTED_PACKAGES[@]} || true
rpm-ostree install ${CONFLICTED_PACKAGES[@]}
fi

# check if any excluded packages are still present
# Check if any excluded packages are still present
# (this can happen if an included package pulls in a dependency)
EXCLUDED_PACKAGES=($(jq -r "[(.all.exclude | (select(.\"$PACKAGE_LIST\" != null).\"$PACKAGE_LIST\")[]), \
(select(.\"$FEDORA_MAJOR_VERSION\" != null).\"$FEDORA_MAJOR_VERSION\".exclude | (select(.\"$PACKAGE_LIST\" != null).\"$PACKAGE_LIST\")[])] \
Expand All @@ -70,8 +66,8 @@ if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
EXCLUDED_PACKAGES=($(rpm -qa --queryformat='%{NAME} ' ${EXCLUDED_PACKAGES[@]}))
fi

# remove any exluded packages which are still present on image
# Remove any excluded packages which are still present on image
if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override remove \
${EXCLUDED_PACKAGES[@]}
fi
fi
3 changes: 2 additions & 1 deletion packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
},
"conflictedpackages": {
"up": [
"steam"
"steam",
"libvirt"
]
},
"exclude": {
Expand Down

0 comments on commit b997b2f

Please sign in to comment.