Beispiel #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)
Beispiel #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)
Beispiel #3
0
    def load_repo():
        ''' Loads the repo '''
        Msg.process(_('Loading repo: {0}').format(LocalRepo._repo.path))

        try:
            LocalRepo._repo.load()
        except LocalRepoError as e:
            LocalRepo.error(e)
Beispiel #4
0
	def load_repo():
		''' Loads the repo '''
		Msg.process(_('Loading repo: {0}').format(LocalRepo._repo.path))

		try:
			LocalRepo._repo.load()
		except LocalRepoError as e:
			LocalRepo.error(e)
Beispiel #5
0
    def info(names):
        ''' Prints all available info of specified packages '''
        for name in names:
            if name not in LocalRepo._repo:
                Msg.error(_('Package does not exist: {0}').format(name))
                LocalRepo.shutdown(1)

            Msg.process(_('Package information: {0}').format(name))
            Msg.info(LocalRepo._repo[name])
Beispiel #6
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)
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
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)
Beispiel #10
0
	def info(names):
		''' Prints all available info of specified packages '''
		for name in names:
			if not LocalRepo._repo.has(name):
				Msg.error(_('Package does not exist: {0}').format(name))
				LocalRepo.shutdown(1)

			Msg.process(_('Package information: {0}').format(name))
			Msg.info(LocalRepo._repo.package(name))
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
0
	def aur_add(names, force=False):
		''' Downloads, makes and adds packages from the AUR '''
		Msg.process(_('Retrieving package info from the AUR'))
		pkgs, errors = Aur.packages(names)

		for e in errors:
			Msg.error(e)

		for pkg in pkgs.values():
			if not force and pkg['name'] in LocalRepo._repo:
				Msg.error(_('Package is already in the repo: {0}').format(pkg['name']))
				LocalRepo.shutdown(1)

			LocalRepo.add([pkg['uri']], force=force)
Beispiel #14
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)
Beispiel #15
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)
Beispiel #16
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)
Beispiel #17
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)
Beispiel #18
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)
Beispiel #19
0
    def aur_add(names, force=False):
        ''' Downloads, makes and adds packages from the AUR '''
        Msg.process(_('Retrieving package info from the AUR'))
        pkgs, errors = Aur.packages(names)

        for e in errors:
            Msg.error(e)

        pkgs_uri = []
        for pkg in pkgs.values():
            if not force and pkg['name'] in LocalRepo._repo:
                Msg.error(
                    _('Package is already in the repo: {0}').format(
                        pkg['name']))
            else:
                pkgs_uri.append(pkg['uri'])

        if pkgs_uri:
            LocalRepo.add(pkgs_uri, force=force)
Beispiel #20
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)
Beispiel #21
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)
Beispiel #22
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)
Beispiel #23
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)
Beispiel #24
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)
Beispiel #25
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)