Some more temporary bootstrapping utilities.

This commit is contained in:
Ralph Bean
2017-03-02 13:00:34 -05:00
parent 51c1e3b7ea
commit 29ea44025b
5 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
{
"variant_uid": "bootstrap-master-1",
"variant_release": "1",
"variant_name": "bootstrap",
"build_deps": [],
"variant_type": "module",
"modulemd": "document: modulemd\r\nversion: 1\r\ndata:\r\n name: bootstrap\r\n stream: master\r\n version: 1\r\n summary: A fake bootstrap module, used to bootstrap the infrastructure.\r\n description: ...\r\n xmd:\r\n mbs_commit: ae993ba84f4bce554471382ccba917ef16265f11\r\n mbs_buildrequires:\r\n bootstrap:\r\n ref: ae993ba84f4bce554471382ccba917ef16265f11\r\n stream: master\r\n version: 1\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - bash\r\n - bzip2\r\n - coreutils\r\n - cpio\r\n - diffutils\r\n - fedora-release\r\n - findutils\r\n - gawk\r\n - gcc\r\n - gcc-c++\r\n - grep\r\n - gzip\r\n - info\r\n - make\r\n - patch\r\n - redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - shadow-utils\r\n - tar\r\n - unzip\r\n - util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - shadow-utils",
"koji_tag": "f26-modularity",
"runtime_deps": [],
"variant_id": "bootstrap",
"variant_version": "master"
}

View File

@@ -0,0 +1,18 @@
import json
import requests
import os
import sys
import pdc_client
servername, token = sys.argv[-2], sys.argv[-1]
if os.path.basename(__file__) in (servername, token,):
raise ValueError("Provide a PDC server name defined in /etc/pdc.d/ and a token")
print("Connecting to PDC server %r with token %r" % (servername, token))
pdc = pdc_client.PDCClient(servername, token=token)
print("Submitting DELETE.")
del pdc['unreleasedvariants']['bootstrap']
print("Done.")

27
bootstrap/fix-json.py Normal file
View File

@@ -0,0 +1,27 @@
import json
import requests
import os
import sys
import yaml
import pdc_client
filename = 'bootstrap-master-1.json'
print("Reading %s" % filename)
with open(filename, 'r') as f:
entry = json.loads(f.read())
print entry['modulemd']
modulemd = yaml.load(entry['modulemd'])
mbs = {}
mbs['commit'] = modulemd['data']['xmd']['mbs_commit']
mbs['buildrequires'] = modulemd['data']['xmd']['mbs_buildrequires']
del modulemd['data']['xmd']['mbs_commit']
del modulemd['data']['xmd']['mbs_buildrequires']
modulemd['data']['xmd']['mbs'] = mbs
entry['modulemd'] = yaml.dump(modulemd)
filename = "fixed-" + filename
print("Writing %s" % filename)
with open(filename, 'w') as f:
entry = f.write(json.dumps(entry, indent=2))

View File

@@ -0,0 +1,12 @@
{
"variant_uid": "bootstrap-master-1",
"variant_release": "1",
"build_deps": [],
"variant_name": "bootstrap",
"variant_type": "module",
"modulemd": "data:\n description: '...'\n name: bootstrap\n profiles:\n buildroot:\n rpms: [bash, bzip2, coreutils, cpio, diffutils, fedora-release, findutils, gawk,\n gcc, gcc-c++, grep, gzip, info, make, patch, redhat-rpm-config, rpm-build,\n sed, shadow-utils, tar, unzip, util-linux, which, xz]\n srpm-buildroot:\n rpms: [bash, fedora-release, fedpkg-minimal, gnupg2, redhat-rpm-config, rpm-build,\n shadow-utils]\n stream: master\n summary: A fake bootstrap module, used to bootstrap the infrastructure.\n version: 1\n xmd:\n mbs:\n buildrequires:\n bootstrap: {ref: ae993ba84f4bce554471382ccba917ef16265f11, stream: master,\n version: 1}\n commit: ae993ba84f4bce554471382ccba917ef16265f11\ndocument: modulemd\nversion: 1\n",
"koji_tag": "f26-modularity",
"runtime_deps": [],
"variant_id": "bootstrap",
"variant_version": "master"
}

View File

@@ -0,0 +1,9 @@
import requests
import yaml
response = requests.get('https://pdc.fedoraproject.org/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=bootstrap')
data = response.json()
item = data[0]
item['modulemd'] = yaml.load(item['modulemd'])
print yaml.dump(item)