def parseArgs(): usage = _(""" update_cv.py updates a content view from one or more repositories. %s [options] """) % sys.argv[0] parser = OptionParser(usage=usage) parser.add_option("-c", "--cv", help=_("name of the Content View")) (opts, args) = parser.parse_args() return (opts, args)
def parseArgs(): usage = _(""" create_cv.py creates a content view from one or more repositories. %s [options] """) % sys.argv[0] parser = OptionParser(usage=usage) parser.add_option("-r", "--repoid", action='append', help=_("specify repo ids to add to the CV, can be specified multiple times (default is all enabled)")) parser.add_option("-c", "--cv", help=_("name of the Content View")) (opts, args) = parser.parse_args() return (opts, args)
def doCheck(self, base, basecmd, extcmds): if len(extcmds) > 1: # Add a new alias try: open(conffile, "a").close() except: base.logger.critical(_("Can't open aliases file: %s") % conffile) raise CliError
def parseArgs(): usage = _(""" create_cv.py creates a content view from one or more repositories. %s [options] """) % sys.argv[0] parser = OptionParser(usage=usage) parser.add_option( "-r", "--repoid", action='append', help= _("specify repo ids to add to the CV, can be specified multiple times (default is all enabled)" )) parser.add_option("-c", "--cv", help=_("name of the Content View")) (opts, args) = parser.parse_args() return (opts, args)
def main(): (opts, dummy) = parseArgs() if not os.path.exists(opts.destdir) and not opts.urls: try: os.makedirs(opts.destdir) except OSError, e: print >> sys.stderr, _("Error: Cannot create destination dir %s") % opts.destdir sys.exit(1)
def doCommand(self, base, basecmd, extcmds): if len(extcmds) > 1: # Add a new alias fo = open(conffile, "a") fo.write(_("\n# Alias added on %s\n%s\n") % (time.ctime(), ' '.join(extcmds))) fo.close() return 0, [basecmd + ' done'] if len(extcmds) == 1: # Show just a single alias cmd = extcmds[0] if cmd not in aliases: return 1, [_("%s, no match for %s") % (basecmd, cmd)] args = [cmd] resolve_aliases(args, lambda x,y: base.verbose_logger.debug(y)) print _("Alias %s = %s") % (cmd, " ".join(args)) return 0, [basecmd + ' done'] for cmd in sorted(aliases.keys()): args = aliases[cmd][:] resolve_aliases(args, lambda x,y: base.verbose_logger.debug(y)) print _("Alias %s = %s") % (cmd, " ".join(args)) return 0, [basecmd + ' done']
def parseArgs(): usage = _(""" Reposync is used to synchronize a remote yum repository to a local directory using yum to retrieve the packages. %s [options] """) % sys.argv[0] parser = OptionParser(usage=usage) parser.add_option("-c", "--config", default='/etc/yum.conf', help=_('config file to use (defaults to /etc/yum.conf)')) parser.add_option( "-a", "--arch", default=None, help= _('act as if running the specified arch (default: current arch, note: does not override $releasever. x86_64 is a superset for i*86.)' )) parser.add_option("--source", default=False, dest="source", action="store_true", help=_('operate on source packages')) parser.add_option( "-r", "--repoid", default=[], action='append', help= _("specify repo ids to query, can be specified multiple times (default is all enabled)" )) parser.add_option("-e", "--cachedir", help=_("directory in which to store metadata")) parser.add_option("-t", "--tempcache", default=False, action="store_true", help=_("Use a temp dir for storing/accessing yum-cache")) parser.add_option( "-d", "--delete", default=False, action="store_true", help=_("delete local packages no longer present in repository")) parser.add_option( "-p", "--download_path", dest='destdir', default=os.getcwd(), help=_("Path to download packages to: defaults to current dir")) parser.add_option( "--norepopath", dest='norepopath', default=False, action="store_true", help= _("Don't add the reponame to the download path. Can only be used when syncing a single repository (default is to add the reponame)" )) parser.add_option( "-g", "--gpgcheck", default=False, action="store_true", help=_( "Remove packages that fail GPG signature checking after downloading" )) parser.add_option( "-u", "--urls", default=False, action="store_true", help=_("Just list urls of what would be downloaded, don't download")) parser.add_option("-n", "--newest-only", dest='newest', default=False, action="store_true", help=_("Download only newest packages per-repo")) parser.add_option("-q", "--quiet", default=False, action="store_true", help=_("Output as little as possible")) parser.add_option("-l", "--plugins", default=False, action="store_true", help=_("enable yum plugin support")) parser.add_option("-m", "--downloadcomps", default=False, action="store_true", help=_("also download comps.xml")) parser.add_option("", "--download-metadata", dest="downloadmd", default=False, action="store_true", help=_("download all the non-default metadata")) parser.add_option( "", "--allow-path-traversal", default=False, action="store_true", help=_( "Allow packages stored outside their repo directory to be synced " "(UNSAFE, USE WITH CAUTION!)")) (opts, args) = parser.parse_args() return (opts, args)
return (opts, args) def main(): (opts, dummy) = parseArgs() if not os.path.exists(opts.destdir) and not opts.urls: try: os.makedirs(opts.destdir) except OSError, e: print >> sys.stderr, _( "Error: Cannot create destination dir %s") % opts.destdir sys.exit(1) if not os.access(opts.destdir, os.W_OK) and not opts.urls: print >> sys.stderr, _( "Error: Cannot write to destination dir %s") % opts.destdir sys.exit(1) my = RepoSync(opts=opts) my.doConfigSetup(fn=opts.config, init_plugins=opts.plugins) # Force unprivileged users to have a private temporary cachedir # if they've not given an explicit cachedir if os.getuid() != 0 and not opts.cachedir: opts.tempcache = True if opts.tempcache: if not my.setCacheDir(force=True, reuse=False): print >> sys.stderr, _("Error: Could not make cachedir, exiting") sys.exit(50) my.conf.uid = 1 # force locking of user cache
def parseArgs(): usage = _(""" Reposync is used to synchronize a remote yum repository to a local directory using yum to retrieve the packages. %s [options] """) % sys.argv[0] parser = OptionParser(usage=usage) parser.add_option("-c", "--config", default='/etc/yum.conf', help=_('config file to use (defaults to /etc/yum.conf)')) parser.add_option("-a", "--arch", default=None, help=_('act as if running the specified arch (default: current arch, note: does not override $releasever. x86_64 is a superset for i*86.)')) parser.add_option("--source", default=False, dest="source", action="store_true", help=_('operate on source packages')) parser.add_option("-r", "--repoid", default=[], action='append', help=_("specify repo ids to query, can be specified multiple times (default is all enabled)")) parser.add_option("-e", "--cachedir", help=_("directory in which to store metadata")) parser.add_option("-t", "--tempcache", default=False, action="store_true", help=_("Use a temp dir for storing/accessing yum-cache")) parser.add_option("-d", "--delete", default=False, action="store_true", help=_("delete local packages no longer present in repository")) parser.add_option("-p", "--download_path", dest='destdir', default=os.getcwd(), help=_("Path to download packages to: defaults to current dir")) parser.add_option("--norepopath", dest='norepopath', default=False, action="store_true", help=_("Don't add the reponame to the download path. Can only be used when syncing a single repository (default is to add the reponame)")) parser.add_option("-g", "--gpgcheck", default=False, action="store_true", help=_("Remove packages that fail GPG signature checking after downloading")) parser.add_option("-u", "--urls", default=False, action="store_true", help=_("Just list urls of what would be downloaded, don't download")) parser.add_option("-n", "--newest-only", dest='newest', default=False, action="store_true", help=_("Download only newest packages per-repo")) parser.add_option("-q", "--quiet", default=False, action="store_true", help=_("Output as little as possible")) parser.add_option("-l", "--plugins", default=False, action="store_true", help=_("enable yum plugin support")) parser.add_option("-m", "--downloadcomps", default=False, action="store_true", help=_("also download comps.xml")) parser.add_option("", "--download-metadata", dest="downloadmd", default=False, action="store_true", help=_("download all the non-default metadata")) (opts, args) = parser.parse_args() return (opts, args)
(opts, args) = parser.parse_args() return (opts, args) def main(): (opts, dummy) = parseArgs() if not os.path.exists(opts.destdir) and not opts.urls: try: os.makedirs(opts.destdir) except OSError, e: print >> sys.stderr, _("Error: Cannot create destination dir %s") % opts.destdir sys.exit(1) if not os.access(opts.destdir, os.W_OK) and not opts.urls: print >> sys.stderr, _("Error: Cannot write to destination dir %s") % opts.destdir sys.exit(1) my = RepoSync(opts=opts) my.doConfigSetup(fn=opts.config, init_plugins=opts.plugins) # Force unprivileged users to have a private temporary cachedir # if they've not given an explicit cachedir if os.getuid() != 0 and not opts.cachedir: opts.tempcache = True if opts.tempcache: if not my.setCacheDir(force=True, reuse=False): print >> sys.stderr, _("Error: Could not make cachedir, exiting") sys.exit(50) my.conf.uid = 1 # force locking of user cache