Esempio n. 1
0
	def release_without_0repo(archive_file, new_impls_feed):
		assert options.master_feed_file

		if not options.archive_dir_public_url:
			raise SafeException("Archive directory public URL is not set! Edit configuration and try again.")

		if status.updated_master_feed:
			print "Already added to master feed. Not changing."
		else:
			publish_opts = {}
			if os.path.exists(options.master_feed_file):
				# Check we haven't already released this version
				master = support.load_feed(os.path.realpath(options.master_feed_file))
				existing_releases = [impl for impl in master.implementations.values() if impl.get_version() == status.release_version]
				if len(existing_releases):
					raise SafeException("Master feed %s already contains an implementation with version number %s!" % (options.master_feed_file, status.release_version))

				previous_release = get_previous_release(status.release_version)
				previous_testing_releases = [impl for impl in master.implementations.values() if impl.get_version() == previous_release
													     and impl.upstream_stability == model.stability_levels["testing"]]
				if previous_testing_releases:
					print "The previous release, version %s, is still marked as 'testing'. Set to stable?" % previous_release
					if support.get_choice(['Yes', 'No']) == 'Yes':
						publish_opts['select_version'] = previous_release
						publish_opts['set_stability'] = "stable"

			support.publish(options.master_feed_file, local = new_impls_feed, xmlsign = True, key = options.key, **publish_opts)

			status.updated_master_feed = 'true'
			status.save()

		# Copy files...
		uploads = [os.path.basename(archive_file)]
		for b in compiler.get_binary_feeds():
			binary_feed = support.load_feed(b)
			impl, = binary_feed.implementations.values()
			uploads.append(os.path.basename(impl.download_sources[0].url))

		upload_archives(options, status, uploads)

		feed_base = os.path.dirname(list(local_feed.feed_for)[0])
		feed_files = [options.master_feed_file]
		print "Upload %s into %s" % (', '.join(feed_files), feed_base)
		cmd = options.master_feed_upload_command.strip()
		if cmd:
			support.show_and_run(cmd, feed_files)
		else:
			print "NOTE: No feed upload command set => you'll have to upload them yourself!"
Esempio n. 2
0
	def release_without_0repo(archive_file, new_impls_feed):
		assert options.master_feed_file

		if not options.archive_dir_public_url:
			raise SafeException("Archive directory public URL is not set! Edit configuration and try again.")

		if status.updated_master_feed:
			print "Already added to master feed. Not changing."
		else:
			publish_opts = {}
			if os.path.exists(options.master_feed_file):
				# Check we haven't already released this version
				master = support.load_feed(os.path.realpath(options.master_feed_file))
				existing_releases = [impl for impl in master.implementations.values() if impl.get_version() == status.release_version]
				if len(existing_releases):
					raise SafeException("Master feed %s already contains an implementation with version number %s!" % (options.master_feed_file, status.release_version))

				previous_release = get_previous_release(status.release_version)
				previous_testing_releases = [impl for impl in master.implementations.values() if impl.get_version() == previous_release
													     and impl.upstream_stability == model.stability_levels["testing"]]
				if previous_testing_releases:
					print "The previous release, version %s, is still marked as 'testing'. Set to stable?" % previous_release
					if support.get_choice(['Yes', 'No']) == 'Yes':
						publish_opts['select_version'] = previous_release
						publish_opts['set_stability'] = "stable"

			support.publish(options.master_feed_file, local = new_impls_feed, xmlsign = True, key = options.key, **publish_opts)

			status.updated_master_feed = 'true'
			status.save()

		# Copy files...
		uploads = [os.path.basename(archive_file)]
		for b in compiler.get_binary_feeds():
			binary_feed = support.load_feed(b)
			impl, = binary_feed.implementations.values()
			uploads.append(os.path.basename(impl.download_sources[0].url))

		upload_archives(options, status, uploads)

		feed_base = os.path.dirname(list(local_feed.feed_for)[0])
		feed_files = [options.master_feed_file]
		print "Upload %s into %s" % (', '.join(feed_files), feed_base)
		cmd = options.master_feed_upload_command.strip()
		if cmd:
			support.show_and_run(cmd, feed_files)
		else:
			print "NOTE: No feed upload command set => you'll have to upload them yourself!"
