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
ca51ec32
Commit
ca51ec32
authored
16 years ago
by
Natanael Copa
Browse files
Options
Downloads
Patches
Plain Diff
db: allow more than one --repository arg
parent
6e55a182
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/apk.c
+17
-2
17 additions, 2 deletions
src/apk.c
src/apk_applet.h
+8
-1
8 additions, 1 deletion
src/apk_applet.h
src/database.c
+4
-3
4 additions, 3 deletions
src/database.c
with
29 additions
and
6 deletions
src/apk.c
+
17
−
2
View file @
ca51ec32
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
#include
"apk_applet.h"
#include
"apk_applet.h"
const
char
*
apk_root
;
const
char
*
apk_root
;
const
char
*
apk_repository
=
NULL
;
struct
apk_repository_url
apk_repository
_list
;
int
apk_verbosity
=
1
,
apk_progress
=
0
,
apk_upgrade
=
0
;
int
apk_verbosity
=
1
,
apk_progress
=
0
,
apk_upgrade
=
0
;
int
apk_cwd_fd
;
int
apk_cwd_fd
;
...
@@ -99,6 +99,17 @@ static struct apk_applet *deduce_applet(int argc, char **argv)
...
@@ -99,6 +99,17 @@ static struct apk_applet *deduce_applet(int argc, char **argv)
return
NULL
;
return
NULL
;
}
}
static
struct
apk_repository_url
*
apk_repository_new
(
const
char
*
url
)
{
struct
apk_repository_url
*
r
=
calloc
(
1
,
sizeof
(
struct
apk_repository_url
));
if
(
r
)
{
r
->
url
=
url
;
list_init
(
&
r
->
list
);
}
return
r
;
}
#define NUM_GENERIC_OPTS 6
#define NUM_GENERIC_OPTS 6
static
struct
option
generic_options
[
32
]
=
{
static
struct
option
generic_options
[
32
]
=
{
{
"root"
,
required_argument
,
NULL
,
'p'
},
{
"root"
,
required_argument
,
NULL
,
'p'
},
...
@@ -116,10 +127,12 @@ int main(int argc, char **argv)
...
@@ -116,10 +127,12 @@ int main(int argc, char **argv)
struct
option
*
opt
;
struct
option
*
opt
;
int
r
,
optindex
;
int
r
,
optindex
;
void
*
ctx
=
NULL
;
void
*
ctx
=
NULL
;
struct
apk_repository_url
*
repo
=
NULL
;
umask
(
0
);
umask
(
0
);
apk_cwd_fd
=
open
(
"."
,
O_RDONLY
);
apk_cwd_fd
=
open
(
"."
,
O_RDONLY
);
apk_root
=
getenv
(
"ROOT"
);
apk_root
=
getenv
(
"ROOT"
);
list_init
(
&
apk_repository_list
.
list
);
applet
=
deduce_applet
(
argc
,
argv
);
applet
=
deduce_applet
(
argc
,
argv
);
if
(
applet
!=
NULL
)
{
if
(
applet
!=
NULL
)
{
...
@@ -151,7 +164,9 @@ int main(int argc, char **argv)
...
@@ -151,7 +164,9 @@ int main(int argc, char **argv)
apk_root
=
optarg
;
apk_root
=
optarg
;
break
;
break
;
case
'X'
:
case
'X'
:
apk_repository
=
optarg
;
repo
=
apk_repository_new
(
optarg
);
if
(
repo
)
list_add
(
&
repo
->
list
,
&
apk_repository_list
.
list
);
break
;
break
;
case
'q'
:
case
'q'
:
apk_verbosity
--
;
apk_verbosity
--
;
...
...
This diff is collapsed.
Click to expand it.
src/apk_applet.h
+
8
−
1
View file @
ca51ec32
...
@@ -13,9 +13,16 @@
...
@@ -13,9 +13,16 @@
#define APK_APPLET_H
#define APK_APPLET_H
#include
<getopt.h>
#include
<getopt.h>
#include
"apk_defines.h"
extern
const
char
*
apk_root
;
extern
const
char
*
apk_root
;
extern
const
char
*
apk_repository
;
struct
apk_repository_url
{
struct
list_head
list
;
const
char
*
url
;
};
extern
struct
apk_repository_url
apk_repository_list
;
struct
apk_applet
{
struct
apk_applet
{
const
char
*
name
;
const
char
*
name
;
...
...
This diff is collapsed.
Click to expand it.
src/database.c
+
4
−
3
View file @
ca51ec32
...
@@ -621,6 +621,7 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
...
@@ -621,6 +621,7 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
apk_blob_t
blob
;
apk_blob_t
blob
;
const
char
*
apk_repos
=
getenv
(
"APK_REPOS"
),
*
msg
;
const
char
*
apk_repos
=
getenv
(
"APK_REPOS"
),
*
msg
;
int
r
;
int
r
;
struct
apk_repository_url
*
repo
=
NULL
;
memset
(
db
,
0
,
sizeof
(
*
db
));
memset
(
db
,
0
,
sizeof
(
*
db
));
apk_hash_init
(
&
db
->
available
.
names
,
&
pkg_name_hash_ops
,
1000
);
apk_hash_init
(
&
db
->
available
.
names
,
&
pkg_name_hash_ops
,
1000
);
...
@@ -696,10 +697,10 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
...
@@ -696,10 +697,10 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
}
}
}
}
if
(
apk_repository
!=
NULL
)
{
list_for_each_entry
(
repo
,
&
apk_repository_list
.
list
,
list
)
{
r
=
apk_db_add_repository
(
db
,
APK_BLOB_STR
(
apk_repository
));
r
=
apk_db_add_repository
(
db
,
APK_BLOB_STR
(
repo
->
url
));
if
(
r
!=
0
)
{
if
(
r
!=
0
)
{
msg
=
"Unable to load repositories"
;
msg
=
repo
->
url
;
goto
ret_r
;
goto
ret_r
;
}
}
}
}
...
...
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