예제 #1
0
    def vcs_upgrade():
        ''' Upgrades all VCS packages from the AUR '''
        Msg.process(_('Updating all VCS packages'))
        Log.log(_('Starting a VCS upgrade'))
        vcs = [pkg for pkg in LocalRepo._repo if LocalRepo._repo[pkg].is_vcs]

        if not vcs:
            Msg.info(_('No VCS packages found'))
            return

        Msg.process(_('Retrieving package info from the AUR'))
        updates, errors = Aur.packages(vcs)

        for e in errors:
            Msg.error(e)

        if not updates:
            Msg.info(_('No updates found'))
            return

        Msg.result('\n'.join(updates))

        if not Msg.ask(_('Upgrade?')):
            Msg.info(_('Bye'))
            return

        LocalRepo.add([pkg['uri'] for pkg in updates.values()], force=True)
예제 #2
0
	def vcs_upgrade():
		''' Upgrades all VCS packages from the AUR '''
		Msg.process(_('Updating all VCS packages'))
		Log.log(_('Starting a VCS upgrade'))
		vcs = [pkg for pkg in LocalRepo._repo if LocalRepo._repo[pkg].is_vcs]

		if not vcs:
			Msg.info(_('No VCS packages found'))
			return

		Msg.process(_('Retrieving package info from the AUR'))
		updates, errors = Aur.packages(vcs)

		for e in errors:
			Msg.error(e)

		if not updates:
			Msg.info(_('No updates found'))
			return

		Msg.result('\n'.join(updates))

		if not Msg.ask(_('Upgrade?')):
			Msg.info(_('Bye'))
			return

		LocalRepo.add([pkg['uri'] for pkg in updates.values()], force=True)
예제 #3
0
	def clear_cache():
		''' Clears the repo cache '''
		Msg.process(_('Clearing the cache'))

		try:
			LocalRepo._repo.clear_cache()
			Log.log(_('Cleared cache'))
		except LocalRepoError as e:
			LocalRepo.error(e)
예제 #4
0
    def restore_db():
        ''' Try to restore the database file '''
        Msg.process(_('Restoring database'))

        try:
            LocalRepo._repo.restore_db()
            Log.log(_('Restored Database'))
        except LocalRepoError as e:
            LocalRepo.error(e)
예제 #5
0
	def restore_db():
		''' Try to restore the database file '''
		Msg.process(_('Restoring database'))

		try:
			LocalRepo._repo.restore_db()
			Log.log(_('Restored Database'))
		except LocalRepoError as e:
			LocalRepo.error(e)
예제 #6
0
    def clear_cache():
        ''' Clears the repo cache '''
        Msg.process(_('Clearing the cache'))

        try:
            LocalRepo._repo.clear_cache()
            Log.log(_('Cleared cache'))
        except LocalRepoError as e:
            LocalRepo.error(e)
예제 #7
0
	def add(paths, force=False):
		''' Adds packages to the repo '''
		for path in paths:
			pkg = LocalRepo._make_package(path)

			try:
				Msg.process(_('Adding package to the repo: {0}').format(pkg.name))
				LocalRepo._repo.add(pkg, force=force)
				Log.log(_('Added Package: {0} {1}').format(pkg.name, pkg.version))
			except LocalRepoError as e:
				LocalRepo.error(e)
예제 #8
0
    def add(paths, force=False):
        ''' Adds packages to the repo '''
        for path in paths:
            pkg = LocalRepo._make_package(path, force=force)

            try:
                Msg.process(
                    _('Adding package to the repo: {0}').format(pkg.name))
                LocalRepo._repo.add(pkg, force=force)
                Log.log(
                    _('Added Package: {0} {1}').format(pkg.name, pkg.version))
            except LocalRepoError as e:
                LocalRepo.error(e)
예제 #9
0
	def remove(names):
		''' Removes packages from the repo '''
		missing = [name for name in names if not LocalRepo._repo.has(name)]

		if missing:
			Msg.error(_('Packages do not exist: {0}').format(', '.join(missing)))
			LocalRepo.shutdown(1)

		Msg.process(_('Removing packages: {0}').format(', '.join(names)))

		try:
			LocalRepo._repo.remove(names)
			Log.log(_('Removed packages: {0}').format(', '.join(names)))
		except LocalRepoError as e:
			LocalRepo.error(e)
