From patchwork Wed May 4 19:24:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Woodard X-Patchwork-Id: 53475 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8CFD1385734B for ; Wed, 4 May 2022 19:25:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CFD1385734B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651692325; bh=reR0rHvM2sGvR5//9uWOwiqKqiwjcnvM+f0fb5FDg74=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:Cc:From; b=JyQXwURTvs2y5XJyJ7JCfTOQvH18EyRlj/lvh75Po+Vf02wnPpp3ZM5DgNVJAA4Ik 9rXXNSGrvYZOGnROI+wB1jNiahaM3UiEy39kYTCLPAdPIihUKk9/LwkAYhGK2BPiMK YrVtOHg21Z6PRP4Izg4dVYAv95ANb9Gce0uWNUtI= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E6B4F3858D1E for ; Wed, 4 May 2022 19:25:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6B4F3858D1E Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-604-TQZFUVKhPEep-FEWUyOxLQ-1; Wed, 04 May 2022 15:25:19 -0400 X-MC-Unique: TQZFUVKhPEep-FEWUyOxLQ-1 Received: by mail-pf1-f200.google.com with SMTP id b20-20020a62a114000000b0050a6280e374so716684pff.13 for ; Wed, 04 May 2022 12:25:19 -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=reR0rHvM2sGvR5//9uWOwiqKqiwjcnvM+f0fb5FDg74=; b=66JZsAshbr0++Zk+b2J1YMP7sWgA7TRHrq1Q0cmKS5raOw5cphOj5D+o1jjAkdccDy QxsctVmqV45JiCxdABbeTTnVn2ibM2Oe2sCw8irjVaS/pto50HwfPxlnhObGTqEf+GvI VFuh+3S5t3a79eDcKMKheGaKFvhyvrX9YHK06ScxwavXsoSdmWVcYCLheFU9TV0R+3aX k65cDVW5tOifyj0C24gnHEv8gXfq1NxgSQhaGwNGMnS59+dTLN0D9vzXzIfCqC1b6zyH Ysqq3epnaOqZtaSb8QcbiBmArcVvqp4uBTpWX1sCk3RmrXLsjHVFJwNb9OgMDoUhMWq7 WohQ== X-Gm-Message-State: AOAM533CidWS13+fBIF3j87U3CASyHCe9Zev2jl8ZDcSw2onQUnTDu0w 9pCVGQg3qrUrgaWseIUdAi714ppNHkXgz7orbrsWWGsmR2/Nzky8Mq2/weqtFA0c4bRP8yrQ0j3 zZnZplR4E/f5bHCtxSIxWqlG+cF1pL+i7+bneAUlYkXWq8ipbEpDsafZcKWrraMmevLW1YH4= X-Received: by 2002:a17:902:d2d1:b0:15e:9b06:28b3 with SMTP id n17-20020a170902d2d100b0015e9b0628b3mr19010816plc.148.1651692318214; Wed, 04 May 2022 12:25:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXtkxdZbsvstjc1dW8ujpu1+bkDGIGTK4FIsUtkPWVOeW89cWQ9RkqHfTikx4czZsNFaRCBQ== X-Received: by 2002:a17:902:d2d1:b0:15e:9b06:28b3 with SMTP id n17-20020a170902d2d100b0015e9b0628b3mr19010776plc.148.1651692317693; Wed, 04 May 2022 12:25:17 -0700 (PDT) Received: from alien.localdomain ([47.208.199.57]) by smtp.gmail.com with ESMTPSA id h3-20020a17090a2ec300b001cd4989ff50sm3655617pjs.23.2022.05.04.12.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 12:25:17 -0700 (PDT) To: libabigail@sourceware.org Subject: [PATCH] Add Logic to detect file type by extension Date: Wed, 4 May 2022 12:24:49 -0700 Message-Id: <20220504192448.1790563-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 X-Spam-Status: No, score=-12.0 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-Patchwork-Original-From: Ben Woodard via Libabigail From: Ben Woodard Reply-To: Ben Woodard Cc: vsoch Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" From: vsoch 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..48a89e03 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'): + mimtype = 'application/x-rpm' logger.debug('is_rpm_file(\'%s\'): isfile=%s, mimetype=\'%s\', isrpm=%s', filename, isfile, mimetype, isrpm) return isrpm