[pacman-dev] [PATCH] makepkg: add --allsource option

Dan McGee dpmcgee at gmail.com
Mon Jun 2 12:26:58 EDT 2008


On Mon, Jun 2, 2008 at 10:56 AM, Allan McRae <mcrae_allan at hotmail.com> wrote:
> Dan McGee wrote:
>> On Mon, Jun 2, 2008 at 9:56 AM, Allan McRae <mcrae_allan at hotmail.com> wrote:
>>
>>> Dan McGee wrote:
>>>
>>>> <snip>
>>>> +     local netfile
>>>> +     for netfile in ${source[@]}; do
>>>> +             local file=$(strip_url "$netfile")
>>>> +             if [ -f $netfile ]; then
>>>> +                     msg2 "$(gettext "Adding %s...")" "$netfile"
>>>> +                     comp_files="$comp_files $netfile"
>>>> +             elif [ "$SOURCEONLY" = "2" -a -f "$srcdir/$file" ]; then
>>>> +                     msg2 "$(gettext "Adding %s...")" "$file"
>>>> +                     comp_files="$comp_files -C $srcdir $file"
>>>>
>>>>
>>> I'm a little confused here.  The file $srcdir/$file is just a link to
>>> $SRCDEST/$file which may be $startdir/$file.  So does this not just add
>>> the symbolic link to the tarball.  Also, the -C option flags all
>>> following files to be from the $srcdir directory.  So, anything added
>>> after this will also get its symbolic link added.
>>>
>>> If I'm not going down the wrong track here, this should fix it...
>>>
>>
>> Yeah, this wasn't tested super hard or anything so I think you are on
>> to something here. The -C option is definitely a bit odd but it kind
>> of does what we want. Since all files are available in src/ (although
>> some might be symlinks), can't we use 1 -C flag in combination with -H
>> to follow symlinks to our source files?
>>
>
> The files are not in src/ if the --source was used so we have to be
> careful there.
>
>> While we are making changes, can you see an easy way to get everything
>> under a pkgname/ dir (maybe with pkgver-pkgrel too) inside the
>> tarball? Unfortunately bsdtar has no --prefix option to easily do
>> this, and our friend Loui says it is doable but has not offered a line
>> of code.
>>
>>
>
> How about:
> - Make directory of form pkgname-pkgver-pkgrel in a temporary directory
> - Instead of collecting files in "comp_files", just place links into
> that directory.
> - Use bsdtar with -L flag on that directory.
> - Clean up
>
> I think that is along the lines of what Loui was suggesting. It also
> removes the whole -C issue without adding any further SOURCEONLY=2 checks.

Yeah, I think I like this idea. Feel free to rip my patch apart. :)

We might want to take a closer look at how this is all done as the
original --source patch was written quickly, and the --allsource
option above was kind of jury-rigged in. I did like the fact that if
we download all sources we can verify the checksums- perhaps we can
still find a way to check md5sums for the local-only source as well
before we package it up in an src.tar.gz? We should be able to do some
kind of similar action:
for file in source:
    if netfile && allsource then verify md5sum
    if localfile then verify md5sum

Maybe add a flag or something to the checksum function to determine
whether to check netfiles or not.

Wow, this patch is going to turn into a sequence of 5.

-Dan




More information about the pacman-dev mailing list