kpm: show usage and --install-all option

git-svn-id: svn://kolibrios.org@5809 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2015-09-06 10:18:55 +00:00
parent 2d6646029b
commit e9ad07e519
13 changed files with 480 additions and 346 deletions

View File

@ -6,6 +6,7 @@
#include "7zCrc.h" #include "7zCrc.h"
#include "7zFile.h" #include "7zFile.h"
#include "7zVersion.h" #include "7zVersion.h"
#include "http.h"
#include "package.h" #include "package.h"
#define PERIOD_4 (4 * 365 + 1) #define PERIOD_4 (4 * 365 + 1)
@ -323,11 +324,11 @@ static void ConvertFileTimeToString(const CNtfsFileTime *nt, char *s)
} }
void do_7z_unpack(const char *srcpath)
void do_install(list_t *install)
{ {
CFileInStream archiveStream; CFileInStream archiveStream;
CLookToRead lookStream; CLookToRead lookStream;
CSzArEx db; CSzArEx db;
SRes res; SRes res;
ISzAlloc allocImp; ISzAlloc allocImp;
@ -335,8 +336,7 @@ void do_install(list_t *install)
UInt16 *temp = NULL; UInt16 *temp = NULL;
size_t tempSize = 0; size_t tempSize = 0;
package_t *pkg, *tmp; memset(&lookStream,0,sizeof(lookStream));
char *cache_path;
allocImp.Alloc = SzAlloc; allocImp.Alloc = SzAlloc;
allocImp.Free = SzFree; allocImp.Free = SzFree;
@ -344,126 +344,136 @@ void do_install(list_t *install)
allocTempImp.Alloc = SzAllocTemp; allocTempImp.Alloc = SzAllocTemp;
allocTempImp.Free = SzFreeTemp; allocTempImp.Free = SzFreeTemp;
if (InFile_Open(&archiveStream.file, srcpath))
return;
FileInStream_CreateVTable(&archiveStream);
LookToRead_CreateVTable(&lookStream, False);
lookStream.realStream = &archiveStream.s;
LookToRead_Init(&lookStream);
CrcGenerateTable();
SzArEx_Init(&db);
res = SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp);
if (res == SZ_OK)
{
UInt32 i;
UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
Byte *outBuffer = 0; /* it must be 0 before first call for each new archive. */
size_t outBufferSize = 0; /* it can have any value before first call (if outBuffer = 0) */
for (i = 0; i < db.NumFiles; i++)
{
size_t offset = 0;
size_t outSizeProcessed = 0;
size_t len;
unsigned isDir = SzArEx_IsDir(&db, i);
if ( isDir )
continue;
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
if (len > tempSize)
{
SzFree(NULL, temp);
tempSize = len;
temp = (UInt16 *)SzAlloc(NULL, tempSize * sizeof(temp[0]));
if (!temp)
{
res = SZ_ERROR_MEM;
break;
}
}
SzArEx_GetFileNameUtf16(&db, i, temp);
res = PrintString(temp);
if (res != SZ_OK)
break;
printf("\n");
if (isDir)
printf("/");
else
{
res = SzArEx_Extract(&db, &lookStream.s, i,
&blockIndex, &outBuffer, &outBufferSize,
&offset, &outSizeProcessed,
&allocImp, &allocTempImp);
if (res != SZ_OK)
break;
}
if (1)
{
CSzFile outFile;
size_t processedSize;
size_t j;
UInt16 *name = (UInt16 *)temp;
const UInt16 *destPath = (const UInt16 *)name;
for (j = 0; name[j] != 0; j++)
if (name[j] == '/')
{
name[j] = 0;
MyCreateDir(name);
name[j] = CHAR_PATH_SEPARATOR;
}
if (isDir)
{
MyCreateDir(destPath);
printf("\n");
continue;
}
else if (OutFile_OpenUtf16(&outFile, destPath))
{
PrintError("can not open output file");
res = SZ_ERROR_FAIL;
break;
}
processedSize = outSizeProcessed;
if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 || processedSize != outSizeProcessed)
{
PrintError("can not write output file\n");
res = SZ_ERROR_FAIL;
break;
}
if (File_Close(&outFile))
{
PrintError("can not close output file\n");
res = SZ_ERROR_FAIL;
break;
}
};
};
IAlloc_Free(&allocImp, outBuffer);
};
SzArEx_Free(&db, &allocImp);
SzFree(NULL, temp);
File_Close(&archiveStream.file);
};
void do_install(list_t *install)
{
package_t *pkg, *tmp;
char *cache_path;
list_for_each_entry_safe(pkg, tmp, install, list) list_for_each_entry_safe(pkg, tmp, install, list)
{ {
cache_path = make_cache_path(pkg->filename); cache_path = make_cache_path(pkg->filename);
if (InFile_Open(&archiveStream.file, cache_path)) sprintf(conbuf,"install package %s-%s\n", pkg->name, pkg->version);
continue; con_write_asciiz(conbuf);
FileInStream_CreateVTable(&archiveStream); do_7z_unpack(cache_path);
LookToRead_CreateVTable(&lookStream, False); list_del_pkg(pkg);
lookStream.realStream = &archiveStream.s;
LookToRead_Init(&lookStream);
SzArEx_Init(&db);
res = SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp);
if (res == SZ_OK)
{
UInt32 i;
UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
Byte *outBuffer = 0; /* it must be 0 before first call for each new archive. */
size_t outBufferSize = 0; /* it can have any value before first call (if outBuffer = 0) */
for (i = 0; i < db.NumFiles; i++)
{
size_t offset = 0;
size_t outSizeProcessed = 0;
size_t len;
unsigned isDir = SzArEx_IsDir(&db, i);
if ( isDir )
continue;
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
if (len > tempSize)
{
SzFree(NULL, temp);
tempSize = len;
temp = (UInt16 *)SzAlloc(NULL, tempSize * sizeof(temp[0]));
if (!temp)
{
res = SZ_ERROR_MEM;
break;
}
}
SzArEx_GetFileNameUtf16(&db, i, temp);
res = PrintString(temp);
if (res != SZ_OK)
break;
printf("\n");
if (isDir)
printf("/");
else
{
res = SzArEx_Extract(&db, &lookStream.s, i,
&blockIndex, &outBuffer, &outBufferSize,
&offset, &outSizeProcessed,
&allocImp, &allocTempImp);
if (res != SZ_OK)
break;
}
if (1)
{
CSzFile outFile;
size_t processedSize;
size_t j;
UInt16 *name = (UInt16 *)temp;
const UInt16 *destPath = (const UInt16 *)name;
for (j = 0; name[j] != 0; j++)
if (name[j] == '/')
{
if (1)
{
name[j] = 0;
MyCreateDir(name);
name[j] = CHAR_PATH_SEPARATOR;
}
else
destPath = name + j + 1;
}
if (isDir)
{
MyCreateDir(destPath);
printf("\n");
continue;
}
else if (OutFile_OpenUtf16(&outFile, destPath))
{
PrintError("can not open output file");
res = SZ_ERROR_FAIL;
break;
}
processedSize = outSizeProcessed;
if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 || processedSize != outSizeProcessed)
{
PrintError("can not write output file");
res = SZ_ERROR_FAIL;
break;
}
if (File_Close(&outFile))
{
PrintError("can not close output file");
res = SZ_ERROR_FAIL;
break;
}
};
continue;
};
};
}; };
}; };