Esempio n. 3
0
    def build_binaries(self):
        if not self.targets: return

        print "Source package, so generating binaries..."

        archive_file = support.get_archive_basename(self.src_impl)

        for target in self.targets:
            start = self.get('builder-' + target, 'start', None)
            command = self.config.get('builder-' + target, 'build')
            stop = self.get('builder-' + target, 'stop', None)

            binary_feed = 'binary-' + target + '.xml'
            if os.path.exists(binary_feed):
                print "Feed %s already exists; not rebuilding" % binary_feed
            else:
                print "\nBuilding binary with builder '%s' ...\n" % target

                if start: support.show_and_run(start, [])
                try:
                    args = [
                        os.path.basename(self.src_feed_name), archive_file,
                        self.archive_dir_public_url, binary_feed + '.new'
                    ]
                    if not command:
                        assert target == 'host', 'Missing build command'
                        support.check_call(
                            [sys.executable, sys.argv[0], '--build-slave'] +
                            args)
                    else:
                        support.show_and_run(command, args)
                finally:
                    if stop: support.show_and_run(stop, [])

                bin_feed = support.load_feed(binary_feed + '.new')
                bin_impl = support.get_singleton_impl(bin_feed)
                bin_archive_file = support.get_archive_basename(bin_impl)
                bin_size = bin_impl.download_sources[0].size

                assert os.path.exists(
                    bin_archive_file
                ), "Compiled binary '%s' not found!" % os.path.abspath(
                    bin_archive_file)
                assert os.path.getsize(
                    bin_archive_file
                ) == bin_size, "Compiled binary '%s' has wrong size!" % os.path.abspath(
                    bin_archive_file)

                portable_rename(binary_feed + '.new', binary_feed)
Esempio n. 4
0
	def build_binaries(self):
		if not self.targets: return

		print "Source package, so generating binaries..."

		archive_file = support.get_archive_basename(self.src_impl)

		for target in self.targets:
			start = self.get('builder-' + target, 'start', None)
			command = self.config.get('builder-' + target, 'build')
			stop = self.get('builder-' + target, 'stop', None)

			binary_feed = 'binary-' + target + '.xml'
			if os.path.exists(binary_feed):
				print "Feed %s already exists; not rebuilding" % binary_feed
			else:
				print "\nBuilding binary with builder '%s' ...\n" % target

				if start: support.show_and_run(start, [])
				try:
					args = [os.path.basename(self.src_feed_name), archive_file, self.archive_dir_public_url, binary_feed + '.new']
					if not command:
						assert target == 'host', 'Missing build command'
						support.check_call([sys.executable, sys.argv[0], '--build-slave'] + args)
					else:
						support.show_and_run(command, args)
				finally:
					if stop: support.show_and_run(stop, [])

				bin_feed = support.load_feed(binary_feed + '.new')
				bin_impl = support.get_singleton_impl(bin_feed)
				bin_archive_file = support.get_archive_basename(bin_impl)
				bin_size = bin_impl.download_sources[0].size

				assert os.path.exists(bin_archive_file), "Compiled binary '%s' not found!" % os.path.abspath(bin_archive_file)
				assert os.path.getsize(bin_archive_file) == bin_size, "Compiled binary '%s' has wrong size!" % os.path.abspath(bin_archive_file)

				portable_rename(binary_feed + '.new', binary_feed)
Esempio n. 5
0
		for i, stat in enumerate(status.verified_uploads):
			assert stat in 'NAV'
			if stat == 'N':
				to_upload.append(uploads[i])
				print "Upload %s/%s as %s" % (status.release_version, uploads[i], url(uploads[i]))

		cmd = options.archive_upload_command.strip()

		if to_upload:
			# Mark all New items as Attempted
			status.verified_uploads = status.verified_uploads.replace('N', 'A')
			status.save()

			# Upload them...
			if cmd:
				support.show_and_run(cmd, to_upload)
			else:
				if len(to_upload) == 1:
					print "No upload command is set => please upload the archive manually now"
					raw_input('Press Return once the archive is uploaded.')
				else:
					print "No upload command is set => please upload the archives manually now"
					raw_input('Press Return once the %d archives are uploaded.' % len(to_upload))

		# Verify all Attempted uploads
		new_stat = ''
		for i, stat in enumerate(status.verified_uploads):
			assert stat in 'AV', status.verified_uploads
			if stat == 'A' :
				if not is_uploaded(url(uploads[i]), os.path.getsize(uploads[i])):
					print "** Archive '%s' still not uploaded! Try again..." % uploads[i]
Esempio n. 6
0
		for i, stat in enumerate(status.verified_uploads):
			assert stat in 'NAV'
			if stat == 'N':
				to_upload.append(uploads[i])
				print "Upload %s/%s as %s" % (status.release_version, uploads[i], url(uploads[i]))

		cmd = options.archive_upload_command.strip()

		if to_upload:
			# Mark all New items as Attempted
			status.verified_uploads = status.verified_uploads.replace('N', 'A')
			status.save()

			# Upload them...
			if cmd:
				support.show_and_run(cmd, to_upload)
			else:
				if len(to_upload) == 1:
					print "No upload command is set => please upload the archive manually now"
					raw_input('Press Return once the archive is uploaded.')
				else:
					print "No upload command is set => please upload the archives manually now"
					raw_input('Press Return once the %d archives are uploaded.' % len(to_upload))

		# Verify all Attempted uploads
		new_stat = ''
		for i, stat in enumerate(status.verified_uploads):
			assert stat in 'AV', status.verified_uploads
			if stat == 'A' :
				if not is_uploaded(url(uploads[i]), os.path.getsize(uploads[i])):
					print "** Archive '%s' still not uploaded! Try again..." % uploads[i]