diff --git a/0001-Bugfix-ccb-log-error-url.patch b/0001-Bugfix-ccb-log-error-url.patch new file mode 100644 index 0000000000000000000000000000000000000000..37f51d385b0154722af32f01504d7fad7feda7af --- /dev/null +++ b/0001-Bugfix-ccb-log-error-url.patch @@ -0,0 +1,202 @@ +diff --git a/sbin/cli/build-image b/sbin/cli/build-image +deleted file mode 100755 +index a6d0420..0000000 +--- a/sbin/cli/build-image ++++ /dev/null +@@ -1,66 +0,0 @@ +-#! /usr/bin/env ruby +-# -*- coding: utf-8 -*- +-# Copyright: Copyright © Huawei Technologies Co., Ltd. 2022. All rights reserved. Create: 2022-08-04 +-# frozen_string_literal: true +- +-LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME))) +- +-require 'json' +-require 'optparse' +-require "#{LKP_SRC}/sbin/cli/ccb_common" +-require "#{LKP_SRC}/sbin/cli/ccb_api_client" +- +-options = OptionParser.new do |opts| +- opts.banner = 'Usage: ccb build-image key1=val1' +- opts.separator '' +- opts.separator ' eg.1: ccb build-image pipeline_id=xxx' +- opts.separator '' +- +- opts.on('-h', '--help', 'show this message') do +- puts options +- exit +- end +-end +- +-options.parse!(ARGV) +- +-if ARGV.empty? +- puts(options) +- exit +-end +- +-def build_image_response(jwt, hash, my_config) +- ccb_api_client = CcbApiClient.new(my_config['GATEWAY_IP'], my_config['GATEWAY_PORT']) +- response = ccb_api_client.build_image(jwt, hash.to_json) +- return response +-end +- +-def build_image_result(jwt, hash, my_config) +- jwt = load_jwt?(force_update = true) +- response = build_image_response(jwt, hash, my_config) +- +- puts response.body +-end +- +-hash = get_no_option_paras!(ARGV)[0] +-pipeline_id = hash['pipeline_id'] || '' +- +-if pipeline_id.empty? +- puts "pipeline_id can't be empty" +- exit +-end +- +-my_config = load_my_config +-jwt = load_jwt? +- +-required_keys = %w[GATEWAY_IP GATEWAY_PORT] +- +-required_keys.each do |var| +- unless my_config.has_key?(var) && !my_config[var].nil? +- puts "config #{var} not found" +- exit +- end +-end +- +- +-build_image_result(jwt, hash, my_config) +diff --git a/sbin/cli/log b/sbin/cli/log +index 435cff8..831b6d6 100755 +--- a/sbin/cli/log ++++ b/sbin/cli/log +@@ -79,4 +79,4 @@ end + result_root = get_result_root(jwt, job_id, my_config) + prefix = my_config['SRV_HTTP_RESULT_PROTOCOL'] + my_config['SRV_HTTP_RESULT_HOST'] + ':' + my_config['SRV_HTTP_RESULT_PORT'].to_s + '/api' + +-puts File.join(prefix, result_root) ++puts File.join(prefix, result_root, '/') +diff --git a/sbin/cli/upload-image-config b/sbin/cli/upload-image-config +deleted file mode 100755 +index a1bb627..0000000 +--- a/sbin/cli/upload-image-config ++++ /dev/null +@@ -1,54 +0,0 @@ +-#! /usr/bin/env ruby +- +-# frozen_string_literal: true +- +-LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME))) +- +-require 'yaml' +-require 'json' +-require 'optparse' +-require "#{LKP_SRC}/sbin/cli/ccb_common" +-require "#{LKP_SRC}/sbin/cli/ccb_api_client" +- +-json_path = nil +-yaml_path = nil +- +-options = OptionParser.new do |opts| +- opts.banner = 'Usage: ccb upload-image-config --yaml YAML' +- opts.separator ' eg.1: ccb upload-image-config --yaml config.yaml' +- opts.separator 'options:' +- +- opts.on('-y', '--yaml ', 'yaml file') do |y| +- yaml_path = y +- end +- +- opts.on('-h', '--help', 'show this message') do +- puts options +- exit +- end +-end +- +-def call_ccb_api(jwt, yaml_path) +- config = load_my_config +- api_client = CcbApiClient.new(config['GATEWAY_IP'], config['GATEWAY_PORT']) +- response = api_client.upload_image_config(jwt, yaml_path) +- response = JSON.parse(response) +- return response +-end +- +-if $PROGRAM_NAME == __FILE__ +- if ARGV.empty? +- puts options +- exit +- end +- options.parse!(ARGV) +- +- jwt = load_jwt?(force_update=true) +- response = call_ccb_api(jwt, yaml_path) +- if response.has_key?('status_code') and response['status_code'] == 401 +- jwt = load_jwt?(force_update=true) # jwt may timeout and retry once +- response = call_ccb_api(jwt, yaml_path) +- end +- check_return_code(response) +- puts JSON.pretty_generate(response) +-end +diff --git a/sbin/cli/upload-project-config b/sbin/cli/upload-project-config +deleted file mode 100755 +index 84258bc..0000000 +--- a/sbin/cli/upload-project-config ++++ /dev/null +@@ -1,54 +0,0 @@ +-#! /usr/bin/env ruby +- +-# frozen_string_literal: true +- +-LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME))) +- +-require 'yaml' +-require 'json' +-require 'optparse' +-require "#{LKP_SRC}/sbin/cli/ccb_common" +-require "#{LKP_SRC}/sbin/cli/ccb_api_client" +- +-json_path = nil +-yaml_path = nil +- +-options = OptionParser.new do |opts| +- opts.banner = 'Usage: ccb upload-project-config --yaml YAML' +- opts.separator ' eg.1: ccb upload-project-config --yaml config.yaml' +- opts.separator 'options:' +- +- opts.on('-y', '--yaml ', 'yaml file') do |y| +- yaml_path = y +- end +- +- opts.on('-h', '--help', 'show this message') do +- puts options +- exit +- end +-end +- +-def call_ccb_api(jwt, yaml_path) +- config = load_my_config +- api_client = CcbApiClient.new(config['GATEWAY_IP'], config['GATEWAY_PORT']) +- response = api_client.upload_project_config(jwt, yaml_path) +- response = JSON.parse(response) +- return response +-end +- +-if $PROGRAM_NAME == __FILE__ +- if ARGV.empty? +- puts options +- exit +- end +- options.parse!(ARGV) +- +- jwt = load_jwt?(force_update=true) +- response = call_ccb_api(jwt, yaml_path) +- if response.has_key?('status_code') and response['status_code'] == 401 +- jwt = load_jwt?(force_update=true) # jwt may timeout and retry once +- response = call_ccb_api(jwt, yaml_path) +- end +- check_return_code(response) +- puts JSON.pretty_generate(response) +-end diff --git a/ccb.spec b/ccb.spec index 1bbc7cecf1cdbff655aaebfbf7fb53f345955283..d226232bb2b6fdb2e2dd783fc71f571b6f9f4b6b 100755 --- a/ccb.spec +++ b/ccb.spec @@ -2,13 +2,15 @@ Name: ccb Version: 1.0.1 -Release: 2 +Release: 3 Summary: ccb is a client-side tool for EulerMaker License: MulanPSL-2.0 URL: https://gitee.com/openeuler/ccb Source0: %{name}-%{version}.tar.gz BuildArch: noarch +Patch1: 0001-Bugfix-ccb-log-error-url.patch + BuildRequires: ruby BuildRequires: rubygems BuildRequires: ruby-devel @@ -31,7 +33,7 @@ Requires: rubygem-rest-client This repository serves as a client-side tool for EulerMaker, allowing users to perform command-line operations on EulerMaker from within their own environment. %prep -%autosetup -n %{name}-%{version} +%autosetup -S git -n %{name}-%{version} if [ ! -f LICENSE ]; then echo "MulanPSL-2.0 license file is missing" >&2 @@ -68,6 +70,9 @@ fi %license LICENSE %changelog +* Fri May 23 2025 yangchaohao - 1.0.1-3 +- Bugfix for ccb-log's error url + * Fri May 16 2025 yangchaohao - 1.0.1-2 - 修复部分描述,修复安装依赖