コード例 #1
0
	def main(self, args):
		meta_inf_dir = os.path.join(args.path, 'meta-inf', args.ucs_version)
		repo_dir = os.path.join(args.path, 'univention-repository', args.ucs_version)
		if args.revert:
			try:
				shutil.rmtree(os.path.dirname(meta_inf_dir))
			except OSError as exc:
				self.warn(exc)
			try:
				shutil.rmtree(os.path.dirname(repo_dir))
			except OSError as exc:
				self.warn(exc)
			use_test_appcenter = get_action('dev-use-test-appcenter')
			use_test_appcenter.call_safe(revert=True)
		else:
			mkdir(meta_inf_dir)
			mkdir(os.path.join(repo_dir, 'maintained', 'component'))
			for supra_file in ['categories.ini', 'rating.ini', 'license_types.ini', 'ucs.ini']:
				with open(os.path.join(meta_inf_dir, '..', supra_file), 'wb') as f:
					categories = urlopen('%s/meta-inf/%s' % (default_server(), supra_file)).read()
					f.write(categories)
			server = 'http://%s' % args.appcenter_host
			use_test_appcenter = get_action('dev-use-test-appcenter')
			use_test_appcenter.call_safe(appcenter_host=server)
			DevRegenerateMetaInf.call_safe(ucs_version=args.ucs_version, path=args.path, appcenter_host=server)
			self.log('Local App Center server is set up at %s.' % server)
			self.log('If this server should serve as an App Center server for other computers in the UCS domain, the following command has to be executed on each computer:')
			self.log('  univention-app dev-use-test-appcenter --appcenter-host="%s"' % server)
コード例 #2
0
 def suggestions(self, version):
     try:
         cache = AppCenterCache.build(server=default_server())
         cache_file = cache.get_cache_file('.suggestions.json')
         with open(cache_file) as fd:
             json = load(fd)
     except (EnvironmentError, ValueError):
         raise umcm.UMC_Error(_('Could not load suggestions.'))
     else:
         try:
             return json[version]
         except (KeyError, AttributeError):
             raise umcm.UMC_Error(_('Unexpected suggestions data.'))
コード例 #3
0
    def get_blocking_apps(cls, ucs_version):
        ''' checks if update is possible for this app '''
        ucs_version = UCS_Version(ucs_version + '-0')
        next_minor = '%(major)d.%(minor)d' % ucs_version
        next_version = '%(major)d.%(minor)d-%(patchlevel)d' % ucs_version
        current_version = UCS_Version(ucr_get('version/version') + '-0')
        current_minor = '%(major)d.%(minor)d' % current_version

        # if this is just a patchlevel update, everything is fine
        if current_minor >= next_minor:
            return {}

        # first, update the local cache and get current apps
        update = get_action('update')
        update.logger = get_logfile_logger('update-check')
        update.call()
        current_cache = Apps(locale='en')

        # get apps in next version
        with TemporaryDirectory() as tempdir:
            update.call(ucs_version=next_minor,
                        cache_dir=tempdir,
                        just_get_cache=True)
            next_cache = AppCenterCache.build(ucs_versions=next_minor,
                                              server=default_server(),
                                              locale='en',
                                              cache_dir=tempdir)
            next_apps = next_cache.get_every_single_app()

        # check apps
        blocking_apps = dict()
        for app in current_cache.get_all_locally_installed_apps():
            if not cls.app_can_update(app, next_version, next_apps):
                cls.debug('app %s is not available for %s' %
                          (app.id, next_version))
                blocking_apps[app.component_id] = app.name
            else:
                cls.debug('app %s is available for %s' %
                          (app.id, next_version))
        return blocking_apps
コード例 #4
0
	def setup_parser(self, parser):
		super(DevPopulateAppcenter, self).setup_parser(parser)
		version = ucr_get('version/version')
		arch = subprocess.check_output(['uname', '-m']).strip()
		parser.add_argument('--new', action='store_true', help='Add a completely new (or a new version of an existing) app in the local App Center')
		parser.add_argument('-c', '--component-id', help='The internal component ID for this version of the App')
		parser.add_argument('--clear', action='store_true', help='Clear existing files')
		parser.add_argument('-i', '--ini', help='Path to the ini file of the App')
		parser.add_argument('-l', '--logo', help='Path to the logo file of the App (UCS 4.1: square SVG; UCS <= 4.0: 50x50 transparent PNG)')
		parser.add_argument('--logo-detail', dest='logo_detail_page', help='Path to the detail logo file of the App (4.1 only, elongated SVG)')
		parser.add_argument('-s', '--screenshot', nargs='+', help='Path to a screenshot (UCS < 4.1 only). Needs to be mentioned in INI as Screenshot=.... If the screenshot is localised (Screenshot= in [de]), two screenshots should be given. Superseded by THUMBNAILS in UCS 4.1')
		parser.add_argument('-t', '--thumbnails', nargs='+', help='Path to Thumbnails (UCS 4.1 only). Need to be mentioned in INI as Thumbnails=.... If the thumbnails are localised (Thumbnails= in [de]), first all [en], then all [de] Thumbnails should be given')
		parser.add_argument('--ucr', help='Path to a file describing Univention Config Registry variables')
		parser.add_argument('--schema', help='Path to an LDAP schema extension file')
		parser.add_argument('--attributes', help='Path to the file describing Extended Attributes')
		parser.add_argument('--configure', help='Path to a configure script that will be called when applying settings in a container')
		parser.add_argument('--configure-host', help='Path to a configure_host script that will be called when applying settings in a container')
		parser.add_argument('--settings', help='Path to the file describing Settings')
		parser.add_argument('--preinst', help='Path to a preinst script that will be called by the App Center before installation')
		parser.add_argument('--join', help='Path to a join script that will be called by the App Center after installation')
		parser.add_argument('--prerm', help='Path to a prerm script that will be called by the App Center before uninstallation')
		parser.add_argument('--unjoin', help='Path to an unjoin script that will be called by the App Center after uninstallation')
		parser.add_argument('--init', help='Path to the init script that will be the entrypoint for a docker image (docker only)')
		parser.add_argument('--setup', help='Path to a script that sets up the app after the container has been initialized (docker only)')
		parser.add_argument('--store-data', help='Path to a script that stores data before the docker container is changed (docker only)')
		parser.add_argument('--restore-data-before-setup', help='Path to a script that restores data after the docker container is changed and before setup is run (docker only)')
		parser.add_argument('--restore-data-after-setup', help='Path to a script that restores data after the docker container is changed and after setup is run (docker only)')
		parser.add_argument('--update-available', help='Path to a script that finds out whether an update for the operating system in the container is available (docker only)')
		parser.add_argument('--update-packages', help='Path to a script that updates packages in the container (docker only)')
		parser.add_argument('--update-release', help='Path to a script that upgrades the operating system in the container (docker only)')
		parser.add_argument('--update-app-version', help='Path to a script that updates the app within the container (docker only)')
		parser.add_argument('--env', help='Path to a file containing (a part of) the docker environment (docker only)')
		parser.add_argument('-r', '--readme', nargs='+', help='Path to (multiple) README files like README_DE, README_POST_INSTALL')
		parser.add_argument('--license', nargs='+', help='Path to (multiple) LICENSE_AGREEMENT files like LICENSE_AGREEMENT, LICENSE_AGREEMENT_DE')
		parser.add_argument('-p', '--packages', nargs='+', help='Path to debian packages files for the app', metavar='PACKAGE')
		parser.add_argument('-u', '--unmaintained', nargs='+', help='Package names that exist in the unmaintained repository for UCS. ATTENTION: Only works for --ucs-version=%s; takes some time, but it is only needed once, so for further package updates of this very app version this is not need to be done again. ATTENTION: Only works for architecture %s.' % (version, arch), metavar='PACKAGE')
		parser.add_argument('-d', '--do-not-delete-duplicates', action='store_true', help=' If any PACKAGE already exist in the repository (e.g. another version), they are removed. Unless this option is set.')
		parser.add_argument('--appcenter-host', default=default_server(), help='The hostname of the new App Center. Default: %(default)s')
コード例 #5
0
def get_server():
	from univention.appcenter.app_cache import default_server
	return default_server()
コード例 #6
0
 def setup_parser(self, parser):
     super(DevRegenerateMetaInf, self).setup_parser(parser)
     parser.add_argument(
         '--appcenter-host',
         default=default_server(),
         help='The hostname of the new App Center. Default: %(default)s')