Changeset 1093


Ignore:
Timestamp:
Sep 15, 2011, 8:18:15 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

packaging: CreateZIPs: Change to using the @unixroot layout.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • packaging/CreateZIPs.sh

    r1060 r1093  
    1212#
    1313
    14 out_dir="tmp-zip"
     14out_dir="."
    1515
    1616cp="cp -Rdp"
     
    3434    local out_base="$2" # output directory base
    3535    local path="$3"     # file path relative to $src_base, may be glob
    36     local exclude="$4"  # exclude pattern (relative to $src_base),
     36    local tgt_path="$4" # target path if differs from path, if ends with slash
     37                        # only the dir part of path is changed
     38                        # [optional]
     39    local exclude="$5"  # exclude pattern (relative to $src_base),
    3740                        # case syntax [optional]
    38     local ext="$5"      # additional extension of $path base to copy (e.g. .sym)
    39                         # [optional
     41    local ext="$6"      # additional extension of $path base to copy (e.g. .sym)
     42                        # [optional]
    4043
    4144    [ -z "$src_base" -o -z "$out_base" -o -z "$path" ] && \
    4245        die "cp_files: invalid arguments."
    4346
    44     local path_dir="${path%/*}/"
    45     [ "$path_dir" = "$path/" ] && path_dir=
    46 
    47     [ -d "$out_base/$path_dir" ] || run mkdir -p "$out_base/$path_dir"
     47    local path_dir="${path%/*}"
     48    [ "$path_dir" = "$path" ] && path_dir=.
     49    local path_file="${path##*/}"
     50
     51    if [ -n "$tgt_path" ]; then
     52        local tgt_path_dir="${tgt_path%/*}"
     53        [ "$tgt_path_dir" = "$tgt_path" ] && path_dir=.
     54        local tgt_path_file="${tgt_path##*/}"
     55        [ -z "$tgt_path_file" ] && tgt_path_file="$path_file"
     56    else
     57        local tgt_path_dir="$path_dir"
     58        local tgt_path_file="$path_file"
     59    fi
     60
     61    [ -d "$out_base/$tgt_path_dir" ] || run mkdir -p "$out_base/$tgt_path_dir"
     62
     63    # if path_file is a mask, reset tgt_path_file (to cp to just tgt_path_dir)
     64    case "$path_file" in
     65        *"*"*|*"?"*) tgt_path_file=;;
     66    esac
    4867
    4968    # simple case?
    5069    if [ -z "$exclude" -a -z "$ext" ]; then
    51         run $cp "$src_base/$path" "$out_base/$path_dir"
     70        run $cp "$src_base/$path" "$out_base/$tgt_path_dir/$tgt_path_file"
    5271        return
    5372    fi
     
    5776        [ -z "$exclude" ] || \
    5877            eval "case ${f#$src_base/} in $exclude) continue;; esac"
    59         run $cp "$f" "$out_base/$path_dir"
    60         [ -z "$ext" ] || run $cp "${f%.*}.$ext" "$out_base/$path_dir"
     78        run $cp "$f" "$out_base/$tgt_path_dir/"
     79        [ -z "$ext" ] || run $cp "${f%.*}.$ext" "$out_base/$tgt_path_dir/"
    6180    done
    6281}
    6382
    64 cp_files_inst_out() cp_files "$inst_base" "$out_base" "$1" "$2" "$3"
    65 
    66 cp_exe_files_inst_out() cp_files "$inst_base" "$out_base" "$1" "$2" "sym"
    67 
    68 cmd_cleanup()
    69 {
    70     [ -d "$out_dir" ] && \
    71         run rm -rf "$out_dir"
    72 }
     83cp_files_inst_out() cp_files "$inst_base" "$out_base" "$1" "$2" "$3" "$4"
     84
     85cp_exe_files_inst_out() cp_files "$inst_base" "$out_base" "$1" "$2" "$3" "sym"
    7386
    7487split_out_sym()
     
    8497    for f in $(cd "$out_base" && find -type f -name "*.sym"); do
    8598        local fd="${f%/*}"/
    86         [ "$fp" = "$f/" ] && fd=
     99        [ "$fd" = "$f/" ] && fd=
    87100        [ -d "$out_base_sym/$fd" ] || run mkdir -p "$out_base_sym/$fd"
    88101        run mv "$out_base/$f" "$out_base_sym/$fd"
     
    92105}
    93106
     107parse_version()
     108{
     109    local spec_file="$start_dir/qt4.spec"
     110
     111    # get the version info from .spec
     112    ver_major=$(sed -nre \
     113        "s/^%define ver_major[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file")
     114    ver_minor=$(sed -nre \
     115        "s/^%define ver_minor[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file")
     116    ver_patch=$(sed -nre \
     117        "s/^%define ver_patch[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file")
     118    os2_release=$(sed -nre \
     119        "s/^%define os2_release[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file")
     120    rpm_release=$(sed -nre \
     121        "s/^%define rpm_release[[:space:]]+([0-9]+).*$/\1/p" < "$spec_file")
     122
     123    [ -z "$ver_major" -o -z "$ver_minor" -o -z "$ver_patch" -o \
     124      -z "$os2_release" -o -z "$rpm_release" ] && \
     125        die "Could not determine version number in '$spec_file'."
     126
     127    ver_full_spec="$ver_major.$ver_minor.$ver_patch"
     128    [ "$os2_release" != "0" ] && ver_full_spec="ver_full_spec.$os2_release"
     129    ver_full_spec="$ver_full_spec-$rpm_release"
     130
     131    ver_full="$ver_full_spec"
     132    [ -n "$build_num" ] && ver_full="${ver_full}_${build_num}"
     133}
     134
     135cmd_cleanup()
     136{
     137    parse_version
     138    [ -z "$ver_full" ] && die "Version is not defined."
     139
     140    [ -d "$out_dir/$ver_full" ] && \
     141        run rm -rf "$out_dir/$ver_full"
     142}
     143
    94144create_zips()
    95145{
     
    98148        die "create_zips: invalid arguments."
    99149
    100     local out_base_sym="$out_dir/$full_pkg_name-debuginfo/$pkg_name-$ver_dots"
     150    local out_base_sym="$out_dir/$full_pkg_name-debuginfo/$pkg_name-$ver_full"
    101151
    102152    # .SYM files
     
    106156
    107157    run cd "$out_base/.."
    108     run zip -SrX9 "$full_pkg_name-$ver_dots.zip" "$pkg_name-$ver_dots"
    109     run mv "$full_pkg_name-$ver_dots.zip" "$start_dir/"
     158    run zip -SrX9 "$full_pkg_name-$ver_full.zip" "$pkg_name-$ver_full"
     159    run mv "$full_pkg_name-$ver_full.zip" "$out_dir/.."
    110160
    111161    run cd "$out_base_sym/.."
    112     run zip -SrX9 "$full_pkg_name-debuginfo-$ver_dots.zip" "$pkg_name-$ver_dots"
    113     run mv "$full_pkg_name-debuginfo-$ver_dots.zip" "$start_dir/"
     162    run zip -SrX9 "$full_pkg_name-debuginfo-$ver_full.zip" "$pkg_name-$ver_full"
     163    run mv "$full_pkg_name-debuginfo-$ver_full.zip" "$out_dir/.."
    114164
    115165    run cd "$cwd"
     
    119169{
    120170    local inst_base="$1"
    121     local build_num="$2"
     171    local out_dir="$2"
     172    local build_num="$3"
    122173
    123174    [ -d "$inst_base" ] || die "'$inst_base' is not a directory."
    124 
    125     local qconfig_pri="$inst_base/mkspecs/qconfig.pri"
    126 
    127     [ -f "$qconfig_pri" ] || \
    128         die "Could not find file '$qconfig_pri'."
    129 
    130     local ver_major=$(sed -nre \
    131         "s/^[[:space:]]*QT_MAJOR_VERSION[[:space:]]+=[[:space:]]+([0-9]+)[[:space:]]*$/\1/p" < "$qconfig_pri")
    132     local ver_minor=$(sed -nre \
    133         "s/^[[:space:]]*QT_MINOR_VERSION[[:space:]]+=[[:space:]]+([0-9]+)[[:space:]]*$/\1/p" < "$qconfig_pri")
    134     local ver_patch=$(sed -nre \
    135         "s/^[[:space:]]*QT_PATCH_VERSION[[:space:]]+=[[:space:]]+([0-9]+)[[:space:]]*$/\1/p" < "$qconfig_pri")
    136 
    137     [ -z "$ver_major" -o -z "$ver_minor" -o -z "$ver_patch" ] && \
    138         die "Could not determine Qt version number in '$qconfig_pri'."
    139 
    140     local ver_dots="$ver_major.$ver_minor.$ver_patch"
    141 
    142     echo "Found Qt version: $ver_dots"
    143 
    144     [ -n "$build_num" ] && ver_dots="$ver_dots-$build_num"
    145 
    146     echo "Full version ID:  $ver_dots"
     175    [ -d "$out_dir" ] || die "'$out_dir' is not a directory."
     176
     177    parse_version
     178    [ -z "$ver_full" ] && die "Version is not defined."
     179
     180    echo "Spec version: $ver_full_spec"
     181    echo "Full version: $ver_full"
     182
     183    out_dir="$out_dir/tmp-zip-qt4-$ver_full"
    147184
    148185    cmd_cleanup
     
    152189    #--------------------------------------------------------------------------
    153190
    154     local pkg_name="qt"
    155 
    156     local designer_dlls="bin/QtDsg*.dll"
    157     local designer_plugin_dirs="designer|qmltooling"
     191    local pkg_name="qt4"
     192
     193    local designer_dlls="QtDsg*.dll"
     194    local designer_plugin_dirs="designer"
     195
     196    usr="@unixroot/usr"
    158197
    159198    #--------------------------------------------------------------------------
     
    161200    #--------------------------------------------------------------------------
    162201
    163     local full_pkg_name="qt"
    164     local out_base="$out_dir/$full_pkg_name/$pkg_name-$ver_dots"
     202    local full_pkg_name="qt4"
     203    local out_base="$out_dir/$full_pkg_name/$pkg_name-$ver_full"
    165204
    166205    # Readmes
    167     cp_files_inst_out "LGPL_EXCEPTION.txt"
    168     cp_files_inst_out "LICENSE.*"
    169     cp_files_inst_out "README"
    170     cp_files_inst_out "changes-$ver_major.$ver_minor.$ver_patch"
    171     cp_files_inst_out "README.OS2"
    172     cp_files_inst_out "CHANGES.OS2"
     206    cp_files_inst_out "$usr/share/doc/qt4/LGPL_EXCEPTION.txt" "./"
     207    cp_files_inst_out "$usr/share/doc/qt4/LICENSE.*" "./"
     208    cp_files_inst_out "$usr/share/doc/qt4/README" "./"
     209    cp_files_inst_out "$usr/share/doc/qt4/changes-$ver_major.$ver_minor.$ver_patch" "./"
     210    cp_files_inst_out "$usr/share/doc/qt4/README.OS2" "./"
     211    cp_files_inst_out "$usr/share/doc/qt4/CHANGES.OS2" "./"
    173212    run $cp "$script_dir/INSTALL.OS2" "$out_base/"
    174213
    175214    # DLLs
    176     cp_exe_files_inst_out "bin/Qt*.dll" "$designer_dlls"
     215    cp_exe_files_inst_out "$usr/lib/Qt*.dll" "bin/" "$usr/lib/$designer_dlls"
    177216
    178217    # Imports
    179     cp_files_inst_out "imports"
     218    cp_files_inst_out "$usr/lib/qt4/imports" "./"
    180219
    181220    # Plugins
    182     for d in $inst_base/plugins/*; do
     221    for d in $inst_base/$usr/lib/qt4/plugins/*; do
    183222        local dn=${d##*/}
    184223        eval "case $dn in $designer_plugin_dirs) continue;; esac"
    185         cp_exe_files_inst_out "plugins/$dn/*.dll"
     224        cp_exe_files_inst_out "$usr/lib/qt4/plugins/$dn/*.dll" "plugins/$dn/"
    186225    done
    187226
    188227    # Translations
    189     cp_files_inst_out "translations/qt_*"
    190     cp_files_inst_out "translations/qt_help_*"
    191     cp_files_inst_out "translations/qtconfig_*"
     228    cp_files_inst_out "$usr/share/qt4/translations/qt_??.qm" "translations/"
     229    cp_files_inst_out "$usr/share/qt4/translations/qt_??_??.qm" "translations/"
     230    cp_files_inst_out "$usr/share/qt4/translations/qt_help_??.qm" "translations/"
     231    cp_files_inst_out "$usr/share/qt4/translations/qt_help_??_??.qm" "translations/"
    192232
    193233    # qt.conf
     
    206246    #--------------------------------------------------------------------------
    207247
    208     local full_pkg_name="qt-develop"
    209     local out_base="$out_dir/$full_pkg_name/$pkg_name-$ver_dots"
     248    local full_pkg_name="qt4-devel-kit"
     249    local out_base="$out_dir/$full_pkg_name/$pkg_name-$ver_full"
    210250
    211251    # Readmes
    212     cp_files_inst_out "LGPL_EXCEPTION.txt"
    213     cp_files_inst_out "LICENSE.*"
    214     cp_files_inst_out "README"
    215     cp_files_inst_out "changes-$ver_major.$ver_minor.$ver_patch"
    216     cp_files_inst_out "README.OS2"
    217     cp_files_inst_out "CHANGES.OS2"
     252    cp_files_inst_out "$usr/share/doc/qt4/LGPL_EXCEPTION.txt" "./"
     253    cp_files_inst_out "$usr/share/doc/qt4/LICENSE.*" "./"
     254    cp_files_inst_out "$usr/share/doc/qt4/README" "./"
     255    cp_files_inst_out "$usr/share/doc/qt4/changes-$ver_major.$ver_minor.$ver_patch" "./"
     256    cp_files_inst_out "$usr/share/doc/qt4/README.OS2" "./"
     257    cp_files_inst_out "$usr/share/doc/qt4/CHANGES.OS2" "./"
    218258    run $cp "$script_dir/INSTALL.OS2.develop" "$out_base/"
    219259
    220260    # EXEs & DLLs
    221     cp_exe_files_inst_out "bin/*.exe"
    222     cp_exe_files_inst_out "$designer_dlls"
     261    cp_exe_files_inst_out "$usr/lib/qt4/bin/*.exe" "bin/" "$usr/lib/qt4/bin/qmake.exe"
     262    cp_exe_files_inst_out "$usr/bin/*.exe" "bin/"
     263    cp_exe_files_inst_out "$usr/lib/$designer_dlls" "bin/"
    223264
    224265    # Demos
    225     cp_files_inst_out "demos"
     266    cp_files_inst_out "$usr/lib/qt4/demos" "./"
    226267
    227268    # Doc (no html, qch only)
    228     cp_files_inst_out "doc/qch"
    229     cp_files_inst_out "q3porting.xml"
     269    cp_files_inst_out "$usr/share/qt4/doc/qch" "doc/"
     270    cp_files_inst_out "$usr/share/qt4/q3porting.xml" "./"
    230271
    231272    # Examples
    232     cp_files_inst_out "examples"
     273    cp_files_inst_out "$usr/lib/qt4/examples" "./"
    233274
    234275    # Includes
    235     cp_files_inst_out "include"
     276    cp_files_inst_out "$usr/include" "./"
    236277
    237278    # Libraries
    238     cp_files_inst_out "lib/*.prl"
    239     cp_files_inst_out "lib/*.lib"
     279    cp_files_inst_out "$usr/lib/Qt*.prl" "lib/"
     280    cp_files_inst_out "$usr/lib/Qt*.lib" "lib/"
    240281
    241282    # Mkspecs
    242     cp_files_inst_out "mkspecs"
     283    cp_files_inst_out "$usr/share/qt4/mkspecs" "./"
    243284
    244285    # Phrasebooks
    245     cp_files_inst_out "phrasebooks"
     286    cp_files_inst_out "$usr/share/qt4/phrasebooks" "./"
    246287
    247288    # Plugins
    248     for d in $inst_base/plugins/*; do
     289    for d in $inst_base/$usr/lib/qt4/plugins/*; do
    249290        local dn=${d##*/}
    250291        eval "case $dn in $designer_plugin_dirs) ;; *) continue;; esac"
    251         cp_exe_files_inst_out "plugins/$dn/*.dll"
     292        cp_exe_files_inst_out "$usr/lib/qt4/plugins/$dn/*.dll" "plugins/$dn/"
    252293    done
    253294
    254295    # Translations
    255     cp_files_inst_out "translations/assistant_*"
    256     cp_files_inst_out "translations/designer_*"
    257     cp_files_inst_out "translations/linguist_*"
     296    cp_files_inst_out "$usr/share/qt4/translations/assistant_??.qm" "translations/"
     297    cp_files_inst_out "$usr/share/qt4/translations/assistant_??_??.qm" "translations/"
     298    cp_files_inst_out "$usr/share/qt4/translations/designer_??.qm" "translations/"
     299    cp_files_inst_out "$usr/share/qt4/translations/designer_??_??.qm" "translations/"
     300    cp_files_inst_out "$usr/share/qt4/translations/linguist_??.qm" "translations/"
     301    cp_files_inst_out "$usr/share/qt4/translations/linguist_??_??.qm" "translations/"
    258302
    259303    create_zips
     
    289333Options:
    290334  <instdir>     (*) Qt installation tree location
     335  <outdir>          Destination directory for ZIPs [$out_dir]
    291336  <bldnum>          Build number [none]
    292337"
     
    297342    all)
    298343        if [ -n "$2" ]; then
    299             cmd_create $(echo "$2" | tr '\\' '/') "$3"
     344            [ -n "$3" ] && out_dir=$(echo "$3" | tr '\\' '/')
     345            cmd_create $(echo "$2" | tr '\\' '/') "$out_dir" "$4"
    300346        else
    301347            cmd_help
Note: See TracChangeset for help on using the changeset viewer.