From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 199E23858D1E for ; Wed, 4 May 2022 19:52:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 199E23858D1E Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-527-WMY_WCd_PjWRIw3EJQkYpw-1; Wed, 04 May 2022 15:52:18 -0400 X-MC-Unique: WMY_WCd_PjWRIw3EJQkYpw-1 Received: by mail-pl1-f198.google.com with SMTP id v8-20020a170902b7c800b0015e927ee201so1183684plz.12 for ; Wed, 04 May 2022 12:52:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LZCh5i4k7+QklpLCEPG9h562j9S8s1mbLlWSSudoGic=; b=1p3ITxCdtmdl5N0sidR7tFiASYYSXdzm8jmQ+bU3liClZEu+Eo2bVllV7CSBIP8jkd NQp5PTFOHGMuimiLbXd54n2pU9k+9liyyIhL0qulHy24LslvIk+jYwDIOZRRhgj/uLy3 f3Lk2Rsswt94lAaXn0Opc/eEKhZU8bzgv2fnMAre9aDnTZ5XKZA2z9M0fGhS5gVhxMs9 M9JEXe59RDbKL0v+WIMlxLaNg2L+FntzcN5utlAlj9OHRKNCLxoWMmg1jJipOrZUmB52 QxKSwFZsbB/+OXeppCInfuTnZr+7zjybivuIdwVIAf+t8D2J4KTKrTdDUkhX3V2Vkx6a dsSg== X-Gm-Message-State: AOAM532g4YFSyvKsn/GOw8jxI1oINO99NcnPqhzbiKfr2inw6222/eJ2 xgz4YITVCtqmEqcznwEVwA8nNdyS9bUG4FUNkoPFwl233kUYKce70rSuXxgtuJz/GyxtencBocW mwO7vnzhzingWDg9bhav7d3ZsDMvRc95xLwexvJvnCGRYVV0RRSYqW+wXf16eFmoOfEOn3Y4= X-Received: by 2002:a17:90b:3843:b0:1dc:3da2:7fd8 with SMTP id nl3-20020a17090b384300b001dc3da27fd8mr1294326pjb.219.1651693937483; Wed, 04 May 2022 12:52:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7edF7N7SF+xsiaaePrmj/2Qlni7En3YYBg+mzb3gMNltFmWgcSw4FAxCM7GawrSclgZ2S8Q== X-Received: by 2002:a17:90b:3843:b0:1dc:3da2:7fd8 with SMTP id nl3-20020a17090b384300b001dc3da27fd8mr1294280pjb.219.1651693937002; Wed, 04 May 2022 12:52:17 -0700 (PDT) Received: from alien.localdomain ([47.208.199.57]) by smtp.gmail.com with ESMTPSA id z11-20020a170902d54b00b0015e8d4eb259sm8716015plf.163.2022.05.04.12.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 12:52:16 -0700 (PDT) From: Ben Woodard To: libabigail@sourceware.org Cc: vsoch , Ben Woodard Subject: [PATCH] V2 Add Logic to detect file type by extension Date: Wed, 4 May 2022 12:51:38 -0700 Message-Id: <20220504195137.1790994-1-woodard@redhat.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2022 19:52:21 -0000 From: vsoch Changes since V1 Merge in the correct version of the patch not an early diagnostic one. Fedabipkgdiff uses mimetypes to detect what file type it is looking at. In some minimal versions of the OS, in particular container images, the package that includes all the mimetypes may not be installed. This allows fedabipkgdiff to fall back to using the extension. * tools/fedabipkgdiff - add logic to detect file type by extension Signed-off-by: vsoch Reviewed-by: Ben Woodard --- tools/fedabipkgdiff | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff index dc80a6ef..c05bd8b1 100755 --- a/tools/fedabipkgdiff +++ b/tools/fedabipkgdiff @@ -213,6 +213,10 @@ def is_rpm_file(filename): mimetype = mimetypes.guess_type(filename)[0] if isfile else None isrpm = (mimetype == 'application/x-redhat-package-manager' or mimetype == 'application/x-rpm') + + # Most systems won't have rpm defined as a mimetype + if not mimetype and filename.endswith('.rpm'): + isrpm = True logger.debug('is_rpm_file(\'%s\'): isfile=%s, mimetype=\'%s\', isrpm=%s', filename, isfile, mimetype, isrpm) return isrpm -- 2.35.1