Re[2]: SVN migration
Nikita <write_to_zig-JGs/[email protected]> Tue, 28 Feb 2006 09:02:54 +0200
| Newsgroups | gmane.comp.java.jrpm.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello Michael,
MK> Do you have example rpms for the Header.java issue and the RPMLead.java
MK> issue. Than I can fix against them.
I had problem reading /var/lib/rpm/Packages database that contains
header information of installed packages. There are some unused space
between header entries. You can't just read the next entry after
reading previous. You have to skip some bytes to reach offset of the
next entry.
I have changed following lines of code in RPMHeader.java from line 140:
dataObject = TypeFactory.createFromStream(inputStream, index,
(i < (indexes.length - 1)) ? (indexes[i + 1].getOffset() - index.getOffset()) :
(indexDataSize - index.getOffset()));
// adjust size
size += dataObject.getSize();
to:
long sizeToRead;
if (i < (indexes.length - 1))
{
sizeToRead=(indexes[i + 1].getOffset() - index.getOffset());
}
else
{
sizeToRead=(indexDataSize - index.getOffset());
}
dataObject = TypeFactory.createFromStream(inputStream, index, sizeToRead);
// adjust size
if (dataObject.getSize()<sizeToRead)
{
inputStream.skip(sizeToRead-dataObject.getSize());
}
size+=sizeToRead;
And this worked for me.
As for RPMLead.java issue just take a look at this code:
// Ignore os and arch for source rpms
if (!type.equals(LeadType.SOURCE)) {
check(!os.equals(LeadOS.UNKNOWN));
check(!arch.equals(LeadArchitecture.UNKNOWN));
}
If I understood correctly the line should not have "!" in condition:
// Ignore os and arch for source rpms
if (type.equals(LeadType.SOURCE)) {
check(!os.equals(LeadOS.UNKNOWN));
check(!arch.equals(LeadArchitecture.UNKNOWN));
}
Without this change you are not able to read any *-noarch.rpm
MK> Also if we can improve logging I am happy with input about that.
I meant that I removed all logging code to increase speed, but it
appeared to be enough just to turn logging off:
Logger.getRootLogger().setLevel(Level.OFF);
:)
>>
>> Needed changes:
>> CHAR.java - read 1 byte as char instead of two
>> Header.java - skip wholes between header entries (there are some)
>> RPMHeader.java, RPMSignature.java: "enum" -> "enumeration" as "enum"
>> is a keyword in java 1.5.
>> RPMLead.java "unknown" type should be passes as it is "noarch"
>>
>> Also a patch by Paul Nasrat that skips magic bytes in header should be
>> applied.
>>
>>
>> jrpm(original) reads installable Opera rpms with exception.
>> opera-7.54-20040803.4-shared-qt.i386-en.rpm and
>> opera-7.21-20031013.4-shared-qt.i386.rpm
>> java.lang.NullPointerException at
>> com.jguild.jrpm.io.RPMFile.readFromStream(RPMFile.java:281) at
>> com.jguild.jrpm.io.RPMFile.<init>(RPMFile.java:47) at
>>
>> Monday, February 27, 2006, 1:21:19 PM, you wrote:
>>
>> YM> Sourceforge finally has released the SVN support :D
>>
>> YM> I'm now in process of migrating the code to the SVN repository :)
>>
>> YM> Also, since the library is stable, and although it doesn't do everything
>> YM> we would have wanted to add to it, it does do the basic functionality, i
>> YM> was thinking of making a 1.0 release with that functionality, rather
>> YM> than leave it beta for several more years, what do you guys think ?
--
Nikita
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642