From patchwork Thu Feb 26 20:00:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1940 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136106; bh=rcNKtgIDe+Q9UUY42vWt5Wr8UjHYkVAz+GkijMKCRmk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vQLMzHKz3vToXcONlIM1pT110II9kRLUiIJFcicKxKuKS4NsPLq2FypT6zsZxEUrk eeTHTY7qBgqa2PZntSJiOtCrQwm9Yuzkm38401dZg878NB6kbU32qjEW+HhoikoteN +0o6zUV7YMuKGXqvxjNwHFYp8Tsc8ADF4t6m2dEdf6O/46w0OsCckvj4B9n5n2VGv3 O4OmQfds7KOo5B+yIOmCXoyKkNQ8lEqkmfRSlhuasNFvPuTYP/Noec7rkiGG7MKj7+ l7GQ5Kevkf7F0rgjXtB3i73HIk1f09C/1BPBjcIZ5uajA47tjolYoJne0afZalkggX R3rTnLQ0qFQSA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3249C69D79 for ; Thu, 26 Feb 2026 13:01:46 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id MB69hR7Ne3QE for ; Thu, 26 Feb 2026 13:01:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136106; bh=rcNKtgIDe+Q9UUY42vWt5Wr8UjHYkVAz+GkijMKCRmk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vQLMzHKz3vToXcONlIM1pT110II9kRLUiIJFcicKxKuKS4NsPLq2FypT6zsZxEUrk eeTHTY7qBgqa2PZntSJiOtCrQwm9Yuzkm38401dZg878NB6kbU32qjEW+HhoikoteN +0o6zUV7YMuKGXqvxjNwHFYp8Tsc8ADF4t6m2dEdf6O/46w0OsCckvj4B9n5n2VGv3 O4OmQfds7KOo5B+yIOmCXoyKkNQ8lEqkmfRSlhuasNFvPuTYP/Noec7rkiGG7MKj7+ l7GQ5Kevkf7F0rgjXtB3i73HIk1f09C/1BPBjcIZ5uajA47tjolYoJne0afZalkggX R3rTnLQ0qFQSA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 22A8469DAB for ; Thu, 26 Feb 2026 13:01:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136104; bh=MkXauGtMLamJl17GnZMYnVv3AXk43YWAXnJHf5ODyyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rDZ0gnMOelgITXBw86VqBTjU/q3qsiD/2GGL5P+yvE9L6+GyjAxP0s5hbbMpkhk/P yzRgs2PB4hJw0GC5CGLA1CDVxxRmjXHbyMXCe33bdLu0NMcpDO7s49EeLF1xEMwpJM aacBUh3AGsMn/7WXgJMSaRXkY83cusD3EnCrckq792e3Dj8qmg1Fxaa91nuiDGY4gN pR79ZD7Hb/Whf8fZoPv6hsJhW0s0lHCIdBXU3MFBxSC2kr7QZ8vKWQXpFG5tleq3mk tbqZ9yjSYIrHdn1RgGhdurv9u6Cp+BXsZYS40ZnW5lDzxyc47Skvlt7ELxsbOHwEa+ tslc2QIcUA+Tg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4970369D79; Thu, 26 Feb 2026 13:01:44 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id kwXn73-yvslN; Thu, 26 Feb 2026 13:01:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136100; bh=MRwxQyphkOVhgqRknjEgayzeMuc2at6m0x6iT12OXKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQPGtP6Utd7Jb01CQL8FaZIKT1mFY8WMIuPLtzzRF7+sTFaNs+cFJ23ThrYrlDzD9 1OPxzvKoqssWIk6mjE6+FxzR4DvF3BTuyFnSG9m20QLbwBqpfNlHmtB+/QIotnTjyM Nj8IRly3WPPjm0JMcpNDgUxyimgZIiZQc3TeyQOP8WTefOs5qOQpvSP+RMasAucR2f mXXYGdH6ZDl1EOX92n/ZChw1Vj607i52qUcoR9J5/qgKEQORES/ccQGB5eIfqF6LN+ WjKeL8G0/8Cz/axFyhzAXdKxC8KpOEjrKyIx6feJXU3aa1R+c60oLP48WUM7cy+TqU 6SlTiBS7C8Zfw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1FF7E69D4A; Thu, 26 Feb 2026 13:01:40 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 26 Feb 2026 13:00:09 -0700 Message-ID: <20260226200106.1727176-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260226200106.1727176-1-sjg@u-boot.org> References: <20260226200106.1727176-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2Z6GL5YQJNH756P5L4JOBLHYZYNI5MJ2 X-Message-ID-Hash: 2Z6GL5YQJNH756P5L4JOBLHYZYNI5MJ2 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/32] patman: Add upstream and send settings to the database schema List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a v5 migration to support per-upstream configuration. This allows each series to be associated with an upstream remote, each upstream to have its own patchwork URL and send settings (identity, series_to, no_maintainers, no_tags) and each series version to have its own description. The settings table is recreated without the UNIQUE constraint on name, since the same patchwork project can be associated with multiple upstreams. Signed-off-by: Simon Glass --- tools/patman/database.py | 38 +++++++++++++++++++++++++++++++++++- tools/patman/test_cseries.py | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/tools/patman/database.py b/tools/patman/database.py index 4557c4ff3fc..2861ca69fa0 100644 --- a/tools/patman/database.py +++ b/tools/patman/database.py @@ -19,7 +19,7 @@ from u_boot_pylib import tout from patman.series import Series # Schema version (version 0 means there is no database yet) -LATEST = 4 +LATEST = 5 # Information about a series/version record SerVer = namedtuple( @@ -156,6 +156,40 @@ class Database: # pylint:disable=R0904 """Add an archive tag for each ser_ver""" self.cur.execute('ALTER TABLE ser_ver ADD COLUMN archive_tag') + def _migrate_to_v5(self): + """Add upstream support to series, settings and upstream tables + + - Add upstream column to series table + - Recreate settings table without UNIQUE constraint on name, adding + an upstream column (since the same project can have multiple + remotes) + - Add patchwork_url, identity, series_to, no_maintainers and + no_tags columns to upstream table + - Add desc column to ser_ver table + """ + self.cur.execute('ALTER TABLE series ADD COLUMN upstream') + + self.cur.execute( + 'CREATE TABLE settings_new ' + '(name, proj_id INT, link_name, upstream)') + self.cur.execute( + 'INSERT INTO settings_new SELECT name, proj_id, link_name, NULL ' + 'FROM settings') + self.cur.execute('DROP TABLE settings') + self.cur.execute('ALTER TABLE settings_new RENAME TO settings') + default_ups = self.upstream_get_default() + if default_ups: + self.cur.execute( + 'UPDATE settings SET upstream = ?', (default_ups,)) + + self.cur.execute('ALTER TABLE upstream ADD COLUMN patchwork_url') + self.cur.execute('ALTER TABLE upstream ADD COLUMN identity') + self.cur.execute('ALTER TABLE upstream ADD COLUMN series_to') + self.cur.execute( + 'ALTER TABLE upstream ADD COLUMN no_maintainers BIT') + self.cur.execute('ALTER TABLE upstream ADD COLUMN no_tags BIT') + self.cur.execute('ALTER TABLE ser_ver ADD COLUMN desc') + def migrate_to(self, dest_version): """Migrate the database to the selected version @@ -182,6 +216,8 @@ class Database: # pylint:disable=R0904 self._migrate_to_v3() elif version == 4: self._migrate_to_v4() + elif version == 5: + self._migrate_to_v5() # Save the new version if we have a schema_version table if version > 1: diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py index 3a9411033a6..5719d9b6ddc 100644 --- a/tools/patman/test_cseries.py +++ b/tools/patman/test_cseries.py @@ -3316,7 +3316,7 @@ Date: .* self.assertEqual(f'Update database to v{version}', out.getvalue().strip()) self.assertEqual(version, db.get_schema_version()) - self.assertEqual(4, database.LATEST) + self.assertEqual(5, database.LATEST) def test_migrate_future_version(self): """Test that a database newer than patman is rejected"""