Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop --pkgid and --hdrid query source cli-switches #3335

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions docs/man/rpm.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ select-options

\[*PACKAGE\_NAME*\] \[**-a,\--all \[***SELECTOR*\]\] \[**-f,\--file
***FILE*\] \[**\--path ***PATH*\] \[**-g,\--group ***GROUP*\] \[**-p,\--package
***PACKAGE\_FILE*\] \[**\--hdrid ***SHA1*\] \[**\--pkgid ***MD5*\]
***PACKAGE\_FILE*\]
\[**\--tid ***TID*\] \[**\--querybynumber ***HDRNUM*\]
\[**\--triggeredby ***PACKAGE\_NAME*\] \[**\--whatprovides
***CAPABILITY*\] \[**\--whatrequires ***CAPABILITY*\]
Expand Down Expand Up @@ -638,11 +638,6 @@ name starts with \"b\".

: Query packages with the group of *GROUP*.

**\--hdrid ***SHA1*

: Query package that contains a given header identifier, i.e. the
*SHA1* digest of the immutable header region.

**-p, \--package ***PACKAGE\_FILE*

: Query an (uninstalled) package *PACKAGE\_FILE*. The *PACKAGE\_FILE*
Expand All @@ -664,11 +659,6 @@ name starts with \"b\".
Multiple packages may own a *PATH*, but the file is only owned by the
package installed last.

**\--pkgid ***MD5*

: Query package that contains a given package identifier, i.e. the
*MD5* digest of the combined header and payload contents.

**\--querybynumber ***HDRNUM*

: Query the *HDRNUM*th database entry directly; this is useful only
Expand Down
2 changes: 0 additions & 2 deletions include/rpm/rpmcli.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ enum rpmQVSources_e {
RPMQV_DBOFFSET, /*!< ... from database header instance. */
RPMQV_SPECRPMS, /*!< ... from spec file binaries (query only). */
RPMQV_SPECFILE = RPMQV_SPECRPMS, /*!< ... backwards compatibility */
RPMQV_PKGID, /*!< ... from package id (header+payload MD5). */
RPMQV_HDRID, /*!< ... from header id (immutable header SHA1). */
RPMQV_TID, /*!< ... from install transaction id (time stamp). */
RPMQV_SPECSRPM, /*!< ... from spec file source (query only). */
RPMQV_WHATRECOMMENDS, /*!< ... from recommends db search. */
Expand Down
4 changes: 2 additions & 2 deletions include/rpm/rpmtag.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ typedef enum rpmDbiTag_e {
RPMDBI_TRIGGERNAME = RPMTAG_TRIGGERNAME,
RPMDBI_DIRNAMES = RPMTAG_DIRNAMES,
RPMDBI_INSTALLTID = RPMTAG_INSTALLTID,
RPMDBI_SIGMD5 = RPMTAG_SIGMD5,
RPMDBI_SHA1HEADER = RPMTAG_SHA1HEADER,
RPMDBI_SIGMD5 = RPMTAG_SIGMD5, /* OBSOLETE */
RPMDBI_SHA1HEADER = RPMTAG_SHA1HEADER, /* OBSOLETE */
RPMDBI_INSTFILENAMES = RPMTAG_INSTFILENAMES,
RPMDBI_FILETRIGGERNAME = RPMTAG_FILETRIGGERNAME,
RPMDBI_TRANSFILETRIGGERNAME = RPMTAG_TRANSFILETRIGGERNAME,
Expand Down
9 changes: 0 additions & 9 deletions lib/poptQV.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ struct rpmQVKArguments_s rpmQVKArgs;
#define POPT_QUERYBYNUMBER -1003
#define POPT_TRIGGEREDBY -1004
#define POPT_DUMP -1005
#define POPT_QUERYBYPKGID -1007
#define POPT_QUERYBYHDRID -1008
#define POPT_QUERYBYTID -1010
#define POPT_WHATRECOMMENDS -1011
#define POPT_WHATSUGGESTS -1012
Expand Down Expand Up @@ -62,8 +60,6 @@ static void rpmQVSourceArgCallback( poptContext con,
case POPT_WHATENHANCES: qva->qva_source |= RPMQV_WHATENHANCES; break;
case POPT_TRIGGEREDBY: qva->qva_source |= RPMQV_TRIGGEREDBY; break;
case POPT_QUERYBYPATH: qva->qva_source |= RPMQV_PATH_ALL; break;
case POPT_QUERYBYPKGID: qva->qva_source |= RPMQV_PKGID; break;
case POPT_QUERYBYHDRID: qva->qva_source |= RPMQV_HDRID; break;
case POPT_QUERYBYTID: qva->qva_source |= RPMQV_TID; break;
case POPT_QUERYBYNUMBER: qva->qva_source |= RPMQV_DBOFFSET; break;
}
Expand Down Expand Up @@ -92,11 +88,6 @@ struct poptOption rpmQVSourcePoptTable[] = {
{ "package", 'p', 0, 0, 'p',
N_("query/verify a package file"), NULL },

{ "pkgid", '\0', 0, 0, POPT_QUERYBYPKGID,
N_("query/verify package(s) with package identifier"), "MD5" },
{ "hdrid", '\0', 0, 0, POPT_QUERYBYHDRID,
N_("query/verify package(s) with header identifier"), "SHA1" },

{ "query", 'q', 0, NULL, 'q',
N_("rpm query mode"), NULL },
{ "querybynumber", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_QUERYBYNUMBER,
Expand Down
38 changes: 0 additions & 38 deletions lib/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ static rpmdbMatchIterator matchesIterator(rpmts ts, rpmDbiTag dbi,
static rpmdbMatchIterator initQueryIterator(QVA_t qva, rpmts ts, const char * arg)
{
const char * s;
int i;
rpmdbMatchIterator mi = NULL;

if (qva->qva_showPackage == NULL)
Expand All @@ -331,43 +330,6 @@ static rpmdbMatchIterator initQueryIterator(QVA_t qva, rpmts ts, const char * ar
}
break;

case RPMQV_PKGID:
{ unsigned char MD5[16];
unsigned char * t;

for (i = 0, s = arg; *s && isxdigit(*s); s++, i++)
{};
if (i != 32) {
rpmlog(RPMLOG_ERR, _("malformed %s: %s\n"), "pkgid", arg);
goto exit;
}

MD5[0] = '\0';
for (i = 0, t = MD5, s = arg; i < 16; i++, t++, s += 2)
*t = (rnibble(s[0]) << 4) | rnibble(s[1]);

mi = rpmtsInitIterator(ts, RPMDBI_SIGMD5, MD5, sizeof(MD5));
if (mi == NULL) {
rpmlog(RPMLOG_NOTICE, _("no package matches %s: %s\n"),
"pkgid", arg);
}
} break;

case RPMQV_HDRID:
for (i = 0, s = arg; *s && isxdigit(*s); s++, i++)
{};
if (i != 40) {
rpmlog(RPMLOG_ERR, _("malformed %s: %s\n"), "hdrid", arg);
goto exit;
}

mi = rpmtsInitIterator(ts, RPMDBI_SHA1HEADER, arg, 0);
if (mi == NULL) {
rpmlog(RPMLOG_NOTICE, _("no package matches %s: %s\n"),
"hdrid", arg);
}
break;

case RPMQV_TID:
{ char * end = NULL;
rpm_tid_t iid = strtoul(arg, &end, 0);
Expand Down
Loading