Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
apt
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
42
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
APT Developers
apt
Commits
49cb36fc
Commit
49cb36fc
authored
15 years ago
by
Michael Vogt
Browse files
Options
Downloads
Patches
Plain Diff
methods/cdrom.cc: move the scan into the loop that waits for a CD
parent
a6418a4b
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
apt-pkg/cdrom.cc
+6
-1
6 additions, 1 deletion
apt-pkg/cdrom.cc
apt-pkg/cdrom.h
+2
-0
2 additions, 0 deletions
apt-pkg/cdrom.h
methods/cdrom.cc
+39
-28
39 additions, 28 deletions
methods/cdrom.cc
with
47 additions
and
29 deletions
apt-pkg/cdrom.cc
+
6
−
1
View file @
49cb36fc
...
...
@@ -847,7 +847,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
pkgUdevCdromDevices
::
pkgUdevCdromDevices
()
:
libudev_handle
(
NULL
)
:
libudev_handle
(
NULL
)
,
Dlopened
(
false
)
{
}
...
...
@@ -855,6 +855,10 @@ pkgUdevCdromDevices::pkgUdevCdromDevices()
bool
pkgUdevCdromDevices
::
Dlopen
()
{
// alread open
if
(
Dlopened
)
return
true
;
// see if we can get libudev
void
*
h
=
::
dlopen
(
"libudev.so.0"
,
RTLD_LAZY
);
if
(
h
==
NULL
)
...
...
@@ -874,6 +878,7 @@ pkgUdevCdromDevices::Dlopen()
udev_list_entry_get_next
=
(
udev_list_entry
*
(
*
)(
udev_list_entry
*
))
dlsym
(
h
,
"udev_list_entry_get_next"
);
udev_device_get_property_value
=
(
const
char
*
(
*
)(
udev_device
*
,
const
char
*
))
dlsym
(
h
,
"udev_device_get_property_value"
);
Dlopened
=
true
;
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
apt-pkg/cdrom.h
+
2
−
0
View file @
49cb36fc
...
...
@@ -77,6 +77,8 @@ struct CdromDevice
class
pkgUdevCdromDevices
{
private:
bool
Dlopened
;
protected:
// libudev dlopen stucture
void
*
libudev_handle
;
...
...
This diff is collapsed.
Click to expand it.
methods/cdrom.cc
+
39
−
28
View file @
49cb36fc
...
...
@@ -121,6 +121,8 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
FetchResult
Res
;
bool
Debug
=
_config
->
FindB
(
"Debug::Acquire::cdrom"
,
false
);
if
(
Debug
)
clog
<<
"CDROMMethod::Fetch "
<<
Itm
->
Uri
<<
endl
;
/* All IMS queries are returned as a hit, CDROMs are readonly so
time stamps never change */
...
...
@@ -156,54 +158,63 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
}
// We already have a CD inserted, but it is the wrong one
if
(
CurrentID
.
empty
()
==
false
&&
Database
.
Find
(
"CD::"
+
CurrentID
)
!=
Get
.
Host
)
if
(
CurrentID
.
empty
()
==
false
&&
CurrentID
!=
"FAIL"
&&
Database
.
Find
(
"CD::"
+
CurrentID
)
!=
Get
.
Host
)
{
Fail
(
_
(
"Wrong CD-ROM"
),
true
);
return
true
;
}
CDROM
=
_config
->
FindDir
(
"Acquire::cdrom::mount"
,
"/cdrom/"
);
if
(
Debug
)
clog
<<
"Looking for CDROM at "
<<
CDROM
<<
endl
;
// auto-detect mode
if
(
CDROM
==
"apt-udev-auto/"
)
if
(
CDROM
[
0
]
==
'.'
)
CDROM
=
SafeGetCWD
()
+
'/'
+
CDROM
;
string
NewID
;
pkgUdevCdromDevices
udev
;
while
(
CurrentID
.
empty
()
==
true
)
{
pkgUdevCdromDevices
udev
;
if
(
udev
.
Dlopen
())
// hrm, ugly the loop here
if
(
CDROM
==
"apt-udev-auto/"
)
{
vector
<
struct
CdromDevice
>
v
=
udev
.
Scan
();
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
if
(
udev
.
Dlopen
())
{
if
(
!
v
[
i
].
Mounted
)
vector
<
struct
CdromDevice
>
v
=
udev
.
Scan
();
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
if
(
!
FileExists
(
"/media/apt"
)
)
mkdir
(
"/media/apt"
,
0755
)
;
if
(
MountCdrom
(
"/media/apt"
,
v
[
i
].
DeviceName
)
)
if
(
Debug
)
clog
<<
"Have cdrom device "
<<
v
[
i
].
DeviceName
<<
endl
;
if
(
!
v
[
i
].
Mounted
)
{
if
(
IsCorrectCD
(
Get
,
"/media/apt"
))
if
(
!
FileExists
(
"/media/apt"
))
mkdir
(
"/media/apt"
,
0755
);
if
(
MountCdrom
(
"/media/apt"
,
v
[
i
].
DeviceName
))
{
if
(
IsCorrectCD
(
Get
,
"/media/apt"
))
{
MountedByApt
=
true
;
CDROM
=
"/media/apt"
;
break
;
}
else
{
UnmountCdrom
(
"/media/apt"
);
}
}
}
else
{
if
(
IsCorrectCD
(
Get
,
v
[
i
].
MountPath
))
{
MountedByApt
=
true
;
CDROM
=
"/media/apt"
;
CDROM
=
v
[
i
].
MountPath
;
break
;
}
else
{
UnmountCdrom
(
"/media/apt"
);
}
}
}
else
{
if
(
IsCorrectCD
(
Get
,
v
[
i
].
MountPath
))
{
CDROM
=
v
[
i
].
MountPath
;
break
;
}
}
}
else
{
_error
->
WarningE
(
"udev.Dlopen() failed"
,
"foo"
);
}
}
}
if
(
CDROM
[
0
]
==
'.'
)
CDROM
=
SafeGetCWD
()
+
'/'
+
CDROM
;
string
NewID
;
while
(
CurrentID
.
empty
()
==
true
)
{
bool
Hit
=
false
;
if
(
!
IsMounted
(
CDROM
))
MountedByApt
=
MountCdrom
(
CDROM
);
...
...
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