From patchwork Mon Nov 30 11:45:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guy Morand X-Patchwork-Id: 1408168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::23f; helo=mail-oi1-x23f.google.com; envelope-from=swupdate+bncbc5yhxvzyypbbwnwsp7akgqeyo6xbny@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=scewo.ch Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=KwsgLjnI; dkim=pass (2048-bit key; unprotected) header.d=scewo-ch.20150623.gappssmtp.com header.i=@scewo-ch.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=UKnSoSAN; dkim-atps=neutral Received: from mail-oi1-x23f.google.com (mail-oi1-x23f.google.com [IPv6:2607:f8b0:4864:20::23f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cl3MK6wCzz9sTv for ; Mon, 30 Nov 2020 22:45:32 +1100 (AEDT) Received: by mail-oi1-x23f.google.com with SMTP id i70sf6437792oib.12 for ; Mon, 30 Nov 2020 03:45:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:subject:mime-version :x-original-sender:precedence:mailing-list:list-id:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=zd+qDoocscy6CvmbOgNl+I29Xpktq8E69N2Q8Fp9vCo=; b=KwsgLjnIKhsU2XioWHWwhVTNUuzrCSYc2+CwH4clLGarADMB1p+Mq170V4tYJYR64z oxFrHye4b1jabWaby0oaSbqWPWMK5ITJa1+zHdHQtXHKC3A27tvOqXW1nL+59IvwBqEe SH/0vULX20wE+0cjTr0iOHPjnQzanBoJRZ9KVij5pTosswhLiF7pJZHzVzTDxPcgD5oT Wi0OZbdPByOdnyJm7gdHB72R00YcyDENcuhcLWyIVCCuEA3EM7ao6JTC/gHC/xjJJeZr JZpboP/yAavJ/K/TixduORRHPbAoJFcxtD5C8FhdBgBcRLfPRzXAiNwMM5pH5goGdPe1 FJuA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scewo-ch.20150623.gappssmtp.com; s=20150623; h=date:from:to:message-id:subject:mime-version:x-original-sender :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=zd+qDoocscy6CvmbOgNl+I29Xpktq8E69N2Q8Fp9vCo=; b=UKnSoSANOh49m9KxZFaeJAVZD7Q67SAUGJFJWuEmNYmvzsl+MgqvpTtSFG6tJIt6fl cIg8sWELpl8GRdn5gm2WPFW6LGYMtuIHSrRuZf6JedfV/UOJ6dZ2J88fiDAzG6b3JSB+ bOpvTQ/kyvmVfQzE6RrUUDUwNzo0vF49vYsD4q0kWees5CRaNDzp2PcQNfm5sfF5y1i2 NqCZ+pZnOxMODRhoB8lxFpvzDsy7lH9CemGBqE8UXsZcuhu1fl0VXxrGpxv2gP2POFrg xsZYQCZ7squTiSahZGzGev+f8rG+FsLcdmugrirucr1RY7ymD5WJVA7RtiWDJJ9p9Ylw wzcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:subject :mime-version:x-original-sender:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=zd+qDoocscy6CvmbOgNl+I29Xpktq8E69N2Q8Fp9vCo=; b=XZjnw7ewslhDYwfHLXN31uFqls9SFhL6VSfvkxJF2xe8eL8BRY+fIZpQlsApEbwwHn ThdgAb6LKEEb9WcXvZVCYC299rsRZWRfEysamW/F0maKLOqwxF9fgnLwmDhcvoZgPcG0 ucQVdQA4tRg8QMAiGyV+PzaAJXMufKYVke2mxtaeMrmmvaaaPTLiw1kPtPUdJahsGcp8 ic1QAnfQRUpSB5lgkmfH6O+t582O7pQ+90QHzJe3KZpa1mdNU1qU0nnSFgKvID7V/uJG 6fTBnGRTH6QpvXEvZxc34ly8x96jGArRUNnNCxuTMPqVFsAIIhcfaFCYmIa8GIzLvk7o 0a/w== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM531DJDPQp1o49EZISbG3Lbal9o9e9Qxml/j7Mu4IvdVnY6SyfRpz notmVkUz2b0iVX1zhMTyTWw= X-Google-Smtp-Source: ABdhPJzTn+QYThXegK/S2XRwIvHa2vCDiGoBMltQXwAw4xFD9vGCWAzSISDGDRByk8qVd+Lmcqywjw== X-Received: by 2002:a9d:1908:: with SMTP id j8mr15436115ota.69.1606736729878; Mon, 30 Nov 2020 03:45:29 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a9d:7756:: with SMTP id t22ls2869538otl.8.gmail; Mon, 30 Nov 2020 03:45:29 -0800 (PST) X-Received: by 2002:a05:6830:158e:: with SMTP id i14mr15849949otr.123.1606736728877; Mon, 30 Nov 2020 03:45:28 -0800 (PST) Date: Mon, 30 Nov 2020 03:45:28 -0800 (PST) From: Guy Morand To: swupdate Message-Id: Subject: [swupdate] Broken update image generation on gatesgarth MIME-Version: 1.0 X-Original-Sender: g.morand@scewo.ch Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Hallo swupdate developers! Since Friday, I cannot generate an update image with yocto on gatesgarth branch: File: 'exec_python_func() autogenerated', lineno: 2, function: 0001: *** 0002:do_swuimage(d) 0003: File: 'meta-swupdate/classes/swupdate.bbclass', lineno: 104, function: do_swuimage 0100: local = fetch.localpath(url) 0101: filename = os.path.basename(local) 0102: if (filename != 'sw-description') and (os.path.isfile(local)): 0103: encrypted = (d.getVarFlag("SWUPDATE_IMAGES_ENCRYPTED", filename, True) or "") *** 0104: key,iv,salt = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True)) 0105: dst = os.path.join(s, "%s" % filename ) 0106: if encrypted == '1': 0107: bb.note("Encryption requested for %s" %(filename)) 0108: swupdate_encrypt_file(local, dst, key, iv, salt) File: 'meta-swupdate/classes/swupdate-common.bbclass', lineno: 23, function: swupdate_extract_keys 0019: return m.hexdigest() 0020: 0021:def swupdate_extract_keys(keyfile): 0022: try: *** 0023: keys = open(keyfile) 0024: except IOError: 0025: bb.fatal("Failed to open file with keys %s" % (keyfile)) 0026: lines = keys.read() 0027: keys.close() Exception: TypeError: expected str, bytes or os.PathLike object, not NoneType I could fix it with the following patch: swupdate_encrypt_file(local, dst, key, iv, salt) else: shutil.copyfile(local, dst) @@ -148,7 +148,7 @@ python do_swuimage () { if not image_found: bb.fatal("swupdate cannot find image file: %s" % os.path.join(deploydir, imagebase + fstype)) else: # Allow also complete entries like "image.ext4.gz" in SWUPDATE_IMAGES - if not add_image_to_swu(deploydir, image, s): + if not add_image_to_swu(deploydir, image, s, encrypted): bb.fatal("swupdate cannot find %s image file" % image) prepare_sw_description(d, s, list_for_cpio) Not sure if I'm doing wrong and if this patch would make sense. Any advice or should I prepare an pull request? Best regards, Guy diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index b94955c..9a58436 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -101,10 +101,10 @@ python do_swuimage () { filename = os.path.basename(local) if (filename != 'sw-description') and (os.path.isfile(local)): encrypted = (d.getVarFlag("SWUPDATE_IMAGES_ENCRYPTED", filename, True) or "") - key,iv,salt = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True)) dst = os.path.join(s, "%s" % filename ) if encrypted == '1': bb.note("Encryption requested for %s" %(filename)) + key,iv,salt = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True))