示例#1
0
文件: yum-cron.py 项目: stepasm/yum
def main():
    """Configure and run the update check."""
    setup_locale(override_time=True)
    # If a file name was passed in, use it as the config file name.
    base = None
    if len(sys.argv) > 1:
        base = YumCronBase(sys.argv[1])
    else:
        base = YumCronBase()

    #Run the update check
    base.updatesCheck()
示例#2
0
def main():
    """Configure and run the update check."""
    setup_locale(override_time=True)
    # If a file name was passed in, use it as the config file name.
    base = None
    if len(sys.argv) > 1:
        base = YumCronBase(sys.argv[1])
    else:
        base = YumCronBase()

    #Run the update check
    base.updatesCheck()
            if os.geteuid() != 0:
                print "Error: Cannot remove packages as a user, must be root"
                sys.exit(1)
            if opts.noscripts:
                self.conf.tsflags.append('noscripts')
            self._remove_old_dupes()
            self.run_with_package_names.add('yum-utils')

            if hasattr(self, 'doUtilBuildTransaction'):
                errc = self.doUtilBuildTransaction()
                if errc:
                    sys.exit(errc)
            else:
                try:
                    self.buildTransaction()
                except yum.Errors.YumBaseError, e:
                    self.logger.critical("Error building transaction: %s" % e)
                    sys.exit(1)
                                    

            if len(self.tsInfo) < 1:
                print 'No duplicates to remove'
                sys.exit(0)
                
            sys.exit(self.doUtilTransaction())

    
if __name__ == '__main__':
    setup_locale()
    util = PackageCleanup()
示例#4
0
            default=".",
            dest="destdir",
            help='destination directory (defaults to current directory)')
        group.add_option(
            "--urls",
            default=False,
            dest="urls",
            action="store_true",
            help='just list the urls it would download instead of downloading')
        group.add_option(
            "--resolve",
            default=False,
            dest="resolve",
            action="store_true",
            help='resolve dependencies and download required packages')
        group.add_option("--source",
                         default=False,
                         dest="source",
                         action="store_true",
                         help='operate on source packages')
        group.add_option(
            "--archlist",
            help="only download packages of given and compatible architectures"
        )


if __name__ == '__main__':
    setup_locale()
    util = YumDownloader()
    sys.exit(util.exit_code)