You are not logged in.

#1 2018-09-09 17:26:43

dviktor
Member
From: Moscow
Registered: 2015-10-18
Posts: 162

[SOLVED] The order of source extraction in PKGBUILD

Hi all!

I haven't found any info on whether the source archives are extracted in the same order as they are listed in the PKGBUILD. In my own PKGBUILD I need to be sure that file1.tar.gz is downloaded and extracted (or simply extracted as it should be local) before the file2.tar.gz. I know that I can use noextract array for the file2.tar.gz and extract it later in the prepare() function but I wonder if there any standard for the extraction order or similar.

Last edited by dviktor (2018-09-09 19:10:41)

Offline

#2 2018-09-09 17:30:35

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: [SOLVED] The order of source extraction in PKGBUILD

Is this because both archives contain the same file?

Offline

#3 2018-09-09 17:47:42

dviktor
Member
From: Moscow
Registered: 2015-10-18
Posts: 162

Re: [SOLVED] The order of source extraction in PKGBUILD

The software that I need to install consists of two archives. Every archive contains almost the same directory structure and some files are overlaps but the second file is the kind of "update" in comparison with the first file so it should be extracted after it

Last edited by dviktor (2018-09-09 17:47:57)

Offline

#4 2018-09-09 18:48:55

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: [SOLVED] The order of source extraction in PKGBUILD

You can see from /usr/share/makepkg/source.sh the current implementation.  The man page for PKGBUILD does not specify the order sources will be extracted.
So if you are being cautious I would suggest using noextract for the second archive as you already noted.

Offline

#5 2018-09-09 19:07:42

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] The order of source extraction in PKGBUILD

As loqs said, we don't officially support any sort of order at all. However, the implementation-defined behavior should coincidentally be "iterate over files in the order they are listed in source=()", so if you want to rely on this, we *most likely* won't break it.

I guess each release you can check the file loqs mentioned to see if we do though. big_smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2018-09-09 19:10:30

dviktor
Member
From: Moscow
Registered: 2015-10-18
Posts: 162

Re: [SOLVED] The order of source extraction in PKGBUILD

Seems like files are extracted in corresponding order:

extract_sources() {
    msg "$(gettext "Extracting sources...")"
    local netfile all_sources

    get_all_sources_for_arch 'all_sources'
    for netfile in "${all_sources[@]}"; do
        local file=$(get_filename "$netfile")
        local proto=$(get_protocol "$netfile")
        case "$proto" in
            bzr*)
                extract_bzr "$netfile"
                ;;
            git*)
                extract_git "$netfile"
                ;;
            hg*)
                extract_hg "$netfile"
                ;;
            svn*)
                extract_svn "$netfile"
                ;;
            *)
                extract_file "$file"
                ;;
        esac
    done
}

So it should be safe. Thank you!

Offline

Board footer

Powered by FluxBB