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
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
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
e2afc7e7
Commit
e2afc7e7
authored
Aug 24, 2020
by
Timo Teräs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix, simplify and document upgrade --ignore
parent
f3cf8249
Pipeline
#42647
passed with stage
in 42 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
31 deletions
+24
-31
doc/apk-upgrade.8.scd
doc/apk-upgrade.8.scd
+7
-1
src/apk_package.h
src/apk_package.h
+3
-7
src/apk_solver.h
src/apk_solver.h
+1
-1
src/app_upgrade.c
src/app_upgrade.c
+8
-18
src/solver.c
src/solver.c
+5
-4
No files found.
doc/apk-upgrade.8.scd
View file @
e2afc7e7
...
...
@@ -11,7 +11,9 @@ apk upgrade - upgrade installed packages
#
DESCRIPTION
*
apk
upgrade
*
upgrades
installed
packages
to
the
latest
version
available
from
configured
package
repositories
(
see
*
apk
-
repositories
*
(
5
)).
configured
package
repositories
(
see
*
apk
-
repositories
*
(
5
)).
When
no
packages
are
specified
,
all
packages
are
upgraded
if
possible
.
If
list
of
packages
is
provided
,
only
those
packages
are
upgraded
along
with
needed
dependencies
.
#
OPTIONS
...
...
@@ -27,6 +29,10 @@ following options:
This
is
useful
to
reset
system
against
new
set
of
packages
after
updating
repositories
.
*--
ignore
*
Upgrade
all
other
packages
than
the
ones
listed
.
This
inverts
the
given
package
name
list
to
mean
packages
that
should
not
be
upgraded
.
*-
l
,
--
latest
*
Always
choose
the
latest
package
by
version
.
However
,
the
versions
considered
are
based
on
the
package
pi
nning
.
Primarily
this
overrides
...
...
src/apk_package.h
View file @
e2afc7e7
...
...
@@ -96,15 +96,11 @@ struct apk_installed_package {
struct
apk_package
{
apk_hash_node
hash_node
;
unsigned
int
foreach_genid
;
union
{
struct
apk_solver_package_state
ss
;
struct
{
unsigned
int
foreach_genid
;
union
{
int
state_int
;
void
*
state_ptr
;
};
};
int
state_int
;
void
*
state_ptr
;
};
struct
apk_name
*
name
;
struct
apk_installed_package
*
ipkg
;
...
...
src/apk_solver.h
View file @
e2afc7e7
...
...
@@ -33,7 +33,7 @@ struct apk_changeset {
#define APK_SOLVERF_REINSTALL 0x0004
#define APK_SOLVERF_LATEST 0x0008
#define APK_SOLVERF_IGNORE_CONFLICT 0x0010
#define APK_SOLVERF_I
GNORE_UPGRADE
0x0020
#define APK_SOLVERF_I
NSTALLED
0x0020
void
apk_solver_set_name_flags
(
struct
apk_name
*
name
,
unsigned
short
solver_flags
,
...
...
src/app_upgrade.c
View file @
e2afc7e7
...
...
@@ -138,8 +138,10 @@ static void set_upgrade_for_name(struct apk_database *db, const char *match, str
if
(
!
name
)
{
apk_error
(
"Package '%s' not found"
,
match
);
uctx
->
errors
++
;
}
else
apk_solver_set_name_flags
(
name
,
APK_SOLVERF_UPGRADE
,
0
);
return
;
}
apk_solver_set_name_flags
(
name
,
uctx
->
ignore
?
APK_SOLVERF_INSTALLED
:
APK_SOLVERF_UPGRADE
,
0
);
}
static
int
upgrade_main
(
void
*
ctx
,
struct
apk_database
*
db
,
struct
apk_string_array
*
args
)
...
...
@@ -157,7 +159,7 @@ static int upgrade_main(void *ctx, struct apk_database *db, struct apk_string_ar
}
solver_flags
=
APK_SOLVERF_UPGRADE
|
uctx
->
solver_flags
;
if
(
!
uctx
->
no_self_upgrade
)
{
if
(
!
uctx
->
no_self_upgrade
&&
!
args
->
num
)
{
r
=
apk_do_self_upgrade
(
db
,
solver_flags
,
uctx
->
self_upgrade_only
);
if
(
r
!=
0
)
return
r
;
...
...
@@ -165,15 +167,6 @@ static int upgrade_main(void *ctx, struct apk_database *db, struct apk_string_ar
if
(
uctx
->
self_upgrade_only
)
return
0
;
if
(
uctx
->
ignore
)
{
char
**
pkg_name
;
struct
apk_name
*
name
;
foreach_array_item
(
pkg_name
,
args
)
{
name
=
apk_db_get_name
(
db
,
APK_BLOB_STR
(
*
pkg_name
));
apk_solver_set_name_flags
(
name
,
solver_flags
|
APK_SOLVERF_IGNORE_UPGRADE
,
0
);
}
}
if
(
solver_flags
&
APK_SOLVERF_AVAILABLE
)
{
apk_dependency_array_copy
(
&
world
,
db
->
world
);
foreach_array_item
(
dep
,
world
)
{
...
...
@@ -188,12 +181,9 @@ static int upgrade_main(void *ctx, struct apk_database *db, struct apk_string_ar
if
(
args
->
num
>
0
)
{
/* if specific packages are listed, we don't want to upgrade world. */
solver_flags
&=
~
APK_SOLVERF_UPGRADE
;
apk_name_foreach_matching
(
db
,
args
,
apk_foreach_genid
(),
set_upgrade_for_name
,
&
uctx
);
if
(
uctx
->
errors
)
return
uctx
->
errors
;
if
(
!
uctx
->
ignore
)
solver_flags
&=
~
APK_SOLVERF_UPGRADE
;
apk_name_foreach_matching
(
db
,
args
,
apk_foreach_genid
(),
set_upgrade_for_name
,
uctx
);
if
(
uctx
->
errors
)
return
uctx
->
errors
;
}
r
=
apk_solver_commit
(
db
,
solver_flags
,
world
);
...
...
src/solver.c
View file @
e2afc7e7
...
...
@@ -53,6 +53,8 @@ void apk_solver_set_name_flags(struct apk_name *name,
foreach_array_item
(
p
,
name
->
providers
)
{
struct
apk_package
*
pkg
=
p
->
pkg
;
dbg_printf
(
"marking '"
PKG_VER_FMT
"' = 0x%04x / 0x%04x
\n
"
,
PKG_VER_PRINTF
(
pkg
),
solver_flags
,
solver_flags_inheritable
);
pkg
->
ss
.
solver_flags
|=
solver_flags
;
pkg
->
ss
.
solver_flags_inheritable
|=
solver_flags_inheritable
;
}
...
...
@@ -564,10 +566,10 @@ static int compare_providers(struct apk_solver_state *ss,
/* Prefer installed on self-upgrade */
if
((
db
->
performing_self_upgrade
&&
!
(
solver_flags
&
APK_SOLVERF_UPGRADE
))
||
(
solver_flags
&
APK_SOLVERF_I
GNORE_UPGRADE
))
{
(
solver_flags
&
APK_SOLVERF_I
NSTALLED
))
{
r
=
(
pkgA
->
ipkg
!=
NULL
)
-
(
pkgB
->
ipkg
!=
NULL
);
if
(
r
)
{
dbg_printf
(
" prefer installed
on self-upgrade
\n
"
);
dbg_printf
(
" prefer installed
\n
"
);
return
r
;
}
}
...
...
@@ -603,8 +605,7 @@ static int compare_providers(struct apk_solver_state *ss,
}
/* Prefer installed */
if
(
!
(
solver_flags
&
APK_SOLVERF_UPGRADE
)
||
(
solver_flags
&
APK_SOLVERF_IGNORE_UPGRADE
))
{
if
(
!
(
solver_flags
&
APK_SOLVERF_UPGRADE
))
{
r
=
(
pkgA
->
ipkg
!=
NULL
)
-
(
pkgB
->
ipkg
!=
NULL
);
if
(
r
)
{
dbg_printf
(
" prefer installed
\n
"
);
...
...
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