Changeset 765 for rpmbuild-bot
- Timestamp:
- May 27, 2016, 12:49:59 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rpmbuild-bot/rpmbuild-bot.sh
r749 r765 23 23 # 24 24 # > rpmbuild-bot.sh SPEC[=VERSION] 25 # > [ upload[=REPO] | test[=MODE] | clean[=test] | remove[=REPO] ] 25 # > [ upload[=REPO] | test[=MODE] | clean[=test] | 26 # > move[=FROM_REPO=TO_REPO] | remove[=REPO] ] 26 27 # > [-f] 27 28 # … … 81 82 # 82 83 # It is possible to configure which steps of the build to perform using the MODE 83 # argumentto the "test" command which may take one of the following values:84 # parameter to the "test" command which may take one of the following values: 84 85 # 85 86 # prep Execute the %prep section of the spec file only. … … 93 94 # necessary for "pack" to succeed. 94 95 # 95 # When no MODE argumentis given, all steps are executed in a proper order.96 # When no MODE parameter is given, all steps are executed in a proper order. 96 97 # 97 98 # The results of the "test" command are stored in a log file in the logs/test … … 108 109 # The "upload" command will upload the packages built with the "build" 109 110 # command to the official distribution channel configured in 110 # rpmbuild-bot-env.sh. The REPO argumentspecifies one of the configured111 # rpmbuild-bot-env.sh. The REPO parameter specifies one of the configured 111 112 # repositories. When REPO is not given, the default repository is used 112 113 # (usually experimental or similar). … … 130 131 # otherwise. 131 132 # 132 # If the "clean" command is given a "test" argument, it will clean up the133 # If the "clean" command is given a "test" parameter, it will clean up the 133 134 # results of the "test" command instead of "build". The log file from the 134 135 # "test" command needs to be present or the command will fail. 136 # 137 # Moving packages between repositories 138 # ------------------------------------ 139 # 140 # The "move" command allows to move a particular version of the packages 141 # built with the "build" command and uploaded with the "upload" command from one 142 # repository to another one. The "move" command is normally used to move 143 # packages from a test repository to a production one when they are ready for 144 # wide distribution. 145 # 146 # The "move" command needs log files from the "build" and "upload" commands 147 # and will fail otherwise. It also requires the VERSION parameter for the SPEC 148 # argument to be given (to specify the version of the packages to remove) and 149 # requires the FROM_REPO=TO_REPO parameter itself to specify the source 150 # repository and the target repository, respectively. 151 # 152 # The log files from the "build" and "upload" commands are not removed by the 153 # "move" command so it may be performed multiple times. The current location 154 # of the packages is not tracked in the log files so the command will fail 155 # if the source repository doesn't have the package files or if the target 156 # repository already has them. 135 157 # 136 158 # Removing packages … … 144 166 # 145 167 # The "remove" command needs log files from the "build" and "upload" commands 146 # and will fail otherwise. It also requires the VERSION argumentfor the SPEC147 # parameterto be given (to specify the version of the packages to remove) and148 # accepts the REPO argument just like the "upload" command does (to specify a149 # repository to remove the packages from).150 # 151 # Note that the log files from the "build" and "upload" commands are also removed152 # by this command upon sucessful package removal.168 # and will fail otherwise. It also requires the VERSION parameter for the SPEC 169 # argument to be given (to specify the version of the packages to remove) and 170 # accepts the REPO parameter itself just like the "upload" command does (to 171 # specify a repository to remove the packages from). 172 # 173 # Note that the log files from the "build" and "upload" commands are also 174 # removed by this command upon sucessful package removal. 153 175 # 154 176 # Return value … … 212 234 read_file_list() 213 235 { 214 # $1 = file list list filename 215 # $2 = var name where to save read file names (optional) 216 # $3 = function name to call for each file (optional) 236 # $1 = file list filename 237 # $2 = var name where to save the list of read file names (optional) 238 # $3 = function name to call for each file (optional), it may assign a new 239 # file name to $file and also set $file_pre and $file_post that will 240 # be prepended and appended to $file when saving it to the list in $2 241 # (but not when checking for file existence and timestamp) 217 242 218 243 local list="$1" … … 221 246 # Check timestamps. 222 247 while read l; do 248 local file_pre= 249 local file_post= 223 250 local file="${l#*|}" 224 251 local ts="${l%%|*}" … … 231 258 die "Recorded timestamp $ts doesn't match actual timestamp $act_ts for '$file'." 232 259 fi 233 _read_file_list_ret="$_read_file_list_ret${_read_file_list_ret:+ }$file "260 _read_file_list_ret="$_read_file_list_ret${_read_file_list_ret:+ }$file_pre$file$file_post" 234 261 done < "$list" 235 262 # Return the files (if requested). … … 539 566 } 540 567 541 remove_cmd()568 move_cmd() 542 569 { 543 570 # Check settings. … … 546 573 test -n "$RPMBUILD_BOT_UPLOAD_REPO_LIST" || die "RPMBUILD_BOT_UPLOAD_REPO_LIST is empty." 547 574 575 local from_repo="${command_arg%%=*}" 576 local to_repo="${command_arg#*=}" 577 578 [ -n "$from_repo" ] || die "FROM_REPO parameter is missing." 579 [ "$from_repo" = "$to_repo" ] && die "TO_REPO parameter is missing (or equals to FROM_REPO)." 580 581 check_dir_var "RPMBUILD_BOT_UPLOAD_${from_repo}_DIR" 582 check_dir_var "RPMBUILD_BOT_UPLOAD_${to_repo}_DIR" 583 584 local ver_list="$log_dir/archive/$spec_name.$spec_ver.list" 585 [ -f "$ver_list" ] || die "File '$ver_list' is not found." 586 587 eval local from_base="\$RPMBUILD_BOT_UPLOAD_${from_repo}_DIR" 588 eval local to_base="\$RPMBUILD_BOT_UPLOAD_${to_repo}_DIR" 589 590 local files= 591 read_file_list "$ver_list" files ' 592 local dir= 593 local base="$from_base"; repo_dir_for_file "$file" dir; file="${dir}/${file##*/}" 594 base="$to_base"; repo_dir_for_file "$file" dir; file_post=">${dir}" 595 ' 596 for f in $files; do 597 local from="${f%%>*}" 598 local to="${f#*>}" 599 echo "Moving $from to $to/..." 600 run mv "$from" "$to/" 601 done 602 } 603 604 remove_cmd() 605 { 606 # Check settings. 607 [ -n "$spec_ver" ] || die "SPEC parameter lacks version specification." 608 609 test -n "$RPMBUILD_BOT_UPLOAD_REPO_LIST" || die "RPMBUILD_BOT_UPLOAD_REPO_LIST is empty." 610 548 611 local repo="$command_arg" 549 612 [ -z "$repo" ] && repo="${RPMBUILD_BOT_UPLOAD_REPO_LIST%% *}" … … 551 614 check_dir_var "RPMBUILD_BOT_UPLOAD_${repo}_DIR" 552 615 553 eval local base="\$RPMBUILD_BOT_UPLOAD_${repo}_DIR"554 555 616 local ver_list="$log_dir/archive/$spec_name.$spec_ver.list" 556 617 [ -f "$ver_list" ] || die "File '$ver_list' is not found." 618 619 eval local base="\$RPMBUILD_BOT_UPLOAD_${repo}_DIR" 557 620 558 621 local files= … … 613 676 [ "$spec" = "$spec_ver" ] && spec_ver= 614 677 615 command_name="${command% =*}"678 command_name="${command%%=*}" 616 679 command_arg="${command#*=}" 617 680 [ "$command_name" = "$command_arg" ] && command_arg= … … 624 687 need_spec_file=1 625 688 ;; 626 upload|clean| remove)689 upload|clean|move|remove) 627 690 ;; 628 691 *) usage … … 662 725 run mkdir -p "$zip_dir" 663 726 664 [ -z "$command" ] && command="build"665 666 command_name="${command%=*}"667 comand_arg="${command#*=}"668 [ "$command_name" = "$command_arg" ] && command_arg=669 670 727 log_base="$log_dir/$spec_name" 671 728 spec_list="$log_base.list"
Note:
See TracChangeset
for help on using the changeset viewer.