Ich baue mir gerade einen Downloader/Viewer, der die Debian webseite(Jetzt nicht gleich wieder gehen nur weil du gerade auf Windows bist) analysiert auf Packages, die mit einem vom User eingegebenen Package zusammenhängen.
Hier mal meine Konsolenausgabe:
Das fett gedruckte stellt auch schon meine eigentliche Frage dar: Stimmt diese Reihenfolge zum installieren der Packages? Ich komm langsam durcheinander und habe keine ahnung wie ich das am besten überprüfen kann. Lasst euch von den Bindestrichen im oberen Bereich nicht irritieren, manche Pakete sind auch noch in anderen dieser Paketen abhängig und bekommen dadurch eine höhere Priorität.Package: xfree86-common
Arch.: i386
Please wait a while...
-xfree86-common
--debconf
---debconf-i18n
----liblocale-gettext-perl
-----libc6
------libdb1-compat
-------libc6.1
-----libgcc1
-----perl-base
-----perlapi-5.8.0
-----perlapi-5.8.4
----libtext-charwidth-perl
----libtext-iconv-perl
-----perlapi-5.8.3
----libtext-wrapi18n-perl
---debconf-english
--debianutils
---coreutils
----libacl1
-----libattr1
Stimmt diese Reihenfolge zum installieren?:
perl-base
libgcc1
libc6.1
libdb1-compat
libtext-charwidth-perl
debconf-i18n
libc6
perlapi-5.8.4
debconf
perlapi-5.8.0
libattr1
perlapi-5.8.3
libacl1
liblocale-gettext-perl
libtext-iconv-perl
libtext-wrapi18n-perl
debconf-english
coreutils
debianutils
xfree86-common
Beispiel:
Wenn ich debianutils nun zuerst untersuchen würde, dann wäre libc6 und libc6.1 auf einer unteren Prioritäts-Ebene als wenn ich debconf zuerst untersuchen würde. Das hab ich schon meiner ansicht nach richtig so programmiert, dass es korrigiert wird, nur kann ich nicht ausschließen, dass immernoch ein Bug drin sitzt. Wenn sich jemand von euch mir mal die Zeit nimmt um die Liste hier:
In korrekter Installations-Reihenfolge aufschreibt und mir sagt ob meine Reihenfolge stimmt wäre ich sehr dankbar.perl-base
libgcc1
libc6.1
libdb1-compat
libtext-charwidth-perl
debconf-i18n
libc6
perlapi-5.8.4
debconf
perlapi-5.8.0
libattr1
perlapi-5.8.3
libacl1
liblocale-gettext-perl
libtext-iconv-perl
libtext-wrapi18n-perl
debconf-english
coreutils
debianutils
xfree86-common
MfG,
Daniel
P.S.: Wer den Code dazu zur hilfe braucht...
PB4:
Code: Alles auswählen
; Debian Package Dependency Viewer - DarkDragon
; (Und vielleicht später auch mal Downloader, jedoch eher für private Zwecke)
; ----------------------------------
; HTTP Commands - DarkDragon
; ***************************
; Commands:
; ---------
; HTTPRequest(URL.s, *EndSize.LONG, PacketSize, *Callback) - Result: Pointer to a buffer containing the webdata
; URL.s - [in] Nullterminated string with the link to the file
; *EndSize - [out] Pointer to a long variable which receives the size of the resulting buffer
; PacketSize - [in] Long variable containing the size of the packets(steps) to download
; *Callback - [in] Pointer to a callback method receiving the following parameters: CurrentDownloadedSize.l, MaximumLength.l
InitNetwork()
#TIMEOUT = 2500
Procedure.s ReceiveLine(ConnectionID)
Text.s = ""
While char.b <> #LF
char = 0
ReceiveNetworkData(ConnectionID, @char, 1)
If char <> 0
Text.s + Chr(char)
EndIf
Wend
ProcedureReturn RemoveString(RemoveString(Text, #CR$), #LF$)
EndProcedure
Procedure HTTPRequest(URL.s, *EndSize.LONG, PacketSize, *Callback)
Protected Size.l, Data_.s, s.l, Method.s, File.s, Content.s, Text.s, Length.l, Line.s
Protected CurSize.l, oSize.l, t.l, ConnectionID.l
If Left(URL, 7) = "http://" : URL = Right(URL, Len(URL)-7) : EndIf
s = FindString(URL, "/", 1)
Host.s = "" : File.s = ""
If s <> 0 : Host.s = Left(URL, s-1) : File.s = Right(URL, Len(URL)-s) : Else : Host = URL : EndIf
s = FindString(File, "?", 1)
If s <> 0
Method.s = "POST"
Content.s = Right(File, Len(File)-s)
File = Left(File, s-1)
Else
Method.s = "GET"
Content.s = ""
EndIf
ConnectionID = OpenNetworkConnection(Host, 80)
If ConnectionID
Data_.s = Method+" /"+File+" HTTP/1.0"+#CRLF$
Data_.s + "Host: "+Host+#CRLF$
Data_.s + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"+#CRLF$
If Content <> ""
Data_.s + "Connection: close"+#CRLF$
Data_.s + "Content-Type: application/x-www-form-urlencoded"+#CRLF$
Data_.s + "Content-Length: "+Str(Len(Content))+#CRLF$
Data_.s + #CRLF$ + Content.s + #CRLF$+#CRLF$
Else
Data_.s + "Connection: close"+#CRLF$+#CRLF$
EndIf
SendNetworkString(ConnectionID, Data_)
While NetworkClientEvent(ConnectionID) <> 2 : Delay(10) : Wend
Length = 0
Line.s = ""
Repeat
Line = ReceiveLine(ConnectionID)
Select LCase(StringField(Line, 1, ":"))
Case "content-length"
Length = Val(Trim(StringField(Line, 2, ":")))
EndSelect
Until Len(Trim(Line)) <= 4
Size = 0
If Length <> 0
*Result = AllocateMemory(Length)
While Size < Length
If CurSize > 0
Size + CurSize
If *Callback
CallFunctionFast(*Callback, Size, Length)
EndIf
EndIf
If Size > (Length-PacketSize)
PacketSize = Length-Size
EndIf
If PacketSize > 0
CurSize = ReceiveNetworkData(ConnectionID, *Result+Size, PacketSize)
EndIf
Wend
Else
*Buffer = AllocateMemory(PacketSize)
*Result = AllocateMemory(1)
t = ElapsedMilliseconds()
While ElapsedMilliseconds()-t <= #TIMEOUT
If NetworkClientEvent(ConnectionID) = 2
CurSize = ReceiveNetworkData(ConnectionID, *Buffer, PacketSize)
If CurSize > 0
oSize = Size
Size + CurSize
*Result = ReAllocateMemory(*Result, Size)
CopyMemory(*Buffer, *Result+oSize, CurSize)
If *Callback
CallFunctionFast(*Callback, Size, 0)
EndIf
EndIf
t = ElapsedMilliseconds()
EndIf
Wend
Length = Size
EndIf
*EndSize\l = Length
If *Callback
CallFunctionFast(*Callback, Size, Length)
EndIf
CloseNetworkConnection(ConnectionID)
ProcedureReturn *Result
EndIf
EndProcedure
;-Main program
Global RecCount.l, Priority.l, Architecture.s, ShowMirrorSite.l
OpenConsole()
Structure SMakeFile
Name.s
MirrorSite.s
Priority.l
EndStructure
Global NewList MakeFile.SMakeFile()
Procedure DownloadPackagePart2(PackageURL.s)
*HTMLBuffer = HTTPRequest(PackageURL.s, @Size, 16, 0)
If *HTMLBuffer
HTML.s = PeekS(*HTMLBuffer)
href.s = PackageURL
href = GetPathPart(ReplaceString(href, "/", "\"))
href = ReplaceString(GetPathPart(Left(href, Len(href)-1)), "\", "/")
pkgName.s = GetFilePart(ReplaceString(PackageURL, "/", "\"))
m = 0
ForEach MakeFile()
If MakeFile()\Name = pkgName
If MakeFile()\Priority < Priority
q = 0
p = MakeFile()\Priority
pd = (Priority-MakeFile()\Priority) + 1
MakeFile()\Priority + pd
c = ListIndex(MakeFile())
While NextElement(MakeFile()) And q <> 1
If MakeFile()\Priority > p
MakeFile()\Priority + pd
Else
q = 1
EndIf
Wend
If ListIndex(MakeFile()) = CountList(MakeFile())-1
Priority + pd
EndIf
SelectElement(MakeFile(), c)
EndIf
m = 1
Break
EndIf
Next
If m = 0
LastElement(MakeFile())
AddElement(MakeFile())
MakeFile()\Name = pkgName
MakeFile()\Priority = RecCount
PrintN(ReplaceString(Space(RecCount), " ", "-")+pkgName)
Start = FindString(HTML, "<a href="+Chr(34)+"/cgi-bin/download.pl?arch="+Architecture, 0)
If Start > 0
Start + Len("<a href="+Chr(34))
Stop = FindString(HTML, Chr(34), Start)
If Stop > Start
Link.s = "http://packages.debian.org"+Mid(HTML, Start, Stop-Start)
If ShowMirrorSite = 1
PrintN("")
PrintN(Link)
PrintN("")
EndIf
Else
Start = FindString(HTML, "<a href="+Chr(34)+"/cgi-bin/download.pl?arch=all", 0)
If Start > 0
Start + Len("<a href="+Chr(34))
Stop = FindString(HTML, Chr(34), Start)
If Stop > Start
Link.s = "http://packages.debian.org"+Mid(HTML, Start, Stop-Start)
If ShowMirrorSite = 1
PrintN("")
PrintN(Link)
PrintN("")
EndIf
Else
If ShowMirrorSite = 1
PrintN("")
PrintN("No link found")
PrintN("")
EndIf
EndIf
EndIf
EndIf
Else
Start = FindString(HTML, "<a href="+Chr(34)+"/cgi-bin/download.pl?arch=all", 0)
If Start > 0
Start + Len("<a href="+Chr(34))
Stop = FindString(HTML, Chr(34), Start)
If Stop > Start
Link.s = "http://packages.debian.org"+Mid(HTML, Start, Stop-Start)
If ShowMirrorSite = 1
PrintN("")
PrintN(Link)
PrintN("")
EndIf
Else
If ShowMirrorSite = 1
PrintN("")
PrintN("No link found")
PrintN("")
EndIf
EndIf
EndIf
EndIf
Start = FindString(HTML, "<ul class="+Chr(34)+"uldep"+Chr(34)+">", 0)
Stop = FindString(HTML, "</ul>", Start)
If Start > 0 And Stop > Start
HTML = Mid(HTML, Start, Stop-Start)
Start = FindString(HTML, "<a href="+Chr(34)+"../", 0)
If Start > 0
Start + Len("<a href="+Chr(34)+"../")
Stop = FindString(HTML, Chr(34), Start)
EndIf
RecCount + 1
Priority + 1
While Start > 0 And Stop > Start
DownloadPackagePart2(href+Mid(HTML, Start, Stop-Start))
Start = FindString(HTML, "<a href="+Chr(34)+"../", Stop)
If Start > 0
Start + Len("<a href="+Chr(34)+"../")
Stop = FindString(HTML, Chr(34), Start)
EndIf
Wend
Priority - 1
RecCount - 1
EndIf
EndIf
FreeMemory(*HTMLBuffer)
EndIf
EndProcedure
Procedure DownloadPackage(PackageName.s)
*HTMLBuffer = HTTPRequest("http://packages.debian.org/cgi-bin/search_packages.pl?searchon=names&version=all&exact=1&keywords="+PackageName.s, @Size, 16, 0)
If *HTMLBuffer
HTML.s = PeekS(*HTMLBuffer)
ClearList(MakeFile())
RecCount = 1
If FindString(HTML, "stable", 0)
If FindString(HTML, "(base)", 0)
DownloadPackagePart2("http://packages.debian.org/stable/base/"+PackageName)
ElseIf FindString(HTML, "(libdevel)", 0)
DownloadPackagePart2("http://packages.debian.org/stable/libdevel/"+PackageName)
ElseIf FindString(HTML, "(libs)", 0)
DownloadPackagePart2("http://packages.debian.org/stable/libs/"+PackageName)
ElseIf FindString(HTML, "(x11)", 0)
DownloadPackagePart2("http://packages.debian.org/stable/x11/"+PackageName)
EndIf
EndIf
FreeMemory(*HTMLBuffer)
EndIf
EndProcedure
PackageName.s = "xfree86-common"
Architecture.s = "i386"
PrintN("Package: "+PackageName.s)
PrintN("Arch.: "+Architecture.s)
PrintN("")
;Print("Show links to mirror-select-site (y/...): ")
If 0; LCase(Input()) = "y"
ShowMirrorSite = 1
Else
ShowMirrorSite = 0
EndIf
PrintN("")
PrintN("")
PrintN("Please wait a while...")
PrintN("")
DownloadPackage(PackageName.s)
PrintN("")
PrintN("Stimmt diese Reihenfolge zum installieren?:")
PrintN("")
SortStructuredList(MakeFile(), 1, OffsetOf(SMakeFile\Priority), #PB_Sort_Long)
ForEach MakeFile()
PrintN(MakeFile()\Name)
Next
Input()
CloseConsole()
End
Code: Alles auswählen
Global NewList MakeFile.SMakeFile() -> NewList MakeFile.SMakeFile()