Mageia Bugzilla – Attachment 7564 Details for
Bug 17057
Request for cmocka, drpm, and createrepo_c built for infra_5 and createrepo_c metadata generation for Cauldron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Python script to run createrepo_c to generate rpm-md data for Mageia releases
genrpmmd-mga.py (text/x-python), 3.61 KB, created by
Neal Gompa
on 2016-03-12 16:40:05 CET
(
hide
)
Description:
Python script to run createrepo_c to generate rpm-md data for Mageia releases
Filename:
MIME Type:
Creator:
Neal Gompa
Created:
2016-03-12 16:40:05 CET
Size:
3.61 KB
patch
obsolete
>#!/usr/bin/env python3 > ># Generates rpm-md data across Mageia releases using createrepo_c ># Author: Neal Gompa <ngompa13@gmail.com> ># License: MIT ># ================================================================================ ># The MIT License (MIT) ># ># Copyright (c) 2016 Neal Gompa ># ># Permission is hereby granted, free of charge, to any person obtaining a copy ># of this software and associated documentation files (the "Software"), to deal ># in the Software without restriction, including without limitation the rights ># to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ># copies of the Software, and to permit persons to whom the Software is ># furnished to do so, subject to the following conditions: ># ># The above copyright notice and this permission notice shall be included in ># all copies or substantial portions of the Software. ># ># THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ># IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ># FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ># AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ># LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ># OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ># THE SOFTWARE. > >import subprocess >import argparse > >parser = argparse.ArgumentParser() > >parser.add_argument("-r", "--release", help="Select release", action="append", default=[]) >parser.add_argument("-a", "--architecture", help="Select binary architecture", action="append", default=[], choices=["i586", "x86_64", "armv5tl"]) >parser.add_argument("-s", "--add-srpms", help="Add Source RPM repositories from composition", action="store_true", default=None) >parser.add_argument("-d", "--dry-run", help="Do a dry run of the script for debugging purposes", action="store_true", default=None) > >args = parser.parse_args() > >genrpmmd_cmd = ["createrepo_c", "--skip-stat", "--no-database", "--update", "--workers=10", "--general-compress-type=xz"] > > ># Deduplicate entries in the list of releases >distrels = list(set(args.release)) > ># Deduplicate entries in the list of architectures >arches = list(set(args.architecture)) > >if args.add_srpms is not None: > arches.append("SRPMS") > >rootpath = "/distrib/bootstrap/distrib/{0}/{1}" >medias = ["{0}/media/", "SRPMS/"] > >sections = ["core/", "nonfree/", "tainted/", "debug/"] >alt_sections = ["core/", "nonfree/", "tainted/"] > >subrepos = ["backports", "backports_testing", "release", "updates", "updates_testing"] > ># Loop through all the possible permutations to create the full list of directory paths >repopaths = [] >for distrel in distrels: > for arch in arches: > for section in sections: > if section is "debug/": > if arch is not "SRPMS": > for dbg_section in alt_sections: > for subrepo in subrepos: > repopaths.append(rootpath.format(distrel, medias[0].format(arch)) + section + dbg_section + subrepo) > else: > for subrepo in subrepos: > if arch is "SRPMS": > repopaths.append(rootpath.format(distrel, medias[1]) + section + subrepo) > else: > repopaths.append(rootpath.format(distrel, medias[0].format(arch)) + section + subrepo) > ># Run createrepo_c on the full list of directory paths >for repopath in repopaths: > if args.dry_run is not None: > print(genrpmmd_cmd + [repopath]) > else: > print("Running createrepo_c on {0}".format(repopath)) > subprocess.check_call(genrpmmd_cmd + [repopath]) > >
#!/usr/bin/env python3 # Generates rpm-md data across Mageia releases using createrepo_c # Author: Neal Gompa <ngompa13@gmail.com> # License: MIT # ================================================================================ # The MIT License (MIT) # # Copyright (c) 2016 Neal Gompa # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import subprocess import argparse parser = argparse.ArgumentParser() parser.add_argument("-r", "--release", help="Select release", action="append", default=[]) parser.add_argument("-a", "--architecture", help="Select binary architecture", action="append", default=[], choices=["i586", "x86_64", "armv5tl"]) parser.add_argument("-s", "--add-srpms", help="Add Source RPM repositories from composition", action="store_true", default=None) parser.add_argument("-d", "--dry-run", help="Do a dry run of the script for debugging purposes", action="store_true", default=None) args = parser.parse_args() genrpmmd_cmd = ["createrepo_c", "--skip-stat", "--no-database", "--update", "--workers=10", "--general-compress-type=xz"] # Deduplicate entries in the list of releases distrels = list(set(args.release)) # Deduplicate entries in the list of architectures arches = list(set(args.architecture)) if args.add_srpms is not None: arches.append("SRPMS") rootpath = "/distrib/bootstrap/distrib/{0}/{1}" medias = ["{0}/media/", "SRPMS/"] sections = ["core/", "nonfree/", "tainted/", "debug/"] alt_sections = ["core/", "nonfree/", "tainted/"] subrepos = ["backports", "backports_testing", "release", "updates", "updates_testing"] # Loop through all the possible permutations to create the full list of directory paths repopaths = [] for distrel in distrels: for arch in arches: for section in sections: if section is "debug/": if arch is not "SRPMS": for dbg_section in alt_sections: for subrepo in subrepos: repopaths.append(rootpath.format(distrel, medias[0].format(arch)) + section + dbg_section + subrepo) else: for subrepo in subrepos: if arch is "SRPMS": repopaths.append(rootpath.format(distrel, medias[1]) + section + subrepo) else: repopaths.append(rootpath.format(distrel, medias[0].format(arch)) + section + subrepo) # Run createrepo_c on the full list of directory paths for repopath in repopaths: if args.dry_run is not None: print(genrpmmd_cmd + [repopath]) else: print("Running createrepo_c on {0}".format(repopath)) subprocess.check_call(genrpmmd_cmd + [repopath])
View Attachment As Raw
Actions:
View
Attachments on
bug 17057
: 7564