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
Model registry
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
Adélie Linux
apk-tools
Commits
78b70cd6
Commit
78b70cd6
authored
2 years ago
by
Timo Teräs
Browse files
Options
Downloads
Patches
Plain Diff
fetch: implement --built-after
ref #10873
parent
8feb2cae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/apk-fetch.8.scd
+4
-0
4 additions, 0 deletions
doc/apk-fetch.8.scd
src/app_fetch.c
+23
-0
23 additions, 0 deletions
src/app_fetch.c
with
27 additions
and
0 deletions
doc/apk-fetch.8.scd
+
4
−
0
View file @
78b70cd6
...
...
@@ -17,6 +17,10 @@ specified.
#
OPTIONS
*--
built
-
after
*
_TIMESPEC_
Only
fetch
packages
that
have
buildtime
more
recent
than
TIMESPEC
.
TIMESPEC
can
be
a
"YYYY-MM-DD HH:MM:SS"
date
,
or
seconds
since
epoch
.
*-
L
,
--
link
*
Create
hard
links
if
possible
.
...
...
This diff is collapsed.
Click to expand it.
src/app_fetch.c
+
23
−
0
View file @
78b70cd6
...
...
@@ -29,6 +29,7 @@
struct
fetch_ctx
{
unsigned
int
flags
;
int
outdir_fd
,
errors
;
time_t
built_after
;
struct
apk_database
*
db
;
size_t
done
,
total
;
struct
apk_dependency_array
*
world
;
...
...
@@ -69,6 +70,7 @@ static int cup(void)
}
#define FETCH_OPTIONS(OPT) \
OPT(OPT_FETCH_built_after, APK_OPT_ARG "built-after") \
OPT(OPT_FETCH_link, APK_OPT_SH("l") "link") \
OPT(OPT_FETCH_recursive, APK_OPT_SH("R") "recursive") \
OPT(OPT_FETCH_output, APK_OPT_ARG APK_OPT_SH("o") "output") \
...
...
@@ -79,11 +81,30 @@ static int cup(void)
APK_OPT_APPLET
(
option_desc
,
FETCH_OPTIONS
);
static
time_t
parse_time
(
const
char
*
timestr
)
{
struct
tm
tm
;
char
*
p
;
time_t
t
;
p
=
strptime
(
optarg
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
if
(
p
&&
*
p
==
0
)
return
mktime
(
&
tm
);
t
=
strtoul
(
optarg
,
&
p
,
10
);
if
(
p
&&
*
p
==
0
)
return
t
;
return
0
;
}
static
int
option_parse_applet
(
void
*
ctx
,
struct
apk_db_options
*
dbopts
,
int
opt
,
const
char
*
optarg
)
{
struct
fetch_ctx
*
fctx
=
(
struct
fetch_ctx
*
)
ctx
;
switch
(
opt
)
{
case
OPT_FETCH_built_after
:
fctx
->
built_after
=
parse_time
(
optarg
);
if
(
!
fctx
->
built_after
)
return
-
EINVAL
;
break
;
case
OPT_FETCH_simulate
:
apk_flags
|=
APK_SIMULATE
;
break
;
...
...
@@ -214,6 +235,8 @@ static void mark_package(struct fetch_ctx *ctx, struct apk_package *pkg)
{
if
(
pkg
==
NULL
||
pkg
->
marked
)
return
;
if
(
ctx
->
built_after
&&
pkg
->
build_time
&&
ctx
->
built_after
>=
pkg
->
build_time
)
return
;
ctx
->
total
+=
pkg
->
size
;
pkg
->
marked
=
1
;
}
...
...
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