From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1012286-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E532E1382C5 for <garchives@archives.gentoo.org>; Sun, 25 Mar 2018 14:00:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9FA6E0874; Sun, 25 Mar 2018 14:00:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B3501E0874 for <gentoo-commits@lists.gentoo.org>; Sun, 25 Mar 2018 14:00:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 66257335C51 for <gentoo-commits@lists.gentoo.org>; Sun, 25 Mar 2018 14:00:22 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E751925B for <gentoo-commits@lists.gentoo.org>; Sun, 25 Mar 2018 14:00:20 +0000 (UTC) From: "Fabian Groffen" <grobian@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" <grobian@gentoo.org> Message-ID: <1521984512.c9b624a2a93d75654269e9ad39a8c09450cd2fb1.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/atom_explode.c X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: c9b624a2a93d75654269e9ad39a8c09450cd2fb1 X-VCS-Branch: master Date: Sun, 25 Mar 2018 14:00:20 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e9652e2c-05e3-4954-854a-d95719af4151 X-Archives-Hash: f27d30be69c8a0626ef2f6313f08b1ec commit: c9b624a2a93d75654269e9ad39a8c09450cd2fb1 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Sun Mar 25 13:28:32 2018 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Sun Mar 25 13:28:32 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c9b624a2 atom_explode: support inversed ranges, e.g. !>P-x.y For bug #608960 we need to be able to handle odd atoms like !<logrotate-2.3.0 (as used by sys-apps/portage). This adds support for this construct. libq/atom_explode.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/libq/atom_explode.c b/libq/atom_explode.c index 057bfa1..d5d0840 100644 --- a/libq/atom_explode.c +++ b/libq/atom_explode.c @@ -118,11 +118,31 @@ atom_explode(const char *atom) break; case '!': ++atom; - if (atom[0] == '!') { + switch (atom[0]) { + case '!': ++atom; ret->pfx_op = ATOM_OP_BLOCK_HARD; - } else + break; + case '>': + ++atom; + if (atom[0] == '=') { + ++atom; + ret->pfx_op = ATOM_OP_OLDER; + } else + ret->pfx_op = ATOM_OP_OLDER_EQUAL; + break; + case '<': + ++atom; + if (atom[0] == '=') { + ++atom; + ret->pfx_op = ATOM_OP_NEWER_EQUAL; + } else + ret->pfx_op = ATOM_OP_NEWER; + break; + default: ret->pfx_op = ATOM_OP_BLOCK; + break; + } break; } strcpy(ret->CATEGORY, atom);