Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
ea566b71
Commit
ea566b71
authored
Aug 02, 2013
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apt: try to detect new packages
The previos approch did not detect new packages, like new kernels.
parent
688a9b2b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
+34
-3
APT.pm
PVE/API2/APT.pm
+34
-3
No files found.
PVE/API2/APT.pm
View file @
ea566b71
...
@@ -136,7 +136,7 @@ my $assemble_pkginfo = sub {
...
@@ -136,7 +136,7 @@ my $assemble_pkginfo = sub {
}
}
$data
->
{
Version
}
=
$candidate_ver
->
{
VerStr
};
$data
->
{
Version
}
=
$candidate_ver
->
{
VerStr
};
$data
->
{
OldVersion
}
=
$current_ver
->
{
VerStr
};
$data
->
{
OldVersion
}
=
$current_ver
->
{
VerStr
}
if
$current_ver
;
return
$data
;
return
$data
;
};
};
...
@@ -164,9 +164,36 @@ my $update_pve_pkgstatus = sub {
...
@@ -164,9 +164,36 @@ my $update_pve_pkgstatus = sub {
my
$info
=
$pkgrecords
->
lookup
(
$pkgname
);
my
$info
=
$pkgrecords
->
lookup
(
$pkgname
);
my
$res
=
&
$assemble_pkginfo
(
$pkgname
,
$info
,
$current_ver
,
$candidate_ver
);
my
$res
=
&
$assemble_pkginfo
(
$pkgname
,
$info
,
$current_ver
,
$candidate_ver
);
push
@$pkglist
,
$res
;
push
@$pkglist
,
$res
;
# also check if we need any new package
# Note: this is just a quick hack (not recursive as it should be), because
# I found no way to get that info from AptPkg
if
(
my
$deps
=
$candidate_ver
->
{
DependsList
})
{
my
$found
;
my
$req
;
for
my
$d
(
@$deps
)
{
if
(
$d
->
{
DepType
}
eq
'
Depends
')
{
$found
=
$d
->
{
TargetPkg
}
->
{
SelectedState
}
eq
'
Install
'
if
!
$found
;
$req
=
$d
->
{
TargetPkg
}
if
!
$req
;
if
(
!
(
$d
->
{
CompType
}
&
AptPkg::Dep::
Or
))
{
if
(
!
$found
&&
$req
)
{
# New required Package
my
$tpname
=
$req
->
{
Name
};
my
$tpinfo
=
$pkgrecords
->
lookup
(
$tpname
);
my
$tpcv
=
$policy
->
candidate
(
$req
);
if
(
$tpinfo
&&
$tpcv
)
{
my
$res
=
&
$assemble_pkginfo
(
$tpname
,
$tpinfo
,
undef
,
$tpcv
);
push
@$pkglist
,
$res
;
}
}
undef
$found
;
undef
$req
;
}
}
}
}
}
}
}
}
PVE::Tools::
file_set_contents
(
$pve_pkgstatus_fn
,
encode_json
(
$pkglist
));
PVE::Tools::
file_set_contents
(
$pve_pkgstatus_fn
,
encode_json
(
$pkglist
));
return
$pkglist
;
return
$pkglist
;
...
@@ -305,7 +332,11 @@ __PACKAGE__->register_method({
...
@@ -305,7 +332,11 @@ __PACKAGE__->register_method({
$data
.=
"
The following updates are available:
\n\n
";
$data
.=
"
The following updates are available:
\n\n
";
foreach
my
$p
(
sort
{
$a
->
{
Package
}
cmp
$b
->
{
Package
}
}
@$pkglist
)
{
foreach
my
$p
(
sort
{
$a
->
{
Package
}
cmp
$b
->
{
Package
}
}
@$pkglist
)
{
if
(
$p
->
{
OldVersion
})
{
$data
.=
"
$p
->{Package}:
$p
->{OldVersion} ==>
$p
->{Version}
\n
";
$data
.=
"
$p
->{Package}:
$p
->{OldVersion} ==>
$p
->{Version}
\n
";
}
else
{
$data
.=
"
$p
->{Package}:
$p
->{Version} (new)
\n
";
}
}
}
my
$fh
=
IO::
File
->
new
("
|sendmail -B 8BITMIME
$mailto
")
||
my
$fh
=
IO::
File
->
new
("
|sendmail -B 8BITMIME
$mailto
")
||
...
...
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