Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
apk-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
60
Issues
60
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
apk-tools
Commits
32064c35
Commit
32064c35
authored
May 15, 2009
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: create csum for virtuals. only add the virtual to world
parent
7950a2b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
src/add.c
src/add.c
+14
-2
No files found.
src/add.c
View file @
32064c35
...
...
@@ -40,6 +40,14 @@ static int add_parse(void *ctx, int optch, int optindex, const char *optarg)
return
0
;
}
static
void
md5_str
(
const
char
*
str
,
md5sum_t
csum
)
{
struct
md5_ctx
ctx
;
md5_init
(
&
ctx
);
md5_process
(
&
ctx
,
str
,
strlen
(
str
));
md5_finish
(
&
ctx
,
csum
);
}
static
int
add_main
(
void
*
ctx
,
int
argc
,
char
**
argv
)
{
struct
add_ctx
*
actx
=
(
struct
add_ctx
*
)
ctx
;
...
...
@@ -61,6 +69,7 @@ static int add_main(void *ctx, int argc, char **argv)
goto
err
;
}
virtpkg
->
name
=
apk_db_get_name
(
&
db
,
APK_BLOB_STR
(
actx
->
virtpkg
));
md5_str
(
virtpkg
->
name
->
name
,
virtpkg
->
csum
);
virtpkg
->
version
=
strdup
(
"0"
);
virtpkg
->
description
=
strdup
(
"virtual meta package"
);
virtdep
=
(
struct
apk_dependency
)
{
...
...
@@ -103,8 +112,10 @@ static int add_main(void *ctx, int argc, char **argv)
apk_deps_add
(
&
pkgs
,
&
dep
);
}
if
(
virtpkg
)
if
(
virtpkg
)
{
apk_deps_add
(
&
pkgs
,
&
virtdep
);
apk_deps_add
(
&
db
.
world
,
&
virtdep
);
}
state
=
apk_state_new
(
&
db
);
for
(
i
=
0
;
i
<
pkgs
->
num
;
i
++
)
{
...
...
@@ -113,7 +124,8 @@ static int add_main(void *ctx, int argc, char **argv)
apk_error
(
"Unable to install '%s'"
,
pkgs
->
item
[
i
].
name
->
name
);
goto
err
;
}
apk_deps_add
(
&
db
.
world
,
&
pkgs
->
item
[
i
]);
if
(
!
virtpkg
)
apk_deps_add
(
&
db
.
world
,
&
pkgs
->
item
[
i
]);
}
r
=
apk_state_commit
(
state
,
&
db
);
err:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment