#4529 Parsing primary.xml error - when building packages for RHEL7
Closed: Fixed by mou5e. Opened by mou5e.

Hi,
i am trying to upgrade koji from 1.33 to 1.35 and fedora from 38 to 42.
When I updated to fedora 39 and koji-1.35-1, builds for RHEL7 stopped working.
I have the following custom mock options on my build tag:

mock.package_manager : 'yum'
mock.use_bootstrap : True

The builds always go with the mock installing yum using dnf-3, then failing to install srpm-build using yum with the below error:

===
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.
 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).
 3. Run the command with the repository temporarily disabled
        yum --disablerepo=<repoid> ...
 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:
        yum-config-manager --disable <repoid>
    or
        subscription-manager repos --disable=<repoid>
 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:
        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Parsing primary.xml error: Start tag expected, '<' not found

Using dnf as a package manager in RHEL7 builds is not an option. I've tried not using bootstrap, but the result is the same. I've also tried using a podman image of RHEL7 container image from a registry, but the result is the same, except mock isn't trying to install yum, as it is already in the image.

Thanks in advance!


There is not really enough information here to diagnose.

Is this error from root.log for the buildSRPMFromSCM subtask? Somewhere else?

Have you checked the primary.xml file for the repo in question. Is it valid? Can the builder access it?

Metadata Update from @mikem:
- Custom field Size adjusted to None

Hi,
yes, the error is from root.log of the buildSRPMFromSCM subtask.

primary.xml is with archived with .zst.
I think it's from the new version 1.x of createrepo_c, which does this type of archiving by default. However, I have added options in different combinations like '--compatibility' and/or '--general-compress-type=gz' and/or '--retain-old-md=0' and/or '--compress-type=gz' directly into /usr/sbin/kojid

on line 6013:

def create_local_repo(self, rinfo, arch, pkglist, groupdata, oldrepo):
koji.ensuredir(self.outdir)
if self.options.use_createrepo_c:
cmd = ['/usr/bin/createrepo_c', '--error-exit-val']<--- here

and on line 6365:

    koji.ensuredir(repodir)
    if self.options.use_createrepo_c:
        cmd = ['/usr/bin/createrepo_c', '--error-exit-val'] <--- here

Afterwards, after restarting kojid, in the createrepo.log of newRepo task, I can see that it executes it like this (for example with '--retain-old-md=0' and '--general-compress-type=gz':

$ /usr/bin/createrepo_c --error-exit-val --compatibility --retain-old-md=0 --general-compress-type=gz -vd -o /aux1/koji/tasks/7668/707668/repo -i /aux1/koji/repos/2018r5-el7-build/197579/x86_64/pkglist -g /aux1/koji/repos/2018r5-el7-build/197579/groups/comps.xml /aux1/koji/repos/2018r5-el7-build/197579/x86_64

, but again, the repodata files are in .zst archive format:

ls -la /aux1/koji/repos/2018r5-el7-build/latest/x86_64/repodata/

total 41828
drwxr-xr-x 2 apache apache 4096 Jan 20 12:24 .
drwxr-xr-x 3 apache apache 4096 Jan 20 12:24 ..
-rw-r--r-- 1 apache apache 51 Jan 20 12:24 15785a63d2ef1d07302d019d57565000357f16c1421237558eba5342e218f36d-updateinfo.xml.zst
-rw-r--r-- 1 apache apache 27464868 Jan 20 12:24 20e045eafd81d9f8d683637b95c662de12c3333aaad6c82dab19d23fadbc16f4-filelists.xml.zst
-rw-r--r-- 1 apache apache 4760475 Jan 20 12:24 2f9b26e19dcfb7e6c54d11446dad0186fee49a960ec14032c0b3df067d42310a-other.xml.zst
-rw-r--r-- 1 apache apache 10029529 Jan 20 12:24 94768a41202697e9c85c52d1d51243fd23e111737ce6c912c681a89f3c76cba0-primary.xml.zst
-rw-r--r-- 1 apache apache 526 Jan 20 12:24 e8b461e4370a87c5d4d1956ca203b4c682bbd84a3fa426a1fa8b931f6528e5b3-comps.xml.zst
-rw-r--r-- 1 apache apache 545774 Jan 20 12:24 ec8f8f399a60f573ee7e68b0e97ebfc94ba2442d1b28abd9980c4bd0b75c6017-pkgorigins.gz
-rw-r--r-- 1 apache apache 2951 Jan 20 12:24 repomd.xml

I have no idea why any of the options do not work, although the command seems correct and the task finished successfully.

Thanks!

A possible workaround is to use the channel policy to limit your creatrepo tasks to only builders running an older platform.

Is there any (I suspect that yes) external repo included? In my dev env this is rewritten later by running mergerepo_c. Can you try add --compress-type gz also to mergerepo_c calls?

Btw, simple check that createrepo_c works is to create empty build tag and run repo regen against that. It would be the simplest code path.

Hi again,

adding --compress-type=gz to mergerepo_c is fine, but kojid does not leave comps.xml uncompressed, so this led to another issue with building the package. Obviously yum cannot read compressed comps.xml:

DEBUG util.py:459: Failed to add groups file for repository: build - comps file is empty/damaged

In Fedora38 and koji 1.33, there is the comps.xml both uncompressed and compressed.

So, builds for RHEL7 only work if I manually decompress comps.xml and change the checksum, location, timestamp and size of comps.xml in repomd.xml

Metadata Update from @tkopecek:
- Issue set to the milestone: 1.37

Ah, right, I missed that this was rhel7 at first pass.

Createrepo_c simply does not play nice with rhel7 anymore. I had to create a custom build of createrepo_c to make rhel7 builds work.

See https://github.com/rpm-software-management/createrepo_c/issues/403

Here are the patches I used. ymmv.

0001-default-to-gz-compression.patch

0002-skip-compressing-group-metadata-for-rhel7-compat.patch

0003-apply-compression-changes-to-mergerepo_c.patch

Hi,

I have managed to patch and build createrepo_c and builds for RHEL7 work now.

Thank you very much!

Metadata Update from @mou5e:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/4529

Please continue any further discussion there.

Metadata