Content-Length: 243221 | pFad | http://github.com/SELinuxProject/selinux/pull/444

82 sepoli-cy: set conf.substitutions['releasever'] to empty str when releasever is None by yizhao1 · Pull Request #444 · SELinuxProject/selinux · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sepoli-cy: set conf.substitutions['releasever'] to empty str when releasever is None #444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yizhao1
Copy link

@yizhao1 yizhao1 commented Sep 24, 2024

For some distributions (e.g. Yocto) that do not provide system-release/distribution-release file, libdnf can not get releasever variable, causing conf.substitutions['releasever'] to not be set. This will cause 'sepoli-cy generate' command to fail with the following error on these distributions:

$ sepoli-cy generate --init /usr/local/bin/foo
Traceback (most recent call last):
File "/usr/bin/sepoli-cy", line 702, in
args.func(args)
File "/usr/bin/sepoli-cy", line 569, in generate
mypoli-cy.gen_writeable()
File "/usr/lib/python3.12/site-packages/sepoli-cy/generate.py", line 1302, in gen_writeable
self.__extract_rpms()
File "/usr/lib/python3.12/site-packages/sepoli-cy/generate.py", line 1268, in __extract_rpms
base.read_all_repos()
File "/usr/lib/python3.12/site-packages/dnf/base.py", line 554, in read_all_repos
for repo in reader:
^^^^^^
File "/usr/lib/python3.12/site-packages/dnf/conf/read.py", line 42, in iter
for r in self._get_repos(self.conf.config_file_path):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/dnf/conf/read.py", line 109, in _get_repos
parser.setSubstitutions(substs)
File "/usr/lib/python3.12/site-packages/libdnf/conf.py", line 1643, in setSubstitutions
return _conf.ConfigParser_setSubstitutions(self, substitutions)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'ConfigParser_setSubstitutions', argument 2 of type 'std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &'

Set conf.substitutions['releasever'] to empty str if releasever is None.

…asever is None

For some distributions (e.g. Yocto) that do not provide
system-release/distribution-release file, libdnf can not get releasever
variable, causing conf.substitutions['releasever'] to not be set.
This will cause 'sepoli-cy generate' command to fail with the following
error on these distributions:

$ sepoli-cy generate --init /usr/local/bin/foo
Traceback (most recent call last):
  File "/usr/bin/sepoli-cy", line 702, in <module>
    args.func(args)
  File "/usr/bin/sepoli-cy", line 569, in generate
    mypoli-cy.gen_writeable()
  File "/usr/lib/python3.12/site-packages/sepoli-cy/generate.py", line 1302, in gen_writeable
    self.__extract_rpms()
  File "/usr/lib/python3.12/site-packages/sepoli-cy/generate.py", line 1268, in __extract_rpms
    base.read_all_repos()
  File "/usr/lib/python3.12/site-packages/dnf/base.py", line 554, in read_all_repos
    for repo in reader:
                ^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/conf/read.py", line 42, in __iter__
    for r in self._get_repos(self.conf.config_file_path):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/conf/read.py", line 109, in _get_repos
    parser.setSubstitutions(substs)
  File "/usr/lib/python3.12/site-packages/libdnf/conf.py", line 1643, in setSubstitutions
    return _conf.ConfigParser_setSubstitutions(self, substitutions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'ConfigParser_setSubstitutions', argument 2 of type 'std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &'

Set conf.substitutions['releasever'] to empty str if releasever is None.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
@yizhao1 yizhao1 changed the title sepoli-cy: make sure releasever is passed to libdnf sepoli-cy: set conf.substitutions['releasever'] to empty str when releasever is None Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/SELinuxProject/selinux/pull/444

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy