From patchwork Tue Dec 17 14:31:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 36906 Received: (qmail 6677 invoked by alias); 17 Dec 2019 14:31:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 6594 invoked by uid 89); 17 Dec 2019 14:31:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=14656, Versions X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576593076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q3ngC9gEHBr/XVWQJXpvT1xCi1kcMRNdVqTqCvceJtw=; b=GhmQBevAfZmMyYIm2rygSq/m1/BKfVsVarTt2l6xVBFyW2OYUnzaAeTpMyBA3io43f1SKM f1OgKzr3QRRx3JpG8OQ10ET1d0H+df54ru+XJOWo+nlR9dY9d5pgeoFCLyvv5PVUSi8Oxk uOELFbVGD7EF42dPh7iPQDRKlo9twk4= From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 5/5] build-many-glibcs.py: Implement update-syscalls command In-Reply-To: References: Message-Id: <3b349542ee5e34bad23cd6d89bc59de768f5f36d.1576588849.git.fweimer@redhat.com> Date: Tue, 17 Dec 2019 15:31:11 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 This command uses pre-built compilers to re-install the Linux headers from the current sources into a temporary location and runs glibc's “make update-syscalls-lists” against that. This updates the glibc source tree with the current system call numbers. Reviewed-by: Siddhesh Poyarekar --- scripts/build-many-glibcs.py | 65 ++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index 58f2409b1d..eedaa55033 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -498,7 +498,10 @@ class Context(object): old_components = ('gmp', 'mpfr', 'mpc', 'binutils', 'gcc', 'linux', 'mig', 'gnumach', 'hurd') old_versions = self.build_state['compilers']['build-versions'] - self.build_glibcs(configs) + if action == 'update-syscalls': + self.update_syscalls(configs) + else: + self.build_glibcs(configs) self.write_files() self.do_build() if configs: @@ -689,6 +692,15 @@ class Context(object): for c in configs: self.glibc_configs[c].build() + def update_syscalls(self, configs): + """Update the glibc syscall lists.""" + if not configs: + self.remove_dirs(os.path.join(self.builddir, 'update-syscalls')) + self.remove_dirs(os.path.join(self.logsdir, 'update-syscalls')) + configs = sorted(self.glibc_configs.keys()) + for c in configs: + self.glibc_configs[c].update_syscalls() + def load_versions_json(self): """Load information about source directory versions.""" if not os.access(self.versions_json, os.F_OK): @@ -921,7 +933,7 @@ class Context(object): self.build_state = json.load(f) else: self.build_state = {} - for k in ('host-libraries', 'compilers', 'glibcs'): + for k in ('host-libraries', 'compilers', 'glibcs', 'update-syscalls'): if k not in self.build_state: self.build_state[k] = {} if 'build-time' not in self.build_state[k]: @@ -1169,6 +1181,16 @@ class LinuxHeadersPolicyForBuild(object): self.builddir = config.component_builddir('linux') self.headers_dir = os.path.join(config.sysroot, 'usr') +class LinuxHeadersPolicyForUpdateSyscalls(object): + """Names and directories for Linux headers. update-syscalls variant.""" + + def __init__(self, glibc, headers_dir): + self.arch = glibc.compiler.arch + self.srcdir = glibc.compiler.ctx.component_srcdir('linux') + self.builddir = glibc.ctx.component_builddir( + 'update-syscalls', glibc.name, 'build-linux') + self.headers_dir = headers_dir + def install_linux_headers(policy, cmdlist): """Install Linux kernel headers.""" arch_map = {'aarch64': 'arm64', @@ -1465,6 +1487,20 @@ class GlibcPolicyForBuild(GlibcPolicyDefault): cmdlist.add_command('check', ['make', 'check']) cmdlist.add_command('save-logs', [self.save_logs], always_run=True) +class GlibcPolicyForUpdateSyscalls(GlibcPolicyDefault): + """Build policy for glibc during update-syscalls.""" + + def __init__(self, glibc): + super().__init__(glibc) + self.builddir = glibc.ctx.component_builddir( + 'update-syscalls', glibc.name, 'glibc') + self.linuxdir = glibc.ctx.component_builddir( + 'update-syscalls', glibc.name, 'linux') + self.linux_policy = LinuxHeadersPolicyForUpdateSyscalls( + glibc, self.linuxdir) + self.configure_args.insert( + 0, '--with-headers=%s' % os.path.join(self.linuxdir, 'include')) + # self.installdir not set because installation is not supported class Glibc(object): """A configuration for building glibc.""" @@ -1535,6 +1571,28 @@ class Glibc(object): policy.extra_commands(cmdlist) cmdlist.cleanup_dir() + def update_syscalls(self): + if self.os == 'gnu': + # Hurd does not have system call tables that need updating. + return + + policy = GlibcPolicyForUpdateSyscalls(self) + logsdir = os.path.join(self.ctx.logsdir, 'update-syscalls', self.name) + self.ctx.remove_recreate_dirs(policy.builddir, logsdir) + cmdlist = CommandList('update-syscalls-%s' % self.name, self.ctx.keep) + cmdlist.add_command('check-compilers', + ['test', '-f', + os.path.join(self.compiler.installdir, 'ok')]) + cmdlist.use_path(self.compiler.bindir) + + install_linux_headers(policy.linux_policy, cmdlist) + + cmdlist.create_use_dir(policy.builddir) + policy.configure(cmdlist) + cmdlist.add_command('build', ['make', 'update-syscall-lists']) + cmdlist.cleanup_dir() + self.ctx.add_makefile_cmdlist('update-syscalls-%s' % self.name, + cmdlist, logsdir) class Command(object): """A command run in the build process.""" @@ -1702,7 +1760,8 @@ def get_parser(): parser.add_argument('action', help='What to do', choices=('checkout', 'bot-cycle', 'bot', - 'host-libraries', 'compilers', 'glibcs')) + 'host-libraries', 'compilers', 'glibcs', + 'update-syscalls')) parser.add_argument('configs', help='Versions to check out or configurations to build', nargs='*')