예제 #10
0
	def _make_package(path):
		''' Makes a new package '''
		Msg.process(_('Forging a new package: {0}').format(path))
		Log.log(_('Forging a new package: {0}').format(path))

		try:
			return Package.forge(path)
		except DependencyError as e:
			LocalRepo._install_deps(e.deps)

			try:
				return Package.from_pkgbuild(e.pkgbuild, ignore_deps=True)
			except LocalRepoError as e:
				LocalRepo.error(e)
		except LocalRepoError as e:
			LocalRepo.error(e)
예제 #11
0
	def check():
		''' Run an integrity check '''
		Msg.info(_('{0} packages found').format(LocalRepo._repo.size))
		Msg.process(_('Running integrity check'))
		errors = LocalRepo._repo.check()

		if not errors:
			Msg.info(_('No errors found'))
			Log.log(_('Finished integrity check without any errors'))
			return

		Log.log(_('Finished integrity check with errors:'))

		for e in errors:
			Msg.result(e)
			Log.error(e)
예제 #12
0
    def check():
        ''' Run an integrity check '''
        Msg.info(_('{0} packages found').format(len(LocalRepo._repo)))
        Msg.process(_('Running integrity check'))
        errors = LocalRepo._repo.check()

        if not errors:
            Msg.info(_('No errors found'))
            Log.log(_('Finished integrity check without any errors'))
            return

        Log.log(_('Finished integrity check with errors:'))

        for e in errors:
            Msg.result(e)
            Log.error(e)
예제 #13
0
    def remove(names):
        ''' Removes packages from the repo '''
        missing = [name for name in names if name not in LocalRepo._repo]

        if missing:
            Msg.error(
                _('Packages do not exist: {0}').format(', '.join(missing)))
            LocalRepo.shutdown(1)

        Msg.process(_('Removing packages: {0}').format(', '.join(names)))

        try:
            LocalRepo._repo.remove(names)
            Log.log(_('Removed packages: {0}').format(', '.join(names)))
        except LocalRepoError as e:
            LocalRepo.error(e)
예제 #14
0
    def aur_upgrade():
        ''' Upgrades all packages from the AUR '''
        pkgs = [
            pkg for pkg in LocalRepo._repo
            if pkg not in Config.get('no-aur-upgrade', [])
        ]
        Msg.info(_('{0} packages found').format(len(pkgs)))
        Log.log(_('Starting an AUR upgrade'))

        if len(pkgs) is 0:
            Msg.info(_('Nothing to do'))
            return

        Msg.process(_('Retrieving package info from the AUR'))
        pkgs, errors = Aur.packages(pkgs)

        for e in errors:
            Msg.error(e)

        Msg.info(_('{0} packages found').format(len(pkgs)))
        Msg.process(_('Checking for updates'))
        updates = []

        for name, pkg in ((name, pkg) for name, pkg in pkgs.items()
                          if name in LocalRepo._repo):
            oldpkg = LocalRepo._repo[name]

            if oldpkg.has_smaller_version_than(pkg['version']):
                updates.append(pkg)
                Msg.result('{0} ({1} -> {2})'.format(name, oldpkg.version,
                                                     pkg['version']))

        if not updates:
            Msg.info(_('All packages are up to date'))
            return

        if not Msg.ask(_('Upgrade?')):
            Msg.info(_('Bye'))
            LocalRepo.shutdown(1)

        LocalRepo.add([pkg['uri'] for pkg in updates], force=True)
예제 #15
0
	def _make_package(path, force=False):
		''' Makes a new package '''
		Msg.process(_('Forging a new package: {0}').format(path))
		Log.log(_('Forging a new package: {0}').format(path))

		try:
			return Package.forge(path, force=force)
		except DependencyError as e:
			installed_deps = LocalRepo._install_deps(e.deps)

			try:
				pkg = Package.from_pkgbuild(e.pkgbuild, ignore_deps=True, force=force)
			except LocalRepoError as e:
				LocalRepo.error(e)

			if Config.get('uninstall-deps', True) and installed_deps:
				LocalRepo._uninstall_deps(e.deps)

			return pkg

		except LocalRepoError as e:
			LocalRepo.error(e)
예제 #16
0
	def aur_upgrade():
		''' Upgrades all packages from the AUR '''
		pkgs = [pkg for pkg in LocalRepo._repo if pkg not in Config.get('no-aur-upgrade', [])]
		Msg.info(_('{0} packages found').format(len(pkgs)))
		Log.log(_('Starting an AUR upgrade'))

		if len(pkgs) is 0:
			Msg.info(_('Nothing to do'))
			return

		Msg.process(_('Retrieving package info from the AUR'))
		pkgs, errors = Aur.packages(pkgs)

		for e in errors:
			Msg.error(e)

		Msg.info(_('{0} packages found').format(len(pkgs)))
		Msg.process(_('Checking for updates'))
		updates = []

		for name, pkg in ((name, pkg) for name, pkg in pkgs.items() if name in LocalRepo._repo):
			oldpkg = LocalRepo._repo[name]

			if oldpkg.has_smaller_version_than(pkg['version']):
				updates.append(pkg)
				Msg.result('{0} ({1} -> {2})'.format(name, oldpkg.version, pkg['version']))

		if not updates:
			Msg.info(_('All packages are up to date'))
			return

		if not Msg.ask(_('Upgrade?')):
			Msg.info(_('Bye'))
			LocalRepo.shutdown(1)

		LocalRepo.add([pkg['uri'] for pkg in updates], force=True)
예제 #17
0
	def vcs_upgrade():
		''' Upgrades all VCS packages from the AUR '''
		Msg.process(_('Updating all VCS packages'))
		Log.log(_('Starting a VCS upgrade'))
		vcs = LocalRepo._repo.vcs_packages

		if not vcs:
			Msg.info(_('No VCS packages found'))
			return

		Msg.process(_('Retrieving package info from the AUR'))

		try:
			updates = Aur.packages(vcs)
		except LocalRepoError as e:
			LocalRepo.error(e)

		Msg.result('\n'.join(updates))

		if not Msg.ask(_('Upgrade?')):
			Msg.info(_('Bye'))
			return

		LocalRepo.add([pkg['uri'] for pkg in updates.values()], force=True)
예제 #18
0
	def aur_upgrade():
		''' Upgrades all packages from the AUR '''
		Msg.info(_('{0} packages found').format(LocalRepo._repo.size))
		Log.log(_('Starting an AUR upgrade'))

		if LocalRepo._repo.size is 0:
			Msg.info(_('Nothing to do'))
			return

		Msg.process(_('Retrieving package info from the AUR'))

		try:
			pkgs = Aur.packages(LocalRepo._repo.packages)
		except LocalRepoError as e:
			LocalRepo.error(e)

		Msg.info(_('{0} packages found').format(len(pkgs)))
		Msg.process(_('Checking for updates'))
		updates = []

		for name, pkg in ((name, pkg) for name, pkg in pkgs.items() if LocalRepo._repo.has(name)):
			oldpkg = LocalRepo._repo.package(name)

			if oldpkg.has_smaller_version_than(pkg['version']):
				updates.append(pkg)
				Msg.result('{0} ({1} -> {2})'.format(name, oldpkg.version, pkg['version']))

		if not updates:
			Msg.info(_('All packages are up to date'))
			return

		if not Msg.ask(_('Upgrade?')):
			Msg.info(_('Bye'))
			LocalRepo.shutdown(1)

		LocalRepo.add([pkg['uri'] for pkg in updates], force=True)
예제 #19
0
    def _make_package(path, force=False):
        ''' Makes a new package '''
        Msg.process(_('Forging a new package: {0}').format(path))
        Log.log(_('Forging a new package: {0}').format(path))

        try:
            return Package.forge(path, force=force)
        except DependencyError as e:
            installed_deps = LocalRepo._install_deps(e.deps)

            try:
                pkg = Package.from_pkgbuild(e.pkgbuild,
                                            ignore_deps=True,
                                            force=force)
            except LocalRepoError as e:
                LocalRepo.error(e)

            if Config.get('uninstall-deps', True) and installed_deps:
                LocalRepo._uninstall_deps(e.deps)

            return pkg

        except LocalRepoError as e:
            LocalRepo.error(e)
예제 #20
0
파일: log.py 프로젝트: saik0/local-repo
	def test_log(self, error=False):
		msgs = ['Hello!', 'This is just a test...', 'Everything is fine... hopefully']
		Log.init(self.repo)

		for msg in msgs:
			Log.error(msg) if error else Log.log(msg)

		Log.close()

		with open(self.log) as f:
			i = 0
			p = '^\[[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}\] '

			if error:
				p += '\[\w+\] '

			for line in f:
				self.assertRegex(line, p + msgs[i] + '\n')
				i += 1
예제 #21
0
파일: log.py 프로젝트: yunchih/local-repo
    def test_log(self, error=False):
        msgs = [
            'Hello!', 'This is just a test...',
            'Everything is fine... hopefully'
        ]
        Log.init(self.repo)

        for msg in msgs:
            Log.error(msg) if error else Log.log(msg)

        Log.close()

        with open(self.log) as f:
            i = 0
            p = '^\[[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}\] '

            if error:
                p += '\[\w+\] '

            for line in f:
                self.assertRegex(line, p + msgs[i] + '\n')
                i += 1