~m-grant-prg/obs-utils/trunk

« back to all changes in this revision

Viewing changes to src/prg/bash/oscbuilder.sh.in

  • Committer: Mark Grant
  • Date: 2022-08-05 08:11:34 UTC
  • mfrom: (0.1.4)
  • Revision ID: m.grant.prg@gmail.com-20220805081134-k7yxnobv8ge45p6u
Merge new upstream development release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
#                               may not be a standard format.           #
66
66
#                               Move release format processing to the   #
67
67
#                               spec file.                              #
 
68
# 01/08/2022    MG      1.0.3   Correct built-pkgs path.                #
 
69
# 04/08/2022    MG      1.0.4   Add config file with a base output dir  #
 
70
#                               entry.                                  #
68
71
#                                                                       #
69
72
#########################################################################
70
73
 
77
80
##################
78
81
readonly outputprefix="$(basename $0):"
79
82
 
80
 
readonly version=1.0.2                          # Script version
 
83
readonly version=1.0.4                          # Script version
81
84
readonly packageversion=@pkgversion@            # Package version
82
85
 
83
86
arch="x86_64"                                   # Default architecture
 
87
base_output_dir=""
84
88
cla=""
 
89
readonly conffile=@sysconfdir@/obs-utils.conf
85
90
repo=""
86
91
 
87
92
 
156
161
trap trap_exit SIGHUP SIGINT SIGQUIT SIGTERM
157
162
 
158
163
 
 
164
# Process config file.
 
165
# No parameters.
 
166
# No return value.
 
167
proc_config_file()
 
168
{
 
169
        local old_IFS
 
170
        local read_base_output_dir
 
171
 
 
172
        if [[ ! -f $conffile ]]; then
 
173
                output "Config file $conffile does not exist." 1
 
174
                script_exit 77
 
175
        fi
 
176
        if [[ ! -r $conffile ]]; then
 
177
                output "Incorrect permissions for config file $conffile." 1
 
178
                script_exit 77
 
179
        fi
 
180
 
 
181
        old_IFS=$IFS
 
182
        IFS="="
 
183
        exec 3<$conffile
 
184
        while read -u3 -ra input; do
 
185
                # Discard comment lines.
 
186
                [[ "${input[0]}" =~ ^[[:blank:]]*# ]] && continue
 
187
                case ${input[0]} in
 
188
                base_output_dir)
 
189
                        read_base_output_dir=${input[1]}
 
190
                        ;;
 
191
                esac
 
192
        done
 
193
        exec 3<&-
 
194
        IFS=$old_IFS
 
195
 
 
196
        if [[ "${read_base_output_dir:0:1}" == "~" ]]; then
 
197
                base_output_dir="${HOME}${read_base_output_dir:1}"
 
198
        else
 
199
                base_output_dir="${read_base_output_dir}"
 
200
        fi
 
201
 
 
202
        if [[ ! -d $base_output_dir ]]; then
 
203
                output "Config file output dir not a directory." 1
 
204
                script_exit 77
 
205
        fi
 
206
        if [[ ! -r $base_output_dir ]]; then
 
207
                output "Incorrect permissions for base output directory." 1
 
208
                script_exit 77
 
209
        fi
 
210
}
 
211
 
159
212
# Process command line arguments with GNU getopt.
160
213
# Parameters -  $1 is the command line.
161
214
# No return value.
243
296
# Main #
244
297
########
245
298
 
 
299
proc_config_file
 
300
 
246
301
proc_CL "$@"
247
302
 
248
303
set_dist_default
249
304
 
250
 
 
251
 
rm -vf ../../$repo/$arch/pkgs/*
252
 
 
253
 
osc build -k ~/SWDev/oscbuilder/$repo/$arch/built-pkgs \
254
 
        -p ~/SWDev/oscbuilder/$repo/$arch/tmp-pkg-cache \
 
305
osc build -k "$base_output_dir/$repo/$arch/built-pkgs" \
 
306
        -p "$base_output_dir/$repo/$arch/tmp-pkg-cache" \
255
307
        $repo $arch $cla
256
308
 
257
309
# And exit.