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
91c4cc6c
Commit
91c4cc6c
authored
Apr 07, 2011
by
Timo Teräs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch: fix fetching of packages with arch
parent
4a16ddbc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
19 deletions
+24
-19
src/apk_database.h
src/apk_database.h
+3
-0
src/database.c
src/database.c
+20
-16
src/fetch.c
src/fetch.c
+1
-3
No files found.
src/apk_database.h
View file @
91c4cc6c
...
@@ -183,6 +183,9 @@ int apk_db_add_repository(apk_database_t db, apk_blob_t repository);
...
@@ -183,6 +183,9 @@ int apk_db_add_repository(apk_database_t db, apk_blob_t repository);
struct
apk_repository
*
apk_db_select_repo
(
struct
apk_database
*
db
,
struct
apk_repository
*
apk_db_select_repo
(
struct
apk_database
*
db
,
struct
apk_package
*
pkg
);
struct
apk_package
*
pkg
);
int
apk_repository_update
(
struct
apk_database
*
db
,
struct
apk_repository
*
repo
);
int
apk_repository_update
(
struct
apk_database
*
db
,
struct
apk_repository
*
repo
);
int
apk_repo_format_filename
(
char
*
buf
,
size_t
len
,
const
char
*
repourl
,
apk_blob_t
*
arch
,
const
char
*
pkgfile
);
int
apk_db_cache_active
(
struct
apk_database
*
db
);
int
apk_db_cache_active
(
struct
apk_database
*
db
);
void
apk_cache_format_index
(
apk_blob_t
to
,
struct
apk_repository
*
repo
);
void
apk_cache_format_index
(
apk_blob_t
to
,
struct
apk_repository
*
repo
);
...
...
src/database.c
View file @
91c4cc6c
...
@@ -489,14 +489,7 @@ int apk_cache_download(struct apk_database *db, const char *url, apk_blob_t *arc
...
@@ -489,14 +489,7 @@ int apk_cache_download(struct apk_database *db, const char *url, apk_blob_t *arc
char
fullurl
[
PATH_MAX
];
char
fullurl
[
PATH_MAX
];
int
r
;
int
r
;
if
(
arch
!=
NULL
)
apk_repo_format_filename
(
fullurl
,
sizeof
(
fullurl
),
url
,
arch
,
item
);
snprintf
(
fullurl
,
sizeof
(
fullurl
),
"%s%s"
BLOB_FMT
"/%s"
,
url
,
url
[
strlen
(
url
)
-
1
]
==
'/'
?
""
:
"/"
,
BLOB_PRINTF
(
*
arch
),
item
);
else
snprintf
(
fullurl
,
sizeof
(
fullurl
),
"%s%s/%s"
,
url
,
url
[
strlen
(
url
)
-
1
]
==
'/'
?
""
:
"/"
,
item
);
apk_message
(
"fetch %s"
,
fullurl
);
apk_message
(
"fetch %s"
,
fullurl
);
if
(
apk_flags
&
APK_SIMULATE
)
if
(
apk_flags
&
APK_SIMULATE
)
...
@@ -1529,6 +1522,24 @@ struct apk_package *apk_db_get_file_owner(struct apk_database *db,
...
@@ -1529,6 +1522,24 @@ struct apk_package *apk_db_get_file_owner(struct apk_database *db,
return
dbf
->
diri
->
pkg
;
return
dbf
->
diri
->
pkg
;
}
}
int
apk_repo_format_filename
(
char
*
buf
,
size_t
len
,
const
char
*
repourl
,
apk_blob_t
*
arch
,
const
char
*
item
)
{
int
n
;
if
(
arch
!=
NULL
)
n
=
snprintf
(
buf
,
len
,
"%s%s"
BLOB_FMT
"/%s"
,
repourl
,
repourl
[
strlen
(
repourl
)
-
1
]
==
'/'
?
""
:
"/"
,
BLOB_PRINTF
(
*
arch
),
item
);
else
n
=
snprintf
(
buf
,
len
,
"%s%s%s"
,
repourl
,
repourl
[
strlen
(
repourl
)
-
1
]
==
'/'
?
""
:
"/"
,
item
);
return
n
;
}
static
int
apk_repo_is_remote
(
struct
apk_repository
*
repo
)
static
int
apk_repo_is_remote
(
struct
apk_repository
*
repo
)
{
{
return
repo
->
csum
.
type
!=
APK_CHECKSUM_NONE
;
return
repo
->
csum
.
type
!=
APK_CHECKSUM_NONE
;
...
@@ -1541,14 +1552,7 @@ static struct apk_bstream *apk_repo_file_open(struct apk_repository *repo,
...
@@ -1541,14 +1552,7 @@ static struct apk_bstream *apk_repo_file_open(struct apk_repository *repo,
{
{
const
char
*
url
=
repo
->
url
;
const
char
*
url
=
repo
->
url
;
if
(
arch
!=
NULL
)
apk_repo_format_filename
(
buf
,
buflen
,
url
,
arch
,
file
);
snprintf
(
buf
,
buflen
,
"%s%s"
BLOB_FMT
"/%s"
,
url
,
url
[
strlen
(
url
)
-
1
]
==
'/'
?
""
:
"/"
,
BLOB_PRINTF
(
*
arch
),
file
);
else
snprintf
(
buf
,
buflen
,
"%s%s/%s"
,
url
,
url
[
strlen
(
url
)
-
1
]
==
'/'
?
""
:
"/"
,
file
);
if
((
apk_flags
&
APK_NO_NETWORK
)
&&
apk_repo_is_remote
(
repo
))
if
((
apk_flags
&
APK_NO_NETWORK
)
&&
apk_repo_is_remote
(
repo
))
return
NULL
;
return
NULL
;
...
...
src/fetch.c
View file @
91c4cc6c
...
@@ -120,9 +120,7 @@ static int fetch_package(struct fetch_ctx *fctx,
...
@@ -120,9 +120,7 @@ static int fetch_package(struct fetch_ctx *fctx,
if
(
apk_flags
&
APK_SIMULATE
)
if
(
apk_flags
&
APK_SIMULATE
)
return
0
;
return
0
;
snprintf
(
url
,
sizeof
(
url
),
"%s%s%s"
,
repo
->
url
,
apk_repo_format_filename
(
url
,
sizeof
(
url
),
repo
->
url
,
pkg
->
arch
,
pkgfile
);
repo
->
url
[
strlen
(
repo
->
url
)
-
1
]
==
'/'
?
""
:
"/"
,
pkgfile
);
if
(
fctx
->
flags
&
FETCH_STDOUT
)
{
if
(
fctx
->
flags
&
FETCH_STDOUT
)
{
fd
=
STDOUT_FILENO
;
fd
=
STDOUT_FILENO
;
...
...
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