From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7197029299818332160 X-Received: by 2002:a05:6871:b12:b0:163:210a:ae90 with SMTP id fq18-20020a0568710b1200b00163210aae90mr2027058oab.62.1675755479834; Mon, 06 Feb 2023 23:37:59 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6871:4004:b0:16a:1094:1691 with SMTP id kx4-20020a056871400400b0016a10941691ls4359518oab.9.-pod-prod-gmail; Mon, 06 Feb 2023 23:37:59 -0800 (PST) X-Google-Smtp-Source: AK7set/8MAD4iphCHP3BeqnTb0zQ6Lt80HR8x5IorIndeKT3BvTWzJY5hQJY3Rclet5DqxFCF+Jt X-Received: by 2002:a05:6870:9109:b0:16a:6dcd:9ff9 with SMTP id o9-20020a056870910900b0016a6dcd9ff9mr944428oae.34.1675755479216; Mon, 06 Feb 2023 23:37:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675755479; cv=none; d=google.com; s=arc-20160816; b=LWzJGI1nCACMboj829g2aNB2vg7JPFmL5Ns40YvYciXMByfPa6dtHe3bdbrGgDrt6T UcfrCjcDATjVXNcLe46rZcHXBGL+UKoK5tJ0FIcUTdS+NNRUBLitt4oG8nQ+1Dh5xYE7 Rj/Jj+Vivx9PNl3ctOb6my8A6AQYpLW9wjTGzwq3X2zquCjS02lzgFChFONZos5n2FhC sQM2a6JLvw2QI9zUihfJZzZBTY+bDEP/WJyfQ/OqB8VGNNyi9kd/41ERS6LuYoPVagyX jXerPNKx+lFFy0eJhfh+AqAnqPDM5JFvLP9i5kiKPSJXWbE+c2P7tDNPQLV6izQvZgp1 4s9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kuNGRvpIVluWucihiFgIJyfZsCBMJ69yDrq8DI0hS9Q=; b=ZG8rBJhomRU/Ab9itCyP7xsFRLe/DvWwJqMyyxK+OH7FsMxPnEOBCIPozVXKEObT1H U61cmySXJOTQ0iR2bx8neWsgUtcQuhNHdPJ0j3UJZgW2qmAjycffJdhygP+8D05PWNuD j3e+AEbQCrhLVKDjiT4jTqQT++YkNQNWyE4LpTrc8LIlgEa/NgvNZTz2cljU5Q1ENJxw 6OC8gHDTwTZll2I/qaeT2sObYbqTeTSp7G2avtIHhQNZ+Lom0yvD3eoaNh48zL3sH0Xi 5/6xOpH+i6vyuKGZJcAhOGtwXXrbfqeLWQVzDBuUl3R9bGBGs3gAOUollNYhPbXz+p+7 ulmA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T7oHUdQM; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::729 as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com. [2607:f8b0:4864:20::729]) by gmr-mx.google.com with ESMTPS id e6-20020a056870450600b0016a0995ce14si1068614oao.1.2023.02.06.23.37.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 23:37:59 -0800 (PST) Received-SPF: pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::729 as permitted sender) client-ip=2607:f8b0:4864:20::729; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T7oHUdQM; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::729 as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: by mail-qk1-x729.google.com with SMTP id bl15so6318054qkb.4 for ; Mon, 06 Feb 2023 23:37:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kuNGRvpIVluWucihiFgIJyfZsCBMJ69yDrq8DI0hS9Q=; b=T7oHUdQMlnpCsYkJA43dVXWK1oTVPwTcEdk/GeBPSGknLpMrVSE0iv6Po8meT3HJ5N idkU2d18FYWedAj9G6afFM0mkU5mh5kjx4lA2bcYGJwoj6p0sJXuORQ8H0sFw3ivz5Qx gSTdH1ULqFg3C9siskHCUQl2424LrPNr6vw2G5fT47oC7295zgx+qTERmzgyCcItNnpq yr54H1/41JB289xGMFRshd0SHdw/84iowqFHHTg+1XzetksXigmCaWC3T6Nq8NfSga9G gbkJ/jz0Zfx9jCv1E/ecuHCNngiCPo+4Po3L/87UdzOZfdox2xuiqh2n3RSR7k9n5WOm s59w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kuNGRvpIVluWucihiFgIJyfZsCBMJ69yDrq8DI0hS9Q=; b=SICk4fAZGpL2t5JBxIctrcabW9KLNNRTGDZypbRrCyoFd8UOePidwyLvLaT2WG+Hr/ EvbWaGiinU1xYig3Sa5H5dwTwOTlSPWjuVMPyYnrh6bgMfYdkOfNhN1GR0hScVlFEYff MU2/xvXWls67yFDVVOcZ4mQ1Dlk/yLMyFadnNOLNrU9Iyydvg4vqIWjYkQnDsHwKPEwd qmA5rBUEWAQXtBltysavFEzt5ZsV537uEvpDcuv3VdpDtzvaONi9SsOG0YJkQnlIVMK8 MfGzySYa1YkuhzBoAYOHxSmi61jO+nESDP7dPxaa+6UuvGrGyHdYUbfmAZaA6xGdeWEr tlGw== X-Gm-Message-State: AO0yUKWlndtk7BemvOqSlP2ory0RtDtfA8ohNtWJRrjxr+E94noHhCWM 4w2uiGQ724ozcUfhtQDY/2jI17jmjflmzxm0SNaLMzDPhA== X-Received: by 2002:a37:aa57:0:b0:719:1ae9:71a2 with SMTP id t84-20020a37aa57000000b007191ae971a2mr98110qke.293.1675755478599; Mon, 06 Feb 2023 23:37:58 -0800 (PST) MIME-Version: 1.0 References: <20230206130919.327653-1-roberto.foglietta@linuxteam.org> <6850064.9J7NaK4W3v@home> In-Reply-To: <6850064.9J7NaK4W3v@home> From: "Roberto A. Foglietta" Date: Tue, 7 Feb 2023 08:37:21 +0100 Message-ID: Subject: Re: [PATCH] deb-dl-dir class rework to use faster ln -P or fallback to cp To: Uladzimir Bely Cc: isar-users@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-TUID: XwJcWhF+RnjQ On Tue, 7 Feb 2023 at 07:32, Uladzimir Bely wrote: > > In the email from =D0=BF=D0=BE=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD= =D0=B8=D0=BA, 6 =D1=84=D0=B5=D0=B2=D1=80=D0=B0=D0=BB=D1=8F 2023 =D0=B3. 16:= 09:19 +03 user > roberto.foglietta@linuxteam.org wrote: > > From: "Roberto A. Foglietta" > > > > deb-dl-dir, feature: faster when using ln -P otherwise fallback to cp > > > > The original class functions deb_dl_dir_import/export were using cp to > > copy debian package to the target rootfs but this approach is quite slo= w > > while using hard link does not work if the destination and source dirs > > are not lying on the same filesystem. Thus, ln -P should fallback to cp > > when it does not work (which is different from complaining on stderr). > > > > Moreover, these two functions have been reworked to reach a straight > > forward and more compact form. In particular, export function was using > > bashism to do some kind of comparison which after all is useless > > because copying back without overwriting just fulfills that part. > > > > Signed-off-by: Roberto A. Foglietta > > --- > > meta/classes/deb-dl-dir.bbclass | 41 ++++++++++++++++++--------------- > > 1 file changed, 23 insertions(+), 18 deletions(-) > > > > diff --git a/meta/classes/deb-dl-dir.bbclass > > b/meta/classes/deb-dl-dir.bbclass index 3b1517dc..22de7bf6 100644 > > --- a/meta/classes/deb-dl-dir.bbclass > > +++ b/meta/classes/deb-dl-dir.bbclass > > @@ -78,39 +78,44 @@ debsrc_download() { > > > > deb_dl_dir_import() { > > export pc=3D"${DEBDIR}/${2}" > > - export rootfs=3D"${1}" > > - sudo mkdir -p "${rootfs}"/var/cache/apt/archives/ > > + export sc=3D"${1}/var/cache/apt/archives/" > > + sudo mkdir -p "${sc}" > > [ ! -d "${pc}" ] && return 0 > > + export tf=3D$(ls -1 "${pc}"/*.deb | head -n1) > > + [ ! -e "${tf}" ] && return 0 > > flock -s "${pc}".lock -c ' > > set -e > > printenv | grep -q BB_VERBOSE_LOGS && set -x > > > > - sudo find "${pc}" -type f -iname "*\.deb" -exec \ > > - cp -n --no-preserve=3Downer -t > > "${rootfs}"/var/cache/apt/archives/ {} + + sudo ln -Pf -t "${sc}= " > > "${tf}" 2>/dev/null ||: > > I'm not sure that assumption "if one hardlink failed, other also will fai= l" > (and vice versa) would always be true. Yes, it is true. If further failures happen it is not because of the destination/source nature. Instead of the opposite, the return code does not always lead to a failure in a way we suppose. Best regards, R-