| |
@@ -1,4 +1,3 @@
|
| |
- #!/usr/bin/env python
|
| |
# This program is free software; you can redistribute it and/or modify
|
| |
# it under the terms of the GNU General Public License as published by
|
| |
# the Free Software Foundation; version 2 of the License.
|
| |
@@ -11,16 +10,14 @@
|
| |
# You should have received a copy of the GNU General Public License
|
| |
# along with this program; if not, see <https://gnu.org/licenses/>.
|
| |
|
| |
+ from __future__ import absolute_import
|
| |
from __future__ import print_function
|
| |
|
| |
import os
|
| |
import selinux
|
| |
import sys
|
| |
|
| |
- here = sys.path[0]
|
| |
- if here != '/usr/bin':
|
| |
- # Git checkout
|
| |
- sys.path.insert(1, os.path.dirname(here))
|
| |
+ from argparse import ArgumentParser, Action
|
| |
|
| |
from pungi import get_full_version
|
| |
import pungi.gather
|
| |
@@ -28,6 +25,151 @@
|
| |
import pungi.ks
|
| |
|
| |
|
| |
+ def get_arguments(config):
|
| |
+ parser = ArgumentParser()
|
| |
+
|
| |
+ class SetConfig(Action):
|
| |
+ def __call__(self, parser, namespace, value, option_string=None):
|
| |
+ config.set('pungi', self.dest, value)
|
| |
+
|
| |
+ parser.add_argument('--version', action='version', version=get_full_version())
|
| |
+
|
| |
+ # Pulled in from config file to be cli options as part of pykickstart conversion
|
| |
+ parser.add_argument(
|
| |
+ "--name", dest="family", type=str, action=SetConfig,
|
| |
+ help='the name for your distribution (defaults to "Fedora"), DEPRECATED')
|
| |
+ parser.add_argument(
|
| |
+ "--family", dest="family", action=SetConfig,
|
| |
+ help='the family name for your distribution (defaults to "Fedora")')
|
| |
+ parser.add_argument(
|
| |
+ "--ver", dest="version", action=SetConfig,
|
| |
+ help='the version of your distribution (defaults to datestamp)')
|
| |
+ parser.add_argument(
|
| |
+ "--flavor", dest="variant", action=SetConfig,
|
| |
+ help='the flavor of your distribution spin (optional), DEPRECATED')
|
| |
+ parser.add_argument(
|
| |
+ "--variant", dest="variant", action=SetConfig,
|
| |
+ help='the variant of your distribution spin (optional)')
|
| |
+ parser.add_argument(
|
| |
+ "--destdir", dest="destdir", action=SetConfig,
|
| |
+ help='destination directory (defaults to current directory)')
|
| |
+ parser.add_argument(
|
| |
+ "--cachedir", dest="cachedir", action=SetConfig,
|
| |
+ help='package cache directory (defaults to /var/cache/pungi)')
|
| |
+ parser.add_argument(
|
| |
+ "--bugurl", dest="bugurl", action=SetConfig,
|
| |
+ help='the url for your bug system (defaults to http://bugzilla.redhat.com)')
|
| |
+ parser.add_argument(
|
| |
+ "--selfhosting", action="store_true", dest="selfhosting",
|
| |
+ help='build a self-hosting tree by following build dependencies (optional)')
|
| |
+ parser.add_argument(
|
| |
+ "--fulltree", action="store_true", dest="fulltree",
|
| |
+ help='build a tree that includes all packages built from corresponding source rpms (optional)')
|
| |
+ parser.add_argument(
|
| |
+ "--nosource", action="store_true", dest="nosource",
|
| |
+ help='disable gathering of source packages (optional)')
|
| |
+ parser.add_argument(
|
| |
+ "--nodebuginfo", action="store_true", dest="nodebuginfo",
|
| |
+ help='disable gathering of debuginfo packages (optional)')
|
| |
+ parser.add_argument(
|
| |
+ "--nodownload", action="store_true", dest="nodownload",
|
| |
+ help='disable downloading of packages. instead, print the package URLs (optional)')
|
| |
+ parser.add_argument(
|
| |
+ "--norelnotes", action="store_true", dest="norelnotes",
|
| |
+ help='disable gathering of release notes (optional); DEPRECATED')
|
| |
+ parser.add_argument(
|
| |
+ "--nogreedy", action="store_true", dest="nogreedy",
|
| |
+ help='disable pulling of all providers of package dependencies (optional)')
|
| |
+ parser.add_argument(
|
| |
+ "--nodeps", action="store_false", dest="resolve_deps", default=True,
|
| |
+ help='disable resolving dependencies')
|
| |
+ parser.add_argument(
|
| |
+ "--sourceisos", default=False, action="store_true", dest="sourceisos",
|
| |
+ help='Create the source isos (other arch runs must be done)')
|
| |
+ parser.add_argument(
|
| |
+ "--force", default=False, action="store_true",
|
| |
+ help='Force reuse of an existing destination directory (will overwrite files)')
|
| |
+ parser.add_argument(
|
| |
+ "--isfinal", default=False, action="store_true",
|
| |
+ help='Specify this is a GA tree, which causes betanag to be turned off during install')
|
| |
+ parser.add_argument(
|
| |
+ "--nohash", default=False, action="store_true",
|
| |
+ help='disable hashing the Packages trees')
|
| |
+ parser.add_argument(
|
| |
+ "--full-archlist", action="store_true",
|
| |
+ help='Use the full arch list for x86_64 (include i686, i386, etc.)')
|
| |
+ parser.add_argument("--arch", help='Override default (uname based) arch')
|
| |
+ parser.add_argument(
|
| |
+ "--greedy", metavar="METHOD",
|
| |
+ help='Greedy method; none, all, build')
|
| |
+ parser.add_argument(
|
| |
+ "--multilib", action="append", metavar="METHOD",
|
| |
+ help='Multilib method; can be specified multiple times; recommended: devel, runtime')
|
| |
+ parser.add_argument(
|
| |
+ "--lookaside-repo", action="append", dest="lookaside_repos", metavar="NAME",
|
| |
+ help='Specify lookaside repo name(s) (packages will used for depsolving but not be included in the output)')
|
| |
+ parser.add_argument(
|
| |
+ "--workdirbase", dest="workdirbase", action=SetConfig,
|
| |
+ help='base working directory (defaults to destdir + /work)')
|
| |
+ parser.add_argument("--no-dvd", default=False, action="store_true", dest="no_dvd",
|
| |
+ help='Do not make a install DVD/CD only the netinstall image and the tree')
|
| |
+ parser.add_argument("--lorax-conf",
|
| |
+ help='Path to lorax.conf file (optional)')
|
| |
+ parser.add_argument(
|
| |
+ "-i", "--installpkgs", default=[], action="append", metavar="STRING",
|
| |
+ help="Package glob for lorax to install before runtime-install.tmpl runs. (may be listed multiple times)")
|
| |
+ parser.add_argument(
|
| |
+ "--multilibconf", default=None, action=SetConfig,
|
| |
+ help="Path to multilib conf files. Default is /usr/share/pungi/multilib/")
|
| |
+
|
| |
+ parser.add_argument("-c", "--config", dest="config", required=True,
|
| |
+ help='Path to kickstart config file')
|
| |
+ parser.add_argument("--all-stages", action="store_true", default=True, dest="do_all",
|
| |
+ help="Enable ALL stages")
|
| |
+ parser.add_argument("-G", action="store_true", default=False, dest="do_gather",
|
| |
+ help="Flag to enable processing the Gather stage")
|
| |
+ parser.add_argument("-C", action="store_true", default=False, dest="do_createrepo",
|
| |
+ help="Flag to enable processing the Createrepo stage")
|
| |
+ parser.add_argument("-B", action="store_true", default=False, dest="do_buildinstall",
|
| |
+ help="Flag to enable processing the BuildInstall stage")
|
| |
+ parser.add_argument("-I", action="store_true", default=False, dest="do_createiso",
|
| |
+ help="Flag to enable processing the CreateISO stage")
|
| |
+ parser.add_argument("--relnotepkgs", dest="relnotepkgs", action=SetConfig,
|
| |
+ help='Rpms which contain the release notes')
|
| |
+ parser.add_argument(
|
| |
+ "--relnotefilere", dest="relnotefilere", action=SetConfig,
|
| |
+ help='Which files are the release notes -- GPL EULA')
|
| |
+ parser.add_argument("--nomacboot", action="store_true", dest="nomacboot",
|
| |
+ help='disable setting up macboot as no hfs support ')
|
| |
+
|
| |
+ parser.add_argument(
|
| |
+ "--rootfs-size", dest="rootfs_size", action=SetConfig, default=False,
|
| |
+ help='Size of root filesystem in GiB. If not specified, use lorax default value')
|
| |
+
|
| |
+ parser.add_argument(
|
| |
+ "--pungirc", dest="pungirc", default='~/.pungirc', action=SetConfig,
|
| |
+ help='Read pungi options from config file ')
|
| |
+
|
| |
+ opts = parser.parse_args()
|
| |
+
|
| |
+ if not config.get('pungi', 'variant').isalnum() and not config.get('pungi', 'variant') == '':
|
| |
+ parser.error("Variant must be alphanumeric")
|
| |
+
|
| |
+ if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
|
| |
+ opts.do_all = False
|
| |
+
|
| |
+ if opts.arch and (opts.do_all or opts.do_buildinstall):
|
| |
+ parser.error("Cannot override arch while the BuildInstall stage is enabled")
|
| |
+
|
| |
+ # set the iso_basename.
|
| |
+ if not config.get('pungi', 'variant') == '':
|
| |
+ config.set('pungi', 'iso_basename', '%s-%s' % (config.get('pungi', 'family'), config.get('pungi', 'variant')))
|
| |
+ else:
|
| |
+ config.set('pungi', 'iso_basename', config.get('pungi', 'family'))
|
| |
+
|
| |
+ return opts
|
| |
+
|
| |
+
|
| |
def main():
|
| |
|
| |
config = pungi.config.Config()
|
| |
@@ -207,156 +349,3 @@
|
| |
mypungi.doCreateIsos()
|
| |
|
| |
print("All done!")
|
| |
-
|
| |
- if __name__ == '__main__':
|
| |
- from argparse import ArgumentParser, Action
|
| |
- import sys
|
| |
- import time
|
| |
-
|
| |
- today = time.strftime('%Y%m%d', time.localtime())
|
| |
-
|
| |
- def get_arguments(config):
|
| |
- parser = ArgumentParser()
|
| |
-
|
| |
- class SetConfig(Action):
|
| |
- def __call__(self, parser, namespace, value, option_string=None):
|
| |
- config.set('pungi', self.dest, value)
|
| |
-
|
| |
- parser.add_argument('--version', action='version', version=get_full_version())
|
| |
-
|
| |
- # Pulled in from config file to be cli options as part of pykickstart conversion
|
| |
- parser.add_argument(
|
| |
- "--name", dest="family", type=str, action=SetConfig,
|
| |
- help='the name for your distribution (defaults to "Fedora"), DEPRECATED')
|
| |
- parser.add_argument(
|
| |
- "--family", dest="family", action=SetConfig,
|
| |
- help='the family name for your distribution (defaults to "Fedora")')
|
| |
- parser.add_argument(
|
| |
- "--ver", dest="version", action=SetConfig,
|
| |
- help='the version of your distribution (defaults to datestamp)')
|
| |
- parser.add_argument(
|
| |
- "--flavor", dest="variant", action=SetConfig,
|
| |
- help='the flavor of your distribution spin (optional), DEPRECATED')
|
| |
- parser.add_argument(
|
| |
- "--variant", dest="variant", action=SetConfig,
|
| |
- help='the variant of your distribution spin (optional)')
|
| |
- parser.add_argument(
|
| |
- "--destdir", dest="destdir", action=SetConfig,
|
| |
- help='destination directory (defaults to current directory)')
|
| |
- parser.add_argument(
|
| |
- "--cachedir", dest="cachedir", action=SetConfig,
|
| |
- help='package cache directory (defaults to /var/cache/pungi)')
|
| |
- parser.add_argument(
|
| |
- "--bugurl", dest="bugurl", action=SetConfig,
|
| |
- help='the url for your bug system (defaults to http://bugzilla.redhat.com)')
|
| |
- parser.add_argument(
|
| |
- "--selfhosting", action="store_true", dest="selfhosting",
|
| |
- help='build a self-hosting tree by following build dependencies (optional)')
|
| |
- parser.add_argument(
|
| |
- "--fulltree", action="store_true", dest="fulltree",
|
| |
- help='build a tree that includes all packages built from corresponding source rpms (optional)')
|
| |
- parser.add_argument(
|
| |
- "--nosource", action="store_true", dest="nosource",
|
| |
- help='disable gathering of source packages (optional)')
|
| |
- parser.add_argument(
|
| |
- "--nodebuginfo", action="store_true", dest="nodebuginfo",
|
| |
- help='disable gathering of debuginfo packages (optional)')
|
| |
- parser.add_argument(
|
| |
- "--nodownload", action="store_true", dest="nodownload",
|
| |
- help='disable downloading of packages. instead, print the package URLs (optional)')
|
| |
- parser.add_argument(
|
| |
- "--norelnotes", action="store_true", dest="norelnotes",
|
| |
- help='disable gathering of release notes (optional); DEPRECATED')
|
| |
- parser.add_argument(
|
| |
- "--nogreedy", action="store_true", dest="nogreedy",
|
| |
- help='disable pulling of all providers of package dependencies (optional)')
|
| |
- parser.add_argument(
|
| |
- "--nodeps", action="store_false", dest="resolve_deps", default=True,
|
| |
- help='disable resolving dependencies')
|
| |
- parser.add_argument(
|
| |
- "--sourceisos", default=False, action="store_true", dest="sourceisos",
|
| |
- help='Create the source isos (other arch runs must be done)')
|
| |
- parser.add_argument(
|
| |
- "--force", default=False, action="store_true",
|
| |
- help='Force reuse of an existing destination directory (will overwrite files)')
|
| |
- parser.add_argument(
|
| |
- "--isfinal", default=False, action="store_true",
|
| |
- help='Specify this is a GA tree, which causes betanag to be turned off during install')
|
| |
- parser.add_argument(
|
| |
- "--nohash", default=False, action="store_true",
|
| |
- help='disable hashing the Packages trees')
|
| |
- parser.add_argument(
|
| |
- "--full-archlist", action="store_true",
|
| |
- help='Use the full arch list for x86_64 (include i686, i386, etc.)')
|
| |
- parser.add_argument("--arch", help='Override default (uname based) arch')
|
| |
- parser.add_argument(
|
| |
- "--greedy", metavar="METHOD",
|
| |
- help='Greedy method; none, all, build')
|
| |
- parser.add_argument(
|
| |
- "--multilib", action="append", metavar="METHOD",
|
| |
- help='Multilib method; can be specified multiple times; recommended: devel, runtime')
|
| |
- parser.add_argument(
|
| |
- "--lookaside-repo", action="append", dest="lookaside_repos", metavar="NAME",
|
| |
- help='Specify lookaside repo name(s) (packages will used for depsolving but not be included in the output)')
|
| |
- parser.add_argument(
|
| |
- "--workdirbase", dest="workdirbase", action=SetConfig,
|
| |
- help='base working directory (defaults to destdir + /work)')
|
| |
- parser.add_argument("--no-dvd", default=False, action="store_true", dest="no_dvd",
|
| |
- help='Do not make a install DVD/CD only the netinstall image and the tree')
|
| |
- parser.add_argument("--lorax-conf",
|
| |
- help='Path to lorax.conf file (optional)')
|
| |
- parser.add_argument(
|
| |
- "-i", "--installpkgs", default=[], action="append", metavar="STRING",
|
| |
- help="Package glob for lorax to install before runtime-install.tmpl runs. (may be listed multiple times)")
|
| |
- parser.add_argument(
|
| |
- "--multilibconf", default=None, action=SetConfig,
|
| |
- help="Path to multilib conf files. Default is /usr/share/pungi/multilib/")
|
| |
-
|
| |
- parser.add_argument("-c", "--config", dest="config", required=True,
|
| |
- help='Path to kickstart config file')
|
| |
- parser.add_argument("--all-stages", action="store_true", default=True, dest="do_all",
|
| |
- help="Enable ALL stages")
|
| |
- parser.add_argument("-G", action="store_true", default=False, dest="do_gather",
|
| |
- help="Flag to enable processing the Gather stage")
|
| |
- parser.add_argument("-C", action="store_true", default=False, dest="do_createrepo",
|
| |
- help="Flag to enable processing the Createrepo stage")
|
| |
- parser.add_argument("-B", action="store_true", default=False, dest="do_buildinstall",
|
| |
- help="Flag to enable processing the BuildInstall stage")
|
| |
- parser.add_argument("-I", action="store_true", default=False, dest="do_createiso",
|
| |
- help="Flag to enable processing the CreateISO stage")
|
| |
- parser.add_argument("--relnotepkgs", dest="relnotepkgs", action=SetConfig,
|
| |
- help='Rpms which contain the release notes')
|
| |
- parser.add_argument(
|
| |
- "--relnotefilere", dest="relnotefilere", action=SetConfig,
|
| |
- help='Which files are the release notes -- GPL EULA')
|
| |
- parser.add_argument("--nomacboot", action="store_true", dest="nomacboot",
|
| |
- help='disable setting up macboot as no hfs support ')
|
| |
-
|
| |
- parser.add_argument(
|
| |
- "--rootfs-size", dest="rootfs_size", action=SetConfig, default=False,
|
| |
- help='Size of root filesystem in GiB. If not specified, use lorax default value')
|
| |
-
|
| |
- parser.add_argument(
|
| |
- "--pungirc", dest="pungirc", default='~/.pungirc', action=SetConfig,
|
| |
- help='Read pungi options from config file ')
|
| |
-
|
| |
- opts = parser.parse_args()
|
| |
-
|
| |
- if not config.get('pungi', 'variant').isalnum() and not config.get('pungi', 'variant') == '':
|
| |
- parser.error("Variant must be alphanumeric")
|
| |
-
|
| |
- if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
|
| |
- opts.do_all = False
|
| |
-
|
| |
- if opts.arch and (opts.do_all or opts.do_buildinstall):
|
| |
- parser.error("Cannot override arch while the BuildInstall stage is enabled")
|
| |
-
|
| |
- # set the iso_basename.
|
| |
- if not config.get('pungi', 'variant') == '':
|
| |
- config.set('pungi', 'iso_basename', '%s-%s' % (config.get('pungi', 'family'), config.get('pungi', 'variant')))
|
| |
- else:
|
| |
- config.set('pungi', 'iso_basename', config.get('pungi', 'family'))
|
| |
-
|
| |
- return opts
|
| |
-
|
| |
- main()
|
| |
Fixes: https://pagure.io/pungi/issue/1045
JIRA: COMPOSE-2946
Signed-off-by: Haibo Lin hlin@redhat.com