From 048670796ad7f94af50f66b45156901646c1a7f2 Mon Sep 17 00:00:00 2001 From: Louis Abel <label@rockylinux.org> Date: Mon, 24 Jun 2024 09:40:09 -0700 Subject: [PATCH] support *_only tags --- comps-rocky-10-lh.xml.in | 15 ++++++++++++--- scripts/Makefile | 34 ++++++++++++++++++++++++++++++++++ scripts/comps-distro-only.xsl | 32 ++++++++++++++++++++++++++++++++ scripts/update-comps | 13 +++++++++++-- 4 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 scripts/Makefile create mode 100644 scripts/comps-distro-only.xsl diff --git a/comps-rocky-10-lh.xml.in b/comps-rocky-10-lh.xml.in index 91c5e36..b31f11c 100644 --- a/comps-rocky-10-lh.xml.in +++ b/comps-rocky-10-lh.xml.in @@ -1,4 +1,4 @@ -<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd"> +<?xml version="1.0"?> <comps> <group variant="BaseOS"> <id>conflicts-baseos</id> @@ -254,6 +254,7 @@ <packagereq type="mandatory" variant="BaseOS">selinux-policy-targeted</packagereq> <packagereq type="mandatory" variant="BaseOS">setup</packagereq> <packagereq type="mandatory" variant="BaseOS">shadow-utils</packagereq> + <rhel_only><packagereq type="conditional" requires="redhat-release" variant="BaseOS">subscription-manager</packagereq></rhel_only> <packagereq type="mandatory" variant="BaseOS">sssd-common</packagereq> <packagereq type="mandatory" variant="BaseOS">sssd-kcm</packagereq> <packagereq type="mandatory" variant="BaseOS">sudo</packagereq> @@ -283,6 +284,8 @@ <packagereq type="default" variant="BaseOS">sg3_utils-libs</packagereq> <packagereq type="default" variant="BaseOS">initscripts-rename-device</packagereq> <packagereq type="default" variant="AppStream">python3-libselinux</packagereq> + <rhel_only><packagereq type="default" variant="AppStream">insights-client</packagereq></rhel_only> + <rhel_only><packagereq type="default" variant="AppStream">rhc</packagereq></rhel_only> <packagereq type="optional" variant="BaseOS">dracut-config-generic</packagereq> <packagereq type="optional" variant="BaseOS">dracut-network</packagereq> <packagereq type="optional" variant="BaseOS" arch="s390x">libzfcphbaapi</packagereq> @@ -1059,6 +1062,8 @@ <packagereq type="default" variant="BaseOS">sos</packagereq> <packagereq type="default" variant="BaseOS">sssd</packagereq> <packagereq type="default" variant="BaseOS">strace</packagereq> + <rhel_only><packagereq type="conditional" requires="redhat-release" variant="BaseOS">subscription-manager-cockpit</packagereq></rhel_only> + <rhel_only><packagereq type="conditional" requires="redhat-release" variant="BaseOS">libdnf-plugin-subscription-manager</packagereq></rhel_only> <packagereq type="default" variant="BaseOS">time</packagereq> <packagereq type="default" variant="BaseOS">unzip</packagereq> <packagereq type="default" variant="BaseOS">usbutils</packagereq> @@ -1083,6 +1088,7 @@ <packagereq type="default" variant="AppStream">wget</packagereq> <packagereq type="default" variant="AppStream">vim-enhanced</packagereq> <packagereq type="default" variant="AppStream">insights-client</packagereq> + <rhel_only><packagereq type="default" variant="AppStream">rhc</packagereq></rhel_only> </packagelist> </group> <group> @@ -1162,6 +1168,8 @@ <packagereq type="default" variant="BaseOS">sos</packagereq> <packagereq type="default" variant="BaseOS">sssd</packagereq> <packagereq type="default" variant="BaseOS">strace</packagereq> + <rhel_only><packagereq type="conditional" requires="redhat-release" variant="BaseOS">subscription-manager-cockpit</packagereq></rhel_only> + <rhel_only><packagereq type="conditional" requires="redhat-release" variant="BaseOS">libdnf-plugin-subscription-manager</packagereq></rhel_only> <packagereq type="default" variant="BaseOS">time</packagereq> <packagereq type="default" variant="BaseOS">unzip</packagereq> <packagereq type="default" variant="BaseOS">usbutils</packagereq> @@ -1185,7 +1193,8 @@ <packagereq type="default" variant="AppStream">tcpdump</packagereq> <packagereq type="default" variant="AppStream">wget</packagereq> <packagereq type="default" variant="AppStream">vim-enhanced</packagereq> - <packagereq type="default" variant="AppStream">insights-client</packagereq> + <rhel_only><packagereq type="default" variant="AppStream">insights-client</packagereq></rhel_only> + <rhel_only><packagereq type="default" variant="AppStream">rhc</packagereq></rhel_only> </packagelist> </group> <group> @@ -2129,7 +2138,7 @@ <packagereq type="default" variant="AppStream">perl-generators</packagereq> <packagereq type="default" variant="AppStream">perl-Fedora-VSP</packagereq> <packagereq type="default" variant="AppStream" arch="aarch64,x86_64">pesign</packagereq> - <packagereq type="default" variant="AppStream" >source-highlight</packagereq> + <packagereq type="default" variant="AppStream">source-highlight</packagereq> <packagereq type="default" variant="AppStream">systemtap</packagereq> <packagereq type="default" variant="AppStream">jna</packagereq> <packagereq type="default" arch="aarch64,ppc64le,x86_64,s390x" variant="AppStream">valgrind</packagereq> diff --git a/scripts/Makefile b/scripts/Makefile new file mode 100644 index 0000000..9ede2c9 --- /dev/null +++ b/scripts/Makefile @@ -0,0 +1,34 @@ +XMLINFILES=$(wildcard *.xml.in) +XMLFILES = $(patsubst %.xml.in,%.xml,$(XMLINFILES)) + +all: po $(XMLFILES) sort + +po: $(XMLINFILES) + make -C po -f Makefile || exit 1 + +clean: + @rm -fv *~ *.xml + +validate: $(XMLFILES) comps.rng + # Run xmllint on each file and exit with non-zero if any validation fails + RES=0; for f in $(XMLFILES); do \ + xmllint --noout --relaxng comps.rng $$f; \ + RES=$$(($$RES + $$?)); \ + done; exit $$RES + +sort: + @# Run xsltproc on each xml.in file and exit with non-zero if any sorting fails + @# The comps-eln.xml.in is not sorted alphabetically but manually + @# based on the need needs of Fedora ELN SIG. + @RES=0; for f in $(XMLINFILES); do \ + if [[ "$$f" == 'comps-eln.xml.in' ]]; then \ + continue; \ + fi; \ + xsltproc --novalid -o $$f comps-cleanup.xsl $$f; \ + RES=$$(($$RES + $$?)); \ + done; exit $$RES + +%.xml: %.xml.in + @xmllint --noout $< + @if test ".$(CLEANUP)" == .yes; then xsltproc --novalid -o $< comps-cleanup.xsl $<; fi + ./update-comps $@ $(DISTRO) diff --git a/scripts/comps-distro-only.xsl b/scripts/comps-distro-only.xsl new file mode 100644 index 0000000..26ebc55 --- /dev/null +++ b/scripts/comps-distro-only.xsl @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + version="1.1"> + <xsl:param name="distro"/> + + <xsl:template match="node()|@*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + + + <xsl:template match="rhel_only"> + <xsl:if test="$distro='rhel'"> + <xsl:apply-templates/> + </xsl:if> + </xsl:template> + + <xsl:template match="centos_only"> + <xsl:if test="$distro='centos'"> + <xsl:apply-templates/> + </xsl:if> + </xsl:template> + + <xsl:template match="rocky_only"> + <xsl:if test="$distro='rocky'"> + <xsl:apply-templates/> + </xsl:if> + </xsl:template> + +</xsl:stylesheet> diff --git a/scripts/update-comps b/scripts/update-comps index b163e1c..de1fa06 100755 --- a/scripts/update-comps +++ b/scripts/update-comps @@ -1,3 +1,12 @@ #!/bin/bash -COMPS_FILE=$1 -LANG=C intltool-merge -x -u po/ $COMPS_FILE.xml.in $COMPS_FILE.xml + +COMPSFILE=$1 +DISTRO=$2 + +if [ -z "$COMPSFILE" ]; then + echo "Usage: $0 <compsfile>" + exit 1 +fi + +LANG=C intltool-merge -x -u po/ $COMPSFILE.in $COMPSFILE +xsltproc --stringparam distro $DISTRO --novalid -o $COMPSFILE comps-distro-only.xsl $COMPSFILE -- GitLab