View File

@ -81,8 +81,8 @@ static SRes SzBitUi32s_Alloc(CSzBitUi32s *p, size_t num, ISzAlloc *alloc)
} }
else else
{ {
MY_ALLOC(Byte, p->Defs, (num + 7) >> 3, alloc); MY_ALLOC(Byte, p->Defs, (num + 7) >> 3, alloc);
MY_ALLOC(UInt32, p->Vals, num, alloc); MY_ALLOC(UInt32, p->Vals, num, alloc);
} }
return SZ_OK; return SZ_OK;
} }
@ -593,67 +593,67 @@ SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd, CSzData *sdSizes)
{ {
Byte streamUsed[k_NumCodersStreams_in_Folder_MAX]; Byte streamUsed[k_NumCodersStreams_in_Folder_MAX];
UInt32 numBonds, numPackStreams; UInt32 numBonds, numPackStreams;
numBonds = numCoders - 1; numBonds = numCoders - 1;
if (numInStreams < numBonds) if (numInStreams < numBonds)
return SZ_ERROR_ARCHIVE; return SZ_ERROR_ARCHIVE;
if (numBonds > SZ_NUM_BONDS_IN_FOLDER_MAX) if (numBonds > SZ_NUM_BONDS_IN_FOLDER_MAX)
return SZ_ERROR_UNSUPPORTED; return SZ_ERROR_UNSUPPORTED;
f->NumBonds = numBonds; f->NumBonds = numBonds;
numPackStreams = numInStreams - numBonds; numPackStreams = numInStreams - numBonds;
if (numPackStreams > SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX) if (numPackStreams > SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX)
return SZ_ERROR_UNSUPPORTED; return SZ_ERROR_UNSUPPORTED;
f->NumPackStreams = numPackStreams; f->NumPackStreams = numPackStreams;
for (i = 0; i < numInStreams; i++) for (i = 0; i < numInStreams; i++)
streamUsed[i] = False; streamUsed[i] = False;
if (numBonds != 0) if (numBonds != 0)
{ {
Byte coderUsed[SZ_NUM_CODERS_IN_FOLDER_MAX]; Byte coderUsed[SZ_NUM_CODERS_IN_FOLDER_MAX];
for (i = 0; i < numCoders; i++) for (i = 0; i < numCoders; i++)
coderUsed[i] = False; coderUsed[i] = False;
for (i = 0; i < numBonds; i++) for (i = 0; i < numBonds; i++)
{ {
CSzBond *bp = f->Bonds + i; CSzBond *bp = f->Bonds + i;
RINOK(SzReadNumber32(sd, &bp->InIndex)); RINOK(SzReadNumber32(sd, &bp->InIndex));
if (bp->InIndex >= numInStreams || streamUsed[bp->InIndex]) if (bp->InIndex >= numInStreams || streamUsed[bp->InIndex])
return SZ_ERROR_ARCHIVE; return SZ_ERROR_ARCHIVE;
streamUsed[bp->InIndex] = True; streamUsed[bp->InIndex] = True;
RINOK(SzReadNumber32(sd, &bp->OutIndex)); RINOK(SzReadNumber32(sd, &bp->OutIndex));
if (bp->OutIndex >= numCoders || coderUsed[bp->OutIndex]) if (bp->OutIndex >= numCoders || coderUsed[bp->OutIndex])
return SZ_ERROR_ARCHIVE; return SZ_ERROR_ARCHIVE;
coderUsed[bp->OutIndex] = True; coderUsed[bp->OutIndex] = True;
} }
for (i = 0; i < numCoders; i++) for (i = 0; i < numCoders; i++)
if (!coderUsed[i]) if (!coderUsed[i])
{ {
f->UnpackStream = i; f->UnpackStream = i;
break; break;
} }
if (i == numCoders) if (i == numCoders)
return SZ_ERROR_ARCHIVE; return SZ_ERROR_ARCHIVE;
} }
if (numPackStreams == 1) if (numPackStreams == 1)
{ {
for (i = 0; i < numInStreams; i++) for (i = 0; i < numInStreams; i++)
if (!streamUsed[i]) if (!streamUsed[i])
break; break;
if (i == numInStreams) if (i == numInStreams)
return SZ_ERROR_ARCHIVE; return SZ_ERROR_ARCHIVE;
f->PackStreams[0] = i; f->PackStreams[0] = i;
} }
else else
for (i = 0; i < numPackStreams; i++) for (i = 0; i < numPackStreams; i++)
{ {
UInt32 index; UInt32 index;
RINOK(SzReadNumber32(sd, &index)); RINOK(SzReadNumber32(sd, &index));
if (index >= numInStreams || streamUsed[index]) if (index >= numInStreams || streamUsed[index])
@ -661,7 +661,7 @@ SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd, CSzData *sdSizes)
streamUsed[index] = True; streamUsed[index] = True;
f->PackStreams[i] = index; f->PackStreams[i] = index;
} }
} }
for (i = 0; i < numCoders; i++) for (i = 0; i < numCoders; i++)
{ {

View File

@ -69,7 +69,7 @@ void MY_FAST_CALL CrcGenerateTable()
UInt32 r = g_CrcTable[i - 256]; UInt32 r = g_CrcTable[i - 256];
g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8); g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
} }
#if CRC_NUM_TABLES < 4 #if CRC_NUM_TABLES < 4
g_CrcUpdate = CrcUpdateT1; g_CrcUpdate = CrcUpdateT1;
@ -79,15 +79,15 @@ void MY_FAST_CALL CrcGenerateTable()
#ifdef MY_CPU_LE #ifdef MY_CPU_LE
g_CrcUpdateT4 = CrcUpdateT4; g_CrcUpdateT4 = CrcUpdateT4;
g_CrcUpdate = CrcUpdateT4; g_CrcUpdate = CrcUpdateT4;
#if CRC_NUM_TABLES >= 8 #if CRC_NUM_TABLES >= 8
g_CrcUpdateT8 = CrcUpdateT8; g_CrcUpdateT8 = CrcUpdateT8;
#ifdef MY_CPU_X86_OR_AMD64 #ifdef MY_CPU_X86_OR_AMD64
if (!CPU_Is_InOrder()) if (!CPU_Is_InOrder())
g_CrcUpdate = CrcUpdateT8; g_CrcUpdate = CrcUpdateT8;
#endif #endif
#endif #endif
#else #else

View File

@ -446,7 +446,7 @@ static SRes SzFolder_Decode2(const CSzFolder *folder,
tempBuf[2] = (Byte *)IAlloc_Alloc(allocMain, tempSizes[2]); tempBuf[2] = (Byte *)IAlloc_Alloc(allocMain, tempSizes[2]);
if (!tempBuf[2] && tempSizes[2] != 0) if (!tempBuf[2] && tempSizes[2] != 0)
return SZ_ERROR_MEM; return SZ_ERROR_MEM;
RINOK(LookInStream_SeekTo(inStream, startPos + offset)); RINOK(LookInStream_SeekTo(inStream, startPos + offset));
RINOK(SzDecodeCopy(s3Size, inStream, tempBuf[2])); RINOK(SzDecodeCopy(s3Size, inStream, tempBuf[2]));
@ -496,30 +496,30 @@ static SRes SzFolder_Decode2(const CSzFolder *folder,
Delta_Init(state); Delta_Init(state);
Delta_Decode(state, (unsigned)(propsData[coder->PropsOffset]) + 1, outBuffer, outSize); Delta_Decode(state, (unsigned)(propsData[coder->PropsOffset]) + 1, outBuffer, outSize);
} }
} }
else else
{ {
if (coder->PropsSize != 0) if (coder->PropsSize != 0)
return SZ_ERROR_UNSUPPORTED; return SZ_ERROR_UNSUPPORTED;
switch (coder->MethodID) switch (coder->MethodID)
{
case k_BCJ:
{ {
case k_BCJ: UInt32 state;
{ x86_Convert_Init(state);
UInt32 state; x86_Convert(outBuffer, outSize, 0, &state, 0);
x86_Convert_Init(state); break;
x86_Convert(outBuffer, outSize, 0, &state, 0); }
break;
}
CASE_BRA_CONV(PPC) CASE_BRA_CONV(PPC)
CASE_BRA_CONV(IA64) CASE_BRA_CONV(IA64)
CASE_BRA_CONV(SPARC) CASE_BRA_CONV(SPARC)
CASE_BRA_CONV(ARM) CASE_BRA_CONV(ARM)
CASE_BRA_CONV(ARMT) CASE_BRA_CONV(ARMT)
default: default:
return SZ_ERROR_UNSUPPORTED; return SZ_ERROR_UNSUPPORTED;
}
} }
} }
}
#endif #endif
else else
return SZ_ERROR_UNSUPPORTED; return SZ_ERROR_UNSUPPORTED;

View File

@ -122,12 +122,12 @@ WRes File_Read(CSzFile *p, void *data, size_t *size)
return 0; return 0;
#else #else
*size = fread(data, 1, originalSize, p->file); *size = fread(data, 1, originalSize, p->file);
if (*size == originalSize) if (*size == originalSize)
return 0; return 0;
return ferror(p->file); return ferror(p->file);
#endif #endif
} }
@ -136,7 +136,7 @@ WRes File_Write(CSzFile *p, const void *data, size_t *size)
size_t originalSize = *size; size_t originalSize = *size;
if (originalSize == 0) if (originalSize == 0)
return 0; return 0;
#ifdef USE_WINDOWS_FILE #ifdef USE_WINDOWS_FILE
*size = 0; *size = 0;
@ -162,7 +162,7 @@ WRes File_Write(CSzFile *p, const void *data, size_t *size)
if (*size == originalSize) if (*size == originalSize)
return 0; return 0;
return ferror(p->file); return ferror(p->file);
#endif #endif
} }
@ -192,7 +192,7 @@ WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
return 0; return 0;
#else #else
int moveMethod; int moveMethod;
int res; int res;
switch (origin) switch (origin)
@ -205,14 +205,14 @@ WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
res = fseek(p->file, (long)*pos, moveMethod); res = fseek(p->file, (long)*pos, moveMethod);
*pos = ftell(p->file); *pos = ftell(p->file);
return res; return res;
#endif #endif
} }
WRes File_GetLength(CSzFile *p, UInt64 *length) WRes File_GetLength(CSzFile *p, UInt64 *length)
{ {
#ifdef USE_WINDOWS_FILE #ifdef USE_WINDOWS_FILE
DWORD sizeHigh; DWORD sizeHigh;
DWORD sizeLow = GetFileSize(p->handle, &sizeHigh); DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
if (sizeLow == 0xFFFFFFFF) if (sizeLow == 0xFFFFFFFF)
@ -223,15 +223,15 @@ WRes File_GetLength(CSzFile *p, UInt64 *length)
} }
*length = (((UInt64)sizeHigh) << 32) + sizeLow; *length = (((UInt64)sizeHigh) << 32) + sizeLow;
return 0; return 0;
#else #else
long pos = ftell(p->file); long pos = ftell(p->file);
int res = fseek(p->file, 0, SEEK_END); int res = fseek(p->file, 0, SEEK_END);
*length = ftell(p->file); *length = ftell(p->file);
fseek(p->file, pos, SEEK_SET); fseek(p->file, pos, SEEK_SET);
return res; return res;
#endif #endif
} }

View File

@ -39,7 +39,7 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
{ {
if (p->range == 1 && p->code != 0) if (p->range == 1 && p->code != 0)
return SZ_ERROR_DATA; return SZ_ERROR_DATA;
if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC]) if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC])
{ {
p->state = BCJ2_STREAM_RC; p->state = BCJ2_STREAM_RC;
@ -71,7 +71,7 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
{ {
const Byte *cur = p->bufs[p->state]; const Byte *cur = p->bufs[p->state];
if (cur == p->lims[p->state]) if (cur == p->lims[p->state])
return SZ_OK; return SZ_OK;
p->bufs[p->state] = cur + 4; p->bufs[p->state] = cur + 4;
{ {
@ -150,9 +150,9 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
Byte b = *src; Byte b = *src;
*dest = b; *dest = b;
if (b != 0x0F) if (b != 0x0F)
{ {
if ((b & 0xFE) == 0xE8) if ((b & 0xFE) == 0xE8)
break; break;
dest++; dest++;
if (++src != srcLim) if (++src != srcLim)
continue; continue;
@ -181,8 +181,8 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
(unsigned)BCJ2_STREAM_MAIN : (unsigned)BCJ2_STREAM_MAIN :
(unsigned)BCJ2_DEC_STATE_ORIG; (unsigned)BCJ2_DEC_STATE_ORIG;
return SZ_OK; return SZ_OK;
} }
{ {
UInt32 bound, ttt; UInt32 bound, ttt;
CProb *prob; CProb *prob;
@ -194,17 +194,17 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
num++; num++;
p->ip += (UInt32)num; p->ip += (UInt32)num;
p->dest += num; p->dest += num;
prob = p->probs + (unsigned)(b == 0xE8 ? 2 + (unsigned)prev : (b == 0xE9 ? 1 : 0)); prob = p->probs + (unsigned)(b == 0xE8 ? 2 + (unsigned)prev : (b == 0xE9 ? 1 : 0));
_IF_BIT_0 _IF_BIT_0
{ {
_UPDATE_0 _UPDATE_0
continue; continue;
} }
_UPDATE_1 _UPDATE_1
} }
} }
} }
@ -243,8 +243,8 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
SetUi32(dest, val); SetUi32(dest, val);
p->temp[3] = (Byte)(val >> 24); p->temp[3] = (Byte)(val >> 24);
p->dest = dest + 4; p->dest = dest + 4;
}
} }
}
if (p->range < kTopValue && p->bufs[BCJ2_STREAM_RC] != p->lims[BCJ2_STREAM_RC]) if (p->range < kTopValue && p->bufs[BCJ2_STREAM_RC] != p->lims[BCJ2_STREAM_RC])
{ {

View File

@ -6,6 +6,7 @@
#include "LzmaDec.h" #include "LzmaDec.h"
#include <string.h> #include <string.h>
#include <stdio.h>
#define kNumTopBits 24 #define kNumTopBits 24
#define kTopValue ((UInt32)1 << kNumTopBits) #define kTopValue ((UInt32)1 << kNumTopBits)
@ -150,7 +151,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
Byte *dic = p->dic; Byte *dic = p->dic;
SizeT dicBufSize = p->dicBufSize; SizeT dicBufSize = p->dicBufSize;
SizeT dicPos = p->dicPos; SizeT dicPos = p->dicPos;
UInt32 processedPos = p->processedPos; UInt32 processedPos = p->processedPos;
UInt32 checkDicSize = p->checkDicSize; UInt32 checkDicSize = p->checkDicSize;
unsigned len = 0; unsigned len = 0;
@ -174,7 +175,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
prob = probs + Literal; prob = probs + Literal;
if (processedPos != 0 || checkDicSize != 0) if (processedPos != 0 || checkDicSize != 0)
prob += ((UInt32)LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + prob += ((UInt32)LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) +
(dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
processedPos++; processedPos++;
if (state < kNumLitStates) if (state < kNumLitStates)
@ -395,7 +396,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
{ {
NORMALIZE NORMALIZE
range >>= 1; range >>= 1;
{ {
UInt32 t; UInt32 t;
code -= range; code -= range;
@ -439,13 +440,14 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
{ {
if (distance >= processedPos) if (distance >= processedPos)
{ {
p->dicPos = dicPos; printf("%s fail line %d distance %d processedPos %d\n",
__FUNCTION__,__LINE__,distance,processedPos );
return SZ_ERROR_DATA; return SZ_ERROR_DATA;
} }
} }
else if (distance >= checkDicSize) else if (distance >= checkDicSize)
{ {
p->dicPos = dicPos; printf("%s fail line %d\n", __FUNCTION__,__LINE__);
return SZ_ERROR_DATA; return SZ_ERROR_DATA;
} }
state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
@ -461,7 +463,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
if ((rem = limit - dicPos) == 0) if ((rem = limit - dicPos) == 0)
{ {
p->dicPos = dicPos; p->dicPos = dicPos;
return SZ_ERROR_DATA; return SZ_ERROR_DATA;
} }
curLen = ((rem < len) ? (unsigned)rem : len); curLen = ((rem < len) ? (unsigned)rem : len);
@ -600,8 +602,8 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
prob = probs + Literal; prob = probs + Literal;
if (p->checkDicSize != 0 || p->processedPos != 0) if (p->checkDicSize != 0 || p->processedPos != 0)
prob += ((UInt32)LZMA_LIT_SIZE * prob += ((UInt32)LZMA_LIT_SIZE *
((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
(p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
if (state < kNumLitStates) if (state < kNumLitStates)
{ {
@ -806,7 +808,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
SizeT inSize = *srcLen; SizeT inSize = *srcLen;
(*srcLen) = 0; (*srcLen) = 0;
LzmaDec_WriteRem(p, dicLimit); LzmaDec_WriteRem(p, dicLimit);
*status = LZMA_STATUS_NOT_SPECIFIED; *status = LZMA_STATUS_NOT_SPECIFIED;
while (p->remainLen != kMatchSpecLenStart) while (p->remainLen != kMatchSpecLenStart)
@ -857,7 +859,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
if (p->needInitState) if (p->needInitState)
LzmaDec_InitStateReal(p); LzmaDec_InitStateReal(p);
if (p->tempBufSize == 0) if (p->tempBufSize == 0)
{ {
SizeT processed; SizeT processed;
@ -997,12 +999,12 @@ SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
{ {
UInt32 dicSize; UInt32 dicSize;
Byte d; Byte d;
if (size < LZMA_PROPS_SIZE) if (size < LZMA_PROPS_SIZE)
return SZ_ERROR_UNSUPPORTED; return SZ_ERROR_UNSUPPORTED;
else else
dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
if (dicSize < LZMA_DIC_MIN) if (dicSize < LZMA_DIC_MIN)
dicSize = LZMA_DIC_MIN; dicSize = LZMA_DIC_MIN;
p->dicSize = dicSize; p->dicSize = dicSize;

View File

@ -8,7 +8,7 @@ LD = kos32-ld
CPP= kos32-g++ CPP= kos32-g++
STRIP = kos32-strip STRIP = kos32-strip
CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -c -Os -fno-ident -fomit-frame-pointer -mno-ms-bitfields CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -c -Os -fomit-frame-pointer -fno-asynchronous-unwind-tables -fno-ident -fomit-frame-pointer -mno-ms-bitfields
ARFLAG = crs ARFLAG = crs
SDK_DIR:= $(abspath ../../sdk) SDK_DIR:= $(abspath ../../sdk)
@ -17,10 +17,11 @@ LIB_DIR:= $(SDK_DIR)/lib
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include
INCLUDES+=-I$(SDK_DIR)/sources/freetype/include INCLUDES+=-I$(SDK_DIR)/sources/freetype/include
#DEFINES= -DDEBUG=1 #DEFINES= -DDEBUG=1 -D_7ZIP_PPMD_SUPPPORT
DEFINES= -DNDEBUG DEFINES= -DNDEBUG
LIBS:= -liberty -lsupc++ -lgcc_eh -lc.dll -lapp -lgcc
LIBS:= -liberty -lsupc++ -lgcc_eh -lc.dll -lapp -lgcc -lc.dll
LIBPATH:= -L$(LIB_DIR) -L/home/autobuild/tools/win32/mingw32/lib LIBPATH:= -L$(LIB_DIR) -L/home/autobuild/tools/win32/mingw32/lib
@ -51,12 +52,11 @@ SOURCES = http.asm \
7z/Bra86.c \ 7z/Bra86.c \
7z/BraIA64.c \ 7z/BraIA64.c \
7z/7zAlloc.c \ 7z/7zAlloc.c \
7z/Alloc.c \
$(NULL) $(NULL)
OBJECTS = $(patsubst %.asm, %.o, $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SOURCES)))) OBJECTS = $(patsubst %.asm, %.o, $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SOURCES))))
# targets # targets
all:$(NAME) all:$(NAME)
@ -68,7 +68,7 @@ $(NAME): $(OBJECTS) Makefile
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
%.o : %.cpp Makefile %.o : %.cpp Makefile
$(CPP) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< $(CPP) $(CFLAGS) -fno-rtti -fno-exceptions $(DEFINES) $(INCLUDES) -o $@ $<
%.o : %.asm Makefile %.o : %.asm Makefile
$(FASM) $< $@ $(FASM) $< $@

129
contrib/other/kpm/app.lds Normal file
View File

@ -0,0 +1,129 @@
/*OUTPUT_FORMAT("binary")*/
ENTRY(__start)
SECTIONS
{
.text 0x000000:
{
LONG(0x554e454D);
LONG(0x32305445);
LONG(1);
LONG(__start);
LONG(___iend);
LONG(___memsize);
LONG(___stacktop);
LONG(___cmdline);
LONG(___pgmname); /* full path */
LONG(0); /*FIXME tls data */
LONG(__idata_start)
LONG(__idata_end)
LONG(_main)
*(.init)
*(.text)
*(SORT(.text$*))
*(.text.*)
*(.glue_7t)
*(.glue_7)
___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0);
___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0);
*(.fini)
/* ??? Why is .gcc_exc here? */
*(.gcc_exc)
PROVIDE (etext = .);
*(.gcc_except_table)
}
.rdata ALIGN(32) :
{
*(.rdata)
*(SORT(.rdata$*))
___RUNTIME_PSEUDO_RELOC_LIST__ = .;
__RUNTIME_PSEUDO_RELOC_LIST__ = .;
*(.rdata_runtime_pseudo_reloc)
___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
}
.CRT ALIGN(32) :
{
___crt_xc_start__ = . ;
*(SORT(.CRT$XC*)) /* C initialization */
___crt_xc_end__ = . ;
___crt_xi_start__ = . ;
*(SORT(.CRT$XI*)) /* C++ initialization */
___crt_xi_end__ = . ;
___crt_xl_start__ = . ;
*(SORT(.CRT$XL*)) /* TLS callbacks */
/* ___crt_xl_end__ is defined in the TLS Directory support code */
___crt_xp_start__ = . ;
*(SORT(.CRT$XP*)) /* Pre-termination */
___crt_xp_end__ = . ;
___crt_xt_start__ = . ;
*(SORT(.CRT$XT*)) /* Termination */
___crt_xt_end__ = . ;
}
.data ALIGN(32) :
{
PROVIDE ( __data_start__ = .) ;
*(.data)
*(.data2)
*(SORT(.data$*))
*(.jcr)
__CRT_MT = .;
LONG(0);
PROVIDE ( __data_end__ = .) ;
*(.data_cygwin_nocopy)
___iend = . ;
}
.idata ALIGN(32):
{
__idata_start = .;
SORT(*)(.idata$2)
SORT(*)(.idata$3)
/* These zeroes mark the end of the import list. */
LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
SORT(*)(.idata$4)
SORT(*)(.idata$5)
SORT(*)(.idata$6)
SORT(*)(.idata$7)
__idata_end = . ;
}
bss ALIGN(32):
{
*(.bss)
*(COMMON)
. = ALIGN(16);
___cmdline = .;
. = . + 256;
___pgmname = .;
. = . + 1024 + 16;
___stacktop = .;
___memsize = . ;
}
/DISCARD/ :
{
*(.debug$S)
*(.debug$T)
*(.debug$F)
*(.drectve)
*(.note.GNU-stack)
*(.eh_frame)
*(.comment)
*(.debug_abbrev)
*(.debug_info)
*(.debug_line)
*(.debug_frame)
*(.debug_loc)
*(.debug_pubnames)
*(.debug_aranges)
*(.debug_ranges)
}
}

View File

@ -1,75 +1,62 @@
#include "tinyxml/tinyxml.h" #include "tinyxml/tinyxml.h"
#include "package.h" #include "package.h"
// *INDENT-OFF*
const char *key_collection = "collection"; const char *key_collection = "collection";
const char *key_package = "package"; const char *key_package = "package";
const char *key_name = "name"; const char *key_name = "name";
const char *key_version = "version"; const char *key_version = "version";
const char *key_group = "group";
const char *key_description = "description"; const char *key_description = "description";
const char *key_title = "title"; const char *key_title = "title";
const char *key_release = "release"; const char *key_release = "release";
const char *key_file = "file"; const char *key_file = "file";
// *INDENT-ON*
int package_id; int package_id;
void parse_group(pkg_group_t* gr, TiXmlElement *xmlgroup) collection_t *
{ load_collection_file(const char *name)
TiXmlElement *xmlpkg;
TiXmlElement *xmle;
xmlpkg = xmlgroup->FirstChildElement(key_package);
while (xmlpkg)
{
package_t *pkg;
pkg = (package_t*)malloc(sizeof(package_t));
INIT_LIST_HEAD(&pkg->file_list);
pkg->id = package_id++;
pkg->name = strdup(xmlpkg->Attribute(key_name));
pkg->version = strdup(xmlpkg->Attribute(key_version));
xmle = xmlpkg->FirstChildElement(key_description);
pkg->description = strdup(xmle->Attribute(key_title));
xmle = xmlpkg->FirstChildElement(key_release);
pkg->filename = strdup(xmle->Attribute(key_file));
list_add_tail(&pkg->list, &gr->packages);
xmlpkg = xmlpkg->NextSiblingElement();
};
};
collection_t* load_collection_file(const char *name)
{ {
TiXmlDocument doc; TiXmlDocument doc;
TiXmlElement *col; TiXmlElement *col;
collection_t *collection = NULL; collection_t *collection = NULL;
doc.LoadFile(name); doc.LoadFile(name);
col = doc.FirstChildElement(key_collection); col = doc.FirstChildElement(key_collection);
if (col) if (col)
{ {
collection = (collection_t*)malloc(sizeof(collection_t)); TiXmlElement *xmlpkg;
INIT_LIST_HEAD(&collection->groups); TiXmlElement *xmle;
TiXmlElement* xmlgroup = col->FirstChildElement(); collection = (collection_t *) malloc(sizeof(collection_t));
if (xmlgroup) INIT_LIST_HEAD(&collection->packages);
xmlpkg = col->FirstChildElement(key_package);
while (xmlpkg)
{ {
pkg_group_t *gr; package_t *pkg;
gr = (pkg_group_t*)malloc(sizeof(pkg_group_t)); pkg = (package_t *) malloc(sizeof(package_t));
INIT_LIST_HEAD(&gr->list);
INIT_LIST_HEAD(&gr->packages);
gr->name = strdup(xmlgroup->Value()); INIT_LIST_HEAD(&pkg->file_list);
list_add_tail(&gr->list, &collection->groups);
parse_group(gr, xmlgroup); pkg->id = package_id++;
pkg->name = strdup(xmlpkg->Attribute(key_name));
pkg->version = strdup(xmlpkg->Attribute(key_version));
pkg->group = strdup(xmlpkg->Attribute(key_group));
xmle = xmlpkg->FirstChildElement(key_description);
pkg->description = strdup(xmle->Attribute(key_title));
xmle = xmlpkg->FirstChildElement(key_release);
pkg->filename = strdup(xmle->Attribute(key_file));
list_add_tail(&pkg->list, &collection->packages);
xmlpkg = xmlpkg->NextSiblingElement();
}; };
}; };
return collection;
}
return collection;
};

View File

@ -8,9 +8,9 @@
#include "package.h" #include "package.h"
#include "http.h" #include "http.h"
#define BUFFSIZE (64*1024) void process_task(list_t *task);
extern char conbuf[256]; #define BUFFSIZE (64*1024)
#define OPTION_STD_BASE 150 #define OPTION_STD_BASE 150
@ -18,16 +18,40 @@ enum option_values
{ {
OPTION_HELP = OPTION_STD_BASE, OPTION_HELP = OPTION_STD_BASE,
OPTION_LIST_PACKAGES, OPTION_LIST_PACKAGES,
OPTION_LIST_INSTALLED OPTION_LIST_INSTALLED,
OPTION_INSTALL_ALL
}; };
static const struct option longopts[] = static const struct option longopts[] =
{ {
{"list-packages", no_argument, NULL, OPTION_LIST_PACKAGES}, {"list-packages", no_argument, NULL, OPTION_LIST_PACKAGES},
{"list-installed",no_argument, NULL, OPTION_LIST_INSTALLED}, {"list-installed",no_argument, NULL, OPTION_LIST_INSTALLED},
{"install-all",no_argument, NULL, OPTION_INSTALL_ALL},
{NULL,0,NULL,0} {NULL,0,NULL,0}
}; };
static void show_usage ()
{
sprintf (conbuf, "Usage: kpm [option...]\n");
con_write_asciiz(conbuf);
sprintf (conbuf, ("\
Options:\n\
--list-packages\n\
show available packages\n"));
con_write_asciiz(conbuf);
sprintf (conbuf, ("\
--list-installed\n\
show available packages\n"));
con_write_asciiz(conbuf);
sprintf (conbuf, ("\
--install all\n\
install all packages\n"));
con_write_asciiz(conbuf);
};
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
LIST_HEAD(server_list); LIST_HEAD(server_list);
@ -39,6 +63,7 @@ int main(int argc, char *argv[])
int count; int count;
char *cache_path; char *cache_path;
char *tmp_path; char *tmp_path;
int act = 1;
if(http_init()) if(http_init())
goto err_init; goto err_init;
@ -54,62 +79,41 @@ int main(int argc, char *argv[])
if(count) if(count)
build_server_list(&server_list, tmp_path); build_server_list(&server_list, tmp_path);
while(1) while(act)
{ {
int val; int val;
int index; int index;
val = getopt_long_only(argc, argv,"",longopts, &index); val = getopt_long_only(argc, argv,"",longopts, &index);
if(val == -1)
break;
switch(val) switch(val)
{ {
case OPTION_LIST_PACKAGES: case OPTION_LIST_PACKAGES:
sprintf(conbuf,"available packages:\n\n"); sprintf(conbuf,"available packages:\n\n");
con_write_asciiz(conbuf); con_write_asciiz(conbuf);
print_pkg_list(&server_list); print_pkg_list(&server_list);
con_exit(0); act = 0;
return 0; break;
case OPTION_LIST_INSTALLED: case OPTION_LIST_INSTALLED:
sprintf(conbuf,"installed packages:\n\n"); sprintf(conbuf,"installed packages:\n\n");
con_write_asciiz(conbuf); con_write_asciiz(conbuf);
print_pkg_list(&local_list); print_pkg_list(&local_list);
con_exit(0); act = 0;
return 0; break;
case OPTION_INSTALL_ALL:
copy_list(&task_list, &server_list);
process_task(&task_list);
act = 0;
break;
default: default:
break; show_usage();
act = 0;
} }
}; };
#if 0
{
package_t *pkg;
LIST_HEAD(install_list);
LIST_HEAD(download_list);
if(collection && build_install_list(&install_list, collection))
{
if(build_download_list(&download_list, &install_list))
do_download(&download_list);
if(!list_empty(&download_list))
remove_missing_packages(&install_list, &download_list);
list_for_each_entry(pkg, &install_list, list)
{
sprintf(conbuf,"install package %s-%s\n", pkg->name, pkg->version);
con_write_asciiz(conbuf);
};
do_install(&install_list);
};
}
#endif
con_exit(0); con_exit(0);
return 0; return 0;
@ -119,6 +123,3 @@ err_init:
return -1; return -1;
} }

View File

@ -8,17 +8,10 @@ extern "C" {
typedef struct typedef struct
{ {
list_t groups; list_t packages;
char *issue; char *issue;
}collection_t; }collection_t;
typedef struct
{
list_t list;
list_t packages;
char *name;
}pkg_group_t;
typedef struct package typedef struct package
{ {
list_t list; list_t list;
@ -26,6 +19,7 @@ typedef struct package
int id; int id;
char *name; char *name;
char *version; char *version;
char *group;
char *filename; char *filename;
char *description; char *description;
}package_t; }package_t;
@ -35,6 +29,7 @@ static inline void list_del_pkg(package_t *pkg)
list_del(&pkg->list); list_del(&pkg->list);
free(pkg->description); free(pkg->description);
free(pkg->filename); free(pkg->filename);
free(pkg->group);
free(pkg->version); free(pkg->version);
free(pkg->name); free(pkg->name);
free(pkg); free(pkg);
@ -43,8 +38,9 @@ static inline void list_del_pkg(package_t *pkg)
collection_t* load_collection_file(const char *name); collection_t* load_collection_file(const char *name);
collection_t* load_collection_buffer(const char *buffer); collection_t* load_collection_buffer(const char *buffer);
int copy_list(list_t *list, list_t *src);
int build_server_list(list_t *slist, const char *path); int build_server_list(list_t *slist, const char *path);
int build_install_list(list_t *list, collection_t *collection);
int build_download_list(list_t *download, list_t *src); int build_download_list(list_t *download, list_t *src);
void remove_missing_packages(list_t *install, list_t *missed); void remove_missing_packages(list_t *install, list_t *missed);
char *make_cache_path(const char *path); char *make_cache_path(const char *path);
@ -53,6 +49,8 @@ void print_pkg_list(list_t *list);
void do_download(list_t *download); void do_download(list_t *download);
void do_install(list_t *install); void do_install(list_t *install);
extern char conbuf[256];
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -143,6 +143,7 @@ int build_download_list(list_t *download, list_t *src)
pkg->id = tmp->id; pkg->id = tmp->id;
pkg->name = strdup(tmp->name); pkg->name = strdup(tmp->name);
pkg->version = strdup(tmp->version); pkg->version = strdup(tmp->version);
pkg->group = strdup(tmp->group);
pkg->filename = strdup(tmp->filename); pkg->filename = strdup(tmp->filename);
pkg->description = strdup(tmp->description); pkg->description = strdup(tmp->description);
list_add_tail(&pkg->list, download); list_add_tail(&pkg->list, download);
@ -166,6 +167,7 @@ void do_download(list_t *download_list)
count = http_load_file(cache_path, make_url(pkg->filename)); count = http_load_file(cache_path, make_url(pkg->filename));
sprintf(conbuf,"%s %d bytes loaded\n",cache_path, count); sprintf(conbuf,"%s %d bytes loaded\n",cache_path, count);
con_write_asciiz(conbuf); con_write_asciiz(conbuf);
if( !test_archive(cache_path)) if( !test_archive(cache_path))
list_del_pkg(pkg); list_del_pkg(pkg);
else else
@ -192,28 +194,24 @@ void remove_missing_packages(list_t *install, list_t *missed)
}; };
}; };
int build_install_list(list_t *list, collection_t *collection) int copy_list(list_t *list, list_t *src)
{ {
pkg_group_t *gr; package_t *pkg, *tmp;
int count = 0; int count = 0;
list_for_each_entry(gr, &collection->groups, list) list_for_each_entry(tmp, src, list)
{ {
package_t *pkg, *tmp; pkg = (package_t*)malloc(sizeof(package_t));
list_for_each_entry(tmp, &gr->packages, list) INIT_LIST_HEAD(&pkg->file_list);
{ pkg->id = tmp->id;
pkg = (package_t*)malloc(sizeof(package_t)); pkg->name = strdup(tmp->name);
pkg->version = strdup(tmp->version);
INIT_LIST_HEAD(&pkg->file_list); pkg->group = strdup(tmp->group);
pkg->id = tmp->id; pkg->filename = strdup(tmp->filename);
pkg->name = strdup(tmp->name); pkg->description = strdup(tmp->description);
pkg->version = strdup(tmp->version); list_add_tail(&pkg->list, list);
pkg->filename = strdup(tmp->filename); count++;
pkg->description = strdup(tmp->description);
list_add_tail(&pkg->list, list);
count++;
}
}; };
return count; return count;
} }
@ -230,25 +228,21 @@ int build_server_list(list_t *slist, const char *path)
if(collection) if(collection)
{ {
pkg_group_t *gr; package_t *pkg, *tmp;
list_for_each_entry(gr, &collection->groups, list) list_for_each_entry(tmp, &collection->packages, list)
{ {
package_t *pkg, *tmp; pkg = (package_t*)malloc(sizeof(package_t));
list_for_each_entry(tmp, &gr->packages, list) INIT_LIST_HEAD(&pkg->file_list);
{ pkg->id = tmp->id;
pkg = (package_t*)malloc(sizeof(package_t)); pkg->name = strdup(tmp->name);
pkg->version = strdup(tmp->version);
INIT_LIST_HEAD(&pkg->file_list); pkg->group = strdup(tmp->group);
pkg->id = tmp->id; pkg->filename = strdup(tmp->filename);
pkg->name = strdup(tmp->name); pkg->description = strdup(tmp->description);
pkg->version = strdup(tmp->version); list_add_tail(&pkg->list, slist);
pkg->filename = strdup(tmp->filename); count++;
pkg->description = strdup(tmp->description);
list_add_tail(&pkg->list, slist);
count++;
}
}; };
}; };
return count; return count;
@ -260,7 +254,20 @@ void print_pkg_list(list_t *list)
list_for_each_entry(pkg, list, list) list_for_each_entry(pkg, list, list)
{ {
sprintf(conbuf,"%s-%s\n", pkg->name, pkg->version); sprintf(conbuf,"%s-%s-%s\n", pkg->name, pkg->version, pkg->group);
con_write_asciiz(conbuf); con_write_asciiz(conbuf);
} }
} }
void process_task(list_t *task)
{
LIST_HEAD(download_list);
if(build_download_list(&download_list, task))
do_download(&download_list);
if(!list_empty(&download_list))
remove_missing_packages(task, &download_list);
do_install(task);
}