Initial commit
This commit is contained in:
commit
aef358286d
|
@ -0,0 +1,19 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.go]
|
||||
indent_size = 4
|
||||
|
||||
[*.py]
|
||||
indent_size = 4
|
|
@ -0,0 +1,204 @@
|
|||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
|
@ -0,0 +1,6 @@
|
|||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="-- peridot-releng-header-v0.1 -- Copyright (c) Peridot-Releng Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
|
||||
<option name="myName" value="Python" />
|
||||
</copyright>
|
||||
</component>
|
|
@ -0,0 +1,3 @@
|
|||
<component name="CopyrightManager">
|
||||
<settings default="Python" />
|
||||
</component>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GoogleJavaFormatSettings">
|
||||
<option name="enabled" value="false" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="Python 3.10 (peridot-releng)" project-jdk-type="Python SDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/peridot-releng.iml" filepath="$PROJECT_DIR$/.idea/peridot-releng.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Python" name="Python">
|
||||
<configuration sdkName="" />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
Mustafa Gezen <mustafa@ctrliq.com>
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) Peridot-Releng Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,2 @@
|
|||
# peridot-releng
|
||||
Scripts/tools engineers uses to build and release Rocky Linux
|
|
@ -0,0 +1,10 @@
|
|||
# pungicatalog
|
||||
Convert Pungi configuration to Peridot compatible catalogs.
|
||||
|
||||
A catalog includes package list and repository placement of these packages as well as other
|
||||
configuration related to a distribution.
|
||||
|
||||
### Usage
|
||||
```
|
||||
python3 pungicatalog/pungicatalog.py --pungi-conf-path /tmp/pungi-rocky/rocky.conf --output-path /tmp/catalog.cfg
|
||||
```
|
|
@ -0,0 +1,151 @@
|
|||
# -- peridot-releng-header-v0.1 --
|
||||
# Copyright (c) Peridot-Releng Authors. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class PeridotCatalogSyncPackageType(str, Enum):
|
||||
PACKAGE_TYPE_NORMAL = "PACKAGE_TYPE_NORMAL"
|
||||
PACKAGE_TYPE_NORMAL_FORK = "PACKAGE_TYPE_NORMAL_FORK"
|
||||
PACKAGE_TYPE_NORMAL_SRC = "PACKAGE_TYPE_NORMAL_SRC"
|
||||
PACKAGE_TYPE_MODULE_FORK = "PACKAGE_TYPE_MODULE_FORK"
|
||||
PACKAGE_TYPE_MODULE_FORK_COMPONENT = "PACKAGE_TYPE_MODULE_FORK_COMPONENT"
|
||||
PACKAGE_TYPE_NORMAL_FORK_MODULE = "PACKAGE_TYPE_NORMAL_FORK_MODULE"
|
||||
PACKAGE_TYPE_NORMAL_FORK_MODULE_COMPONENT = "PACKAGE_TYPE_NORMAL_FORK_MODULE_COMPONENT"
|
||||
PACKAGE_TYPE_MODULE_FORK_MODULE_COMPONENT = "PACKAGE_TYPE_MODULE_FORK_MODULE_COMPONENT"
|
||||
|
||||
|
||||
@dataclass
|
||||
class PeridotCatalogSyncRepository:
|
||||
name: str
|
||||
include_filter: list[str]
|
||||
multilib: list[str]
|
||||
|
||||
def include_filter_to_prototxt(self):
|
||||
return '\n' + '\n'.join(
|
||||
[f" include_filter: \"{f}\"" for f in self.include_filter])
|
||||
|
||||
def multilib_to_prototxt(self):
|
||||
return '\n' + '\n'.join(
|
||||
[f" multilib: \"{f}\"" for f in self.multilib])
|
||||
|
||||
|
||||
@dataclass
|
||||
class PeridotCatalogSyncPackage:
|
||||
name: str
|
||||
type: PeridotCatalogSyncPackageType
|
||||
module_components: list[str]
|
||||
repositories: list[PeridotCatalogSyncRepository]
|
||||
|
||||
def mc_to_prototxt(self):
|
||||
return '\n' + '\n'.join(
|
||||
[f" module_component: \"{component}\"" for component in
|
||||
self.module_components])
|
||||
|
||||
def repos_to_prototxt(self):
|
||||
return '\n'.join(
|
||||
[f""" repository {{
|
||||
name: \"{repo.name}\"{
|
||||
repo.include_filter_to_prototxt() if repo.include_filter else ""
|
||||
}{
|
||||
repo.multilib_to_prototxt() if repo.multilib else ""
|
||||
}
|
||||
}}""" for repo in self.repositories])
|
||||
|
||||
|
||||
class PeridotCatalogSync:
|
||||
additional_multilib: list[str] = []
|
||||
exclude_multilib_filter: list[str] = []
|
||||
exclude_filter: list[tuple[str, dict]] = []
|
||||
include_filter: list[tuple[str, dict]] = []
|
||||
packages: list[PeridotCatalogSyncPackage] = []
|
||||
|
||||
def add_package(self, package: PeridotCatalogSyncPackage):
|
||||
self.packages.append(package)
|
||||
|
||||
def additional_multilib_to_prototxt(self):
|
||||
return '\n'.join(
|
||||
[f"additional_multilib: \"{f}\"" for f in
|
||||
self.additional_multilib])
|
||||
|
||||
def exclude_multilib_filter_to_prototxt(self):
|
||||
return '\n' + '\n'.join(
|
||||
[f"exclude_multilib_filter: \"{f}\"" for f in
|
||||
self.exclude_multilib_filter])
|
||||
|
||||
def filter_arch_to_prototxt(self, arch: dict):
|
||||
nl = '\n'
|
||||
glob_match = {}
|
||||
for k, v in arch.items():
|
||||
glob_match[k] = [f" glob_match: \"{f}\"" for f in v]
|
||||
for k in glob_match.keys():
|
||||
if len(glob_match[k]) > 0:
|
||||
glob_match[k][0] = '\n' + glob_match[k][0]
|
||||
return '\n'.join([f""" arch {{
|
||||
key: \"{f}\"{nl.join(glob_match[f])}
|
||||
}}""" for f in arch.keys()])
|
||||
|
||||
def exclude_filter_to_prototxt(self):
|
||||
return '\n' + '\n'.join(
|
||||
[f"""exclude_filter {{
|
||||
repo_match: \"{f[0]}\"
|
||||
{self.filter_arch_to_prototxt(f[1])}
|
||||
}}""" for f in
|
||||
self.exclude_filter])
|
||||
|
||||
def include_filter_to_prototxt(self):
|
||||
return '\n' + '\n'.join(
|
||||
[f"""include_filter {{
|
||||
repo_match: \"{f[0]}\"
|
||||
{self.filter_arch_to_prototxt(f[1])}
|
||||
}}""" for f in
|
||||
self.include_filter])
|
||||
|
||||
def to_prototxt(self):
|
||||
ret = f"""# kind: resf.peridot.v1.CatalogSync
|
||||
{self.additional_multilib_to_prototxt()}{
|
||||
self.exclude_multilib_filter_to_prototxt()
|
||||
}{
|
||||
self.exclude_filter_to_prototxt()
|
||||
}{
|
||||
self.include_filter_to_prototxt()
|
||||
}
|
||||
"""
|
||||
for pkg in self.packages:
|
||||
ret += f"""package {{
|
||||
name: "{pkg.name}"
|
||||
type: {pkg.type}{
|
||||
pkg.mc_to_prototxt() if pkg.module_components else ""
|
||||
}
|
||||
{pkg.repos_to_prototxt()}
|
||||
}}
|
||||
"""
|
||||
|
||||
return ret
|
|
@ -0,0 +1,114 @@
|
|||
# -- peridot-releng-header-v0.1 --
|
||||
# Copyright (c) Peridot-Releng Authors. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
import kobo.conf
|
||||
|
||||
from catalog import PeridotCatalogSync, PeridotCatalogSyncPackage, \
|
||||
PeridotCatalogSyncPackageType, PeridotCatalogSyncRepository
|
||||
from scm import SCM
|
||||
|
||||
|
||||
def main(pungi_conf_path: str, output_path: str):
|
||||
pungi_base = os.path.dirname(pungi_conf_path)
|
||||
|
||||
conf = kobo.conf.PyConfigParser()
|
||||
conf.load_from_file(pungi_conf_path)
|
||||
|
||||
gather_prepopulate_scm_dict = conf.get("gather_prepopulate")
|
||||
gpscm = SCM(pungi_base, gather_prepopulate_scm_dict)
|
||||
gpjson = gpscm.json()
|
||||
|
||||
# Create a catalog
|
||||
catalog = PeridotCatalogSync()
|
||||
|
||||
# Set multilib filters
|
||||
catalog.additional_multilib.extend(
|
||||
list(conf.get("multilib_whitelist").values())[0])
|
||||
catalog.exclude_multilib_filter.extend(
|
||||
list(conf.get("multilib_blacklist").values())[0])
|
||||
|
||||
# Set additional packages/filters
|
||||
catalog.exclude_filter.extend(conf.get("filter_packages"))
|
||||
catalog.include_filter.extend(conf.get("additional_packages"))
|
||||
|
||||
# Create indexes
|
||||
package_index = {}
|
||||
|
||||
# Read prepopulate json and create package objects
|
||||
for repo in gpjson.keys():
|
||||
for arch in gpjson[repo].keys():
|
||||
for package in gpjson[repo][arch].keys():
|
||||
if package not in package_index:
|
||||
package_index[package] = {}
|
||||
if repo not in package_index[package]:
|
||||
package_index[package][repo] = {"include_filter": [],
|
||||
"multilib": []}
|
||||
na_list = gpjson[repo][arch][package]
|
||||
for na in na_list:
|
||||
splitted = na.split(".")
|
||||
arch_package = splitted[len(splitted) - 1]
|
||||
if arch != arch_package and arch_package != "noarch":
|
||||
if arch not in package_index[package][repo]["multilib"]:
|
||||
package_index[package][repo]["multilib"].append(
|
||||
arch)
|
||||
if na not in package_index[package][repo]["include_filter"]:
|
||||
package_index[package][repo]["include_filter"].append(
|
||||
na)
|
||||
|
||||
for package in package_index.keys():
|
||||
catalog.add_package(
|
||||
PeridotCatalogSyncPackage(
|
||||
package,
|
||||
PeridotCatalogSyncPackageType.PACKAGE_TYPE_NORMAL_FORK if not package.startswith("rocky-") else PeridotCatalogSyncPackageType.PACKAGE_TYPE_NORMAL_SRC,
|
||||
[],
|
||||
[PeridotCatalogSyncRepository(x, package_index[package][x][
|
||||
"include_filter"], package_index[package][x]["multilib"])
|
||||
for
|
||||
x in package_index[package].keys()]
|
||||
)
|
||||
)
|
||||
|
||||
f = open(output_path, "w")
|
||||
f.write(catalog.to_prototxt())
|
||||
f.close()
|
||||
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Convert Pungi configuration to Peridot compatible '
|
||||
'catalogs.')
|
||||
parser.add_argument('--pungi-conf-path', type=str, required=True)
|
||||
parser.add_argument('--output-path', type=str, default="catalog.cfg")
|
||||
args = parser.parse_args()
|
||||
main(args.pungi_conf_path, args.output_path)
|
|
@ -0,0 +1,52 @@
|
|||
# -- peridot-releng-header-v0.1 --
|
||||
# Copyright (c) Peridot-Releng Authors. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
class SCM:
|
||||
def __init__(self, pungi_base, scm_dict):
|
||||
if scm_dict["scm"] == "file":
|
||||
file_path = os.path.join(pungi_base, scm_dict["file"])
|
||||
f = open(file_path, "r")
|
||||
file_contents = f.read()
|
||||
|
||||
if file_path.endswith(".json"):
|
||||
self.json_value = json.loads(file_contents)
|
||||
else:
|
||||
self.text_value = file_contents
|
||||
|
||||
f.close()
|
||||
|
||||
def json(self):
|
||||
return self.json_value
|
||||
|
||||
def text(self):
|
||||
return self.text_value
|
|
@ -0,0 +1,3 @@
|
|||
kobo==0.23.0
|
||||
GitPython==3.1.27
|
||||
requests==2.27.1
|
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# -- peridot-releng-header-v0.1 --
|
||||
# Copyright (c) Peridot-Releng Authors. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import requests
|
||||
import json
|
||||
|
||||
|
||||
def get_batch(batch_type, task_id, status, page):
|
||||
r = requests.get(
|
||||
f'https://peridot.pdot-dev.rockylinux.org/api/v1/projects/c4fa14a2-5af6-4634-bfea-847a9fd639c7/{batch_type}_batches/{task_id}?page={page}&limit=100&filter.status={status}')
|
||||
return r.json()[f'{batch_type}s']
|
||||
|
||||
|
||||
def process_batch(batch_type, task_id, status):
|
||||
ret = []
|
||||
page = 0
|
||||
while True:
|
||||
res = get_batch(batch_type, task_id, status, page)
|
||||
if len(res) == 0:
|
||||
return ret
|
||||
ret.extend(res)
|
||||
page = page + 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
batch_type = sys.argv[1]
|
||||
task_id = sys.argv[2]
|
||||
|
||||
batch_items = process_batch(batch_type, task_id, 4)
|
||||
# batch_items.extend(process_batch(batch_type, task_id, 5))
|
||||
|
||||
req = {}
|
||||
key = f'{batch_type}s'
|
||||
req[key] = []
|
||||
for item in batch_items:
|
||||
req[key].append({
|
||||
'package_name': item['name']
|
||||
})
|
||||
|
||||
print(json.dumps(req))
|
|
@ -0,0 +1,44 @@
|
|||
# -- peridot-releng-header-v0.1 --
|
||||
# Copyright (c) Peridot-Releng Authors. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import json
|
||||
|
||||
if __name__ == '__main__':
|
||||
build_type = sys.argv[1]
|
||||
key = f'{build_type}s'
|
||||
|
||||
req = {}
|
||||
req[key] = []
|
||||
for line in sys.stdin:
|
||||
req[key].append({
|
||||
'package_name': line.strip()
|
||||
})
|
||||
|
||||
print(json.dumps(req))
|
Loading…
Reference in New Issue