Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
apk-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hassan Albahri
apk-tools
Commits
f69f047f
Commit
f69f047f
authored
11 years ago
by
Natanael Copa
Browse files
Options
Downloads
Patches
Plain Diff
search: implement --has-origin
This option lets us search for all package with given origin.
parent
0a4ff4f5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/search.c
+15
-1
15 additions, 1 deletion
src/search.c
with
15 additions
and
1 deletion
src/search.c
+
15
−
1
View file @
f69f047f
...
...
@@ -23,6 +23,7 @@ struct search_ctx {
int
show_all
:
1
;
int
search_exact
:
1
;
int
search_description
:
1
;
int
search_origin
:
1
;
unsigned
int
matches
;
struct
apk_string_array
*
filter
;
...
...
@@ -88,6 +89,11 @@ static int search_parse(void *ctx, struct apk_db_options *dbopts,
case
'r'
:
ictx
->
print_result
=
print_rdepends
;
break
;
case
0x10000
:
ictx
->
search_origin
=
1
;
ictx
->
search_exact
=
1
;
ictx
->
show_all
=
1
;
break
;
default:
return
-
1
;
}
...
...
@@ -106,6 +112,13 @@ static void print_result_pkg(struct search_ctx *ctx, struct apk_package *pkg)
}
return
;
}
if
(
ctx
->
search_origin
)
{
foreach_array_item
(
pmatch
,
ctx
->
filter
)
{
if
(
pkg
->
origin
!=
NULL
&&
strcmp
(
*
pmatch
,
apk_blob_cstr
(
*
pkg
->
origin
))
==
0
)
goto
match
;
}
return
;
}
match:
ctx
->
print_result
(
ctx
,
pkg
);
}
...
...
@@ -148,7 +161,7 @@ static int search_main(void *pctx, struct apk_database *db, struct apk_string_ar
if
(
ctx
->
print_result
==
NULL
)
ctx
->
print_result
=
ctx
->
print_package
;
if
(
ctx
->
search_description
)
if
(
ctx
->
search_description
||
ctx
->
search_origin
)
return
apk_hash_foreach
(
&
db
->
available
.
packages
,
print_pkg
,
ctx
);
if
(
!
ctx
->
search_exact
)
{
...
...
@@ -171,6 +184,7 @@ static struct apk_option search_options[] = {
{
'e'
,
NULL
,
"Synonym for -x (deprecated)"
},
{
'o'
,
"origin"
,
"Print origin package name instead of the subpackage"
},
{
'r'
,
"rdepends"
,
"Print reverse dependencies of package"
},
{
0x10000
,
"has-origin"
,
"List packages that have the given origin"
},
};
static
struct
apk_applet
apk_search
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment