From patchwork Mon Sep 2 10:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Ferreira X-Patchwork-Id: 48567 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F959CD342C for ; Mon, 2 Sep 2024 10:23:18 +0000 (UTC) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (EUR02-DB5-obe.outbound.protection.outlook.com [40.107.249.49]) by mx.groups.io with SMTP id smtpd.web11.35585.1725272591078618791 for ; Mon, 02 Sep 2024 03:23:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@criticaltechworks.com header.s=selector1 header.b=AMwW5Kf9; spf=pass (domain: criticaltechworks.com, ip: 40.107.249.49, mailfrom: pedro.silva.ferreira@criticaltechworks.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qQdRn+1HjC033mpMm/zoeyaz8pAyyFQIevu8gbM2zs7OTj0fIQsR20y8EP+4wOdjfRukgCSX32bLW+HeixmsTkKIbTXz4KqnpklvEKXRxsP1QN4brdQEN8PorrsMMoVIzrzkbXtV3y4P2FNun8uzJZ1R9Gq75uSP073F227iDqMRt96pA7TxGT4hkM/ap5lINfzJxA+tVCUEYZLxAOLt/L/BjKRRm9HnnHxJ9rQ+Uhvd6GNTNAcxi1VwQkLYF94m3dypJcuxevejMWWK0jWjU4oQWD5lqopH+1ofRNmCeE2iUTGYDyg995SzhGI90pQJIpTMINOc+H9BM4DT58pTiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2Frgdx81Hi2PIMQcBxCXpJETDucKCTu6qFB9haTRnO0=; b=rtipRPQ9eGKlczFt+PlHmlqmOs3OffsTuA86oAjvy7m3Xv15Keq0zHDilEp2UMmroOQw+LCw3y4dADKOtCMwnua5fIj3JZiyCawLb5gnXyF1iXBlM3kpis7S2r3tiJAZD2C/xXDyHZvPwLx1iyde3E7qKmEvze2Apq71gDHxUck8VIICZ+NDLvVuyTalpGSder/XD8dCM41qPK6Slit+ICbHPgxTdn0RnaTzNAPdR+dElyf3IyoYceucXU5I4ZmMCOaJ7sdnR0WfOqEyqn5E8plhv7IBH4TLE65I3pjVyCT5Vh43KmMFohRz92DRZ8heYPJtnR1UicdT+aPnbARlKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=criticaltechworks.com; dmarc=pass action=none header.from=criticaltechworks.com; dkim=pass header.d=criticaltechworks.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=criticaltechworks.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2Frgdx81Hi2PIMQcBxCXpJETDucKCTu6qFB9haTRnO0=; b=AMwW5Kf9OuLX5gmUYmsNnXWO10ZWXh0gMrMk3z8ep41SIQ8wAG1zG6i1xVNr8GA5VvR75mZVmekaEGyawGImi1v2nDXE6alXabnrXP322o+IyB/9HH6gPk4Yxv7v711T7EHMlFxu0Vl5w1jMBAWJ7h+lcz4x4KQrfmknQ3YCY/pGPzw9djwPm1Nt3+2+m10auiC+GqCgYo6fyEe0iG5MVGnUoSSMOkKm/8UEWpwXf+SJRmxHwsyM3sYq9OY20rjbw7gP0kWvmj/QTCsUEqt9WpEfi3gFbiAKP8GXRTMbNT/Al3Fa6E0aWK/GGzqyeAqxunm85fYurThFT7ZuSlSqrA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=criticaltechworks.com; Received: from AM8P193MB0900.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:1ed::9) by AM9P193MB1427.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:304::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Mon, 2 Sep 2024 10:23:08 +0000 Received: from AM8P193MB0900.EURP193.PROD.OUTLOOK.COM ([fe80::c359:f497:ed59:65a1]) by AM8P193MB0900.EURP193.PROD.OUTLOOK.COM ([fe80::c359:f497:ed59:65a1%4]) with mapi id 15.20.7918.024; Mon, 2 Sep 2024 10:23:08 +0000 From: Pedro Ferreira To: openembedded-core@lists.openembedded.org Cc: Pedro Ferreira , Pedro Ferreira , Richard Purdie Subject: [kirkstone][PATCH 2/4] buildhistory: Restoring files from preserve list Date: Mon, 2 Sep 2024 11:22:38 +0100 Message-Id: <20240902102240.3760442-2-pedro.silva.ferreira@criticaltechworks.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240902102240.3760442-1-pedro.silva.ferreira@criticaltechworks.com> References: <20240902102240.3760442-1-pedro.silva.ferreira@criticaltechworks.com> X-ClientProxiedBy: PAZP264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1ef::18) To AM8P193MB0900.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:1ed::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8P193MB0900:EE_|AM9P193MB1427:EE_ X-MS-Office365-Filtering-Correlation-Id: cbdea41c-a68b-497f-25c6-08dccb393d51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: BDqauGzTo1e/YBkB6gwNsfUkrHiKvK/3ls2xaaGULNZCy6obmQPi7oXCrhgG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UKSS46zEYeOz0PgX5tnffT3YI6FciUZsSPiFu/krMPc8WVwyzwB65ubgPHx3IXQ/DOn8vCzInW1SnRPZIFkiyz9F2mIterHNVEM1vujcpDqSUmgyV/NpPDjtjdpUrhdGsRJy1k/xagUiWghokXXhbU4SKvEgMaY3sCF/kweeEo7RWRA8++PUGnEvrXIXTj04sQ4bskIMNxWfX1umBMcCdwh0fcQD6EeBFLqQEpLQROqyixqwIsiv715iM8qTwSOwsWALzfVZNMMN4iD0JDsaAnjm3NQWJA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8P193MB0900.EURP193.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ehKmZFK3N1F9CLanQFnYxumNicBhWQtzwlade0MZ99QQTI2/soLXYHfli7DBW6k8w25IuEf9VdDFmPcX0Cp9+wT++VY8B5SORWZz/x69nO1X6fK+WWEViCxgfHGBcIJZ0Wrpo4ix0P72YhlcDeJjiRhD/pKS4oGGi05vxM7oQ82Ef4pyJl9Rw4tEF2SSLiMI5xSJh4lhfSklEJAx33w2BTOUjmBYwb16moiiE9wiFFtAQTXzg/HSG5cAhluZTXmaJl+tJS8qH4lann22JkPBFdFzFxSXEjphfEDwhH4Mg8M8oIhjSlAxO6Kl8jA4yvCXD3n0K5DSguObpPVDQ2RtHacc823mGLWJbxAeSWM6Hx0ka6+IzOujTr2nTfwN49HgdStnihr7NVDtcl5P+hzHQ2/analnk9bjbqnZ960WfnAezd7cZQbLwO8NzrBZ4g/Nig/8rgcQtJpwH+GTBt1YfwCyrx+rrfoWihdkZllEgKuJeenIECqCX9pNtN3vczINcZCEk/GrVmNeav6382mgJbc+yA2PoQnTyaHw30DfFaX66wCoOCfUPwaLgzy/lXulQU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ticaltechworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbdea41c-a68b-497f-25c6-08dccb393d51 X-MS-Exchange-CrossTenant-AuthSource: AM8P193MB0900.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2024 10:23:08.2949 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 61f30b8e-4f6b-44fe-9bc2-041e3a9f7346 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ckMe5Q8qaPQrHKo1O+D9fANmFP3LhbNWDKnnDXTj4zahU5Uym6OeE3PODlQdLGOIm/gl5OdvQsu7jDI4/nCxDEZPjtLokPyX0bnAA3dyXWg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P193MB1427 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 02 Sep 2024 10:23:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204075 This fix will ensure that, when we activate feature `BUILDHISTORY_RESET`, files marked to keep on feature `BUILDHISTORY_PRESERVE` will indeed exist is buildhistory final path since they are moved to buildhistory/old but not restored at any point. Signed-off-by: Pedro Ferreira Signed-off-by: Richard Purdie (cherry picked from commit 9f68a45aa238ae5fcdfaca71ba0e7015e9cb720e) --- meta/classes/buildhistory.bbclass | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.34.1 The information in this communication may contain confidential or legally privileged information. It is intended solely for the use of the individual or entity it addresses and others authorized to receive it. If you are not an intended recipient, you are hereby notified that any disclosure, copying, distribution or action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication by error, please notify us immediately by responding to this e-mail and then delete it from your system. Critical TechWorks is not liable for the proper and complete transmission of the information in this communication nor for any delay in its receipt This e-mail is environmentally friendly, just like Critical TechWorks, which lives in a paper-free atmosphere. Therefore, please consider the environment before printing it! diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index b35508db27..8adb44eba5 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -108,6 +108,7 @@ python buildhistory_emit_pkghistory() { import json import shlex import errno + import shutil pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE') @@ -221,6 +222,20 @@ python buildhistory_emit_pkghistory() { items.sort() return ' '.join(items) + def preservebuildhistoryfiles(pkg, preserve): + if os.path.exists(os.path.join(oldpkghistdir, pkg)): + listofobjs = os.listdir(os.path.join(oldpkghistdir, pkg)) + for obj in listofobjs: + if obj not in preserve: + continue + try: + bb.utils.mkdirhier(os.path.join(pkghistdir, pkg)) + shutil.copyfile(os.path.join(oldpkghistdir, pkg, obj), os.path.join(pkghistdir, pkg, obj)) + except IOError as e: + bb.note("Unable to copy file. %s" % e) + except EnvironmentError as e: + bb.note("Unable to copy file. %s" % e) + pn = d.getVar('PN') pe = d.getVar('PE') or "0" pv = d.getVar('PV') @@ -248,6 +263,14 @@ python buildhistory_emit_pkghistory() { if not os.path.exists(pkghistdir): bb.utils.mkdirhier(pkghistdir) else: + # We need to make sure that all files kept in + # buildhistory/old are restored successfully + # otherwise next block of code wont have files to + # check and purge + if d.getVar("BUILDHISTORY_RESET"): + for pkg in packagelist: + preservebuildhistoryfiles(pkg, preserve) + # Remove files for packages that no longer exist for item in os.listdir(pkghistdir): if item not in preserve: