Hi Shiv,

On Sun, 2007-07-29 at 09:35 +0530, S h i v wrote:
> Couple of minor issues I noticed with pkgbuild:
> 
> I used SFEbluefish.spec and modified the Version to 1.1.0
> 
> Bug #1] Minor one and wouldn't really consider a bug, nevertheless
> minor improvement is possible
> Source:
> http://www.bennewitz.com/bluefish/stable/source/bluefish-%{version}.tar.bz2
> The location of V1.1.0 tarball was different from the stable
> releases. 
> But wget (incorrectly)succeeded in getting bluefish-1.1.0.tar.bz2.
> This was actually a html page served by apache saying 
> "The document you requested is not found on the server but there are
> other similar ones" 
> This html got saved as the bluefish-1.1.0.tar.bz2
> 
> Possible solution: The below command maybe used (either before copying
> the file from SOURCES dir or after a failed bunzip2)
> Command "file bluefish-1.1.0.tar.bz2 " returns
> "bluefish-1.1.0.tar.bz2: html document"

pkgtool relies on wget's exit status.  If it return 0, it assumes
that the download was successful.
One possible improvement in this area is storing the expected tarball
checksum in the spec file and comparing it with the downloaded sources.

> Command "file bluefish-1.1.0.tar.bz2.1" returns
> "bluefish-1.1.0.tar.bz2.1: bzip2 compressed data , block size = 900k"

Now this is a bug, it shouldn't create a .1 file.

> Bug #2] This is a bug 
> A side effect of bypassing source download if SOURCES dir already
> contains the tarball.
> I corrected the URL
> http://www.bennewitz.com/bluefish/devel/source/bluefish-%{version}.tar.bz2
> Since SOURCES directory contained the incorrect tarball, the correct
> one did not get downloaded from the modified url.
> Manually removed incorrect tarball from SOURCES directory and tried
> "pkgtool --download build-only SFEbluefish.spec"
> 
> The source tarball got download as bluefish-1.1.0.tar.bz2.1 since
> bluefish-1.1.0.tar.bz2 already existed in the download_to dir.
> (due to the -nd option given to wget)
> But what got copied to SOURCES dir was the erroneous
> bluefish-1.1.0.tar.bz2 and again pkgbuild failed although the correct
> source was available in download_to dir (with the name
> bluefish-1.1.0.tar.bz2.1)
> 
> Possible solution #1:
> pkgbuild checks SOURCES dir and decides to download if tarball not
> present 
> Now, checks the download_to dir, if file exists renames it to
> foo.tar.bz2.<n> (put this entry in the log)
> Starts download using wget and uses the name foo.tar.bz2 and proceeds
> the normal way
> 
> Possible solution #2: 
> pkgbuild downloads the file using wget
> pkgbuild parses the wget output and recognizes the file downloaded as
> foo.tar.bz2.<n>
> pkgbuild copies foo.tar.bz2.<n> as foo.tar.bz2 into SOURCES dir and
> proceeds the normal way 

Hmm... the way it's expected to work is:

1) if the tarball is not found in the tarball search path then
   download it (if enabled using --download)
2) the the tarball is found in the tarball search path then copy
   it to SOURCES and assume that it's correct

Now, if you tarball is corrupted and you delete it from the tarball
search path, then it'll download it again and will compare it with
the one in SOURCES.  If they are different, then it'll copy the newly
downloaded tarball to SOURCES.

Does this make sense?

Laca



Reply via email to