modify install script -Signed-off-by dongzhengkuan@huawei.com

Signed-off-by: 15549494042 <dongzhengkuan@huawei.com>
This commit is contained in:
15549494042 2023-10-20 17:00:22 +08:00
parent ce9f0ec99c
commit b8b443e054
4 changed files with 357 additions and 223 deletions

448
BUILD.gn
View File

@ -14,8 +14,8 @@
import("//build/ohos.gni")
import("./cups.gni")
config_dir = "."
cups_code_dir = "cups-2.4.0/"
config_dir = "${target_gen_dir}"
cups_code_dir = "${target_gen_dir}/cups-2.4.0"
core_code_dir = "$cups_code_dir/cups/"
filter_code_dir = "$cups_code_dir/filter"
backend_code_dir = "$cups_code_dir/backend"
@ -25,6 +25,198 @@ scheduler_code_dir = "$cups_code_dir/scheduler"
SUBSYSTEM_NAME = "thirdparty"
PART_NAME = "cups"
cups_generated_sources = [
"$core_code_dir/adminutil.c",
"$core_code_dir/array.c",
"$core_code_dir/auth.c",
"$core_code_dir/backchannel.c",
"$core_code_dir/backend.c",
"$core_code_dir/debug.c",
"$core_code_dir/dest-job.c",
"$core_code_dir/dest-localization.c",
"$core_code_dir/dest-options.c",
"$core_code_dir/dest.c",
"$core_code_dir/dir.c",
"$core_code_dir/encode.c",
"$core_code_dir/file.c",
"$core_code_dir/getdevices.c",
"$core_code_dir/getifaddrs.c",
"$core_code_dir/getputfile.c",
"$core_code_dir/globals.c",
"$core_code_dir/hash.c",
"$core_code_dir/http-addr.c",
"$core_code_dir/http-addrlist.c",
"$core_code_dir/http-support.c",
"$core_code_dir/http.c",
"$core_code_dir/ipp-file.c",
"$core_code_dir/ipp-support.c",
"$core_code_dir/ipp-vars.c",
"$core_code_dir/ipp.c",
"$core_code_dir/langprintf.c",
"$core_code_dir/language.c",
"$core_code_dir/md5.c",
"$core_code_dir/md5passwd.c",
"$core_code_dir/notify.c",
"$core_code_dir/options.c",
"$core_code_dir/ppd-attr.c",
"$core_code_dir/ppd-cache.c",
"$core_code_dir/ppd-conflicts.c",
"$core_code_dir/ppd-custom.c",
"$core_code_dir/ppd-emit.c",
"$core_code_dir/ppd-localize.c",
"$core_code_dir/ppd-mark.c",
"$core_code_dir/ppd-page.c",
"$core_code_dir/ppd-util.c",
"$core_code_dir/ppd.c",
"$core_code_dir/pwg-media.c",
"$core_code_dir/raster-error.c",
"$core_code_dir/raster-interpret.c",
"$core_code_dir/raster-stream.c",
"$core_code_dir/request.c",
"$core_code_dir/sidechannel.c",
"$core_code_dir/snmp.c",
"$core_code_dir/snprintf.c",
"$core_code_dir/string.c",
"$core_code_dir/tempfile.c",
"$core_code_dir/thread.c",
"$core_code_dir/tls-openssl.c",
"$core_code_dir/tls.c",
"$core_code_dir/transcode.c",
"$core_code_dir/usersys.c",
"$core_code_dir/util.c",
]
scheduler_util_generated_sources = [ "$scheduler_code_dir/util.c" ]
cups_deviced_generated_sources = [ "$scheduler_code_dir/cups-deviced.c" ]
cups_driverd_generated_sources = [ "$scheduler_code_dir/cups-driverd.cxx" ]
cups_exec_generated_sources = [ "$scheduler_code_dir/cups-exec.c" ]
cupsd_generated_sources = [
"$scheduler_code_dir/auth.c",
"$scheduler_code_dir/banners.c",
"$scheduler_code_dir/cert.c",
"$scheduler_code_dir/classes.c",
"$scheduler_code_dir/client.c",
"$scheduler_code_dir/colorman.c",
"$scheduler_code_dir/conf.c",
"$scheduler_code_dir/dirsvc.c",
"$scheduler_code_dir/env.c",
"$scheduler_code_dir/file.c",
"$scheduler_code_dir/ipp.c",
"$scheduler_code_dir/job.c",
"$scheduler_code_dir/listen.c",
"$scheduler_code_dir/log.c",
"$scheduler_code_dir/main.c",
"$scheduler_code_dir/network.c",
"$scheduler_code_dir/policy.c",
"$scheduler_code_dir/printers.c",
"$scheduler_code_dir/process.c",
"$scheduler_code_dir/quotas.c",
"$scheduler_code_dir/select.c",
"$scheduler_code_dir/server.c",
"$scheduler_code_dir/statbuf.c",
"$scheduler_code_dir/subscriptions.c",
"$scheduler_code_dir/sysman.c",
]
cupsfilter_generated_sources = [ "$scheduler_code_dir/cupsfilter.c" ]
ipp_generated_sources = [ "$backend_code_dir/ipp.c" ]
usb_generated_sources = [ "$backend_code_dir/usb.c" ]
lp_generated_sources = [ "$cups_code_dir/systemv/lp.c" ]
lpadmin_generated_sources = [ "$cups_code_dir/systemv/lpadmin.c" ]
lpinfo_generated_sources = [ "$cups_code_dir/systemv/lpinfo.c" ]
rastertopwg_generated_sources = [ "$filter_code_dir/rastertopwg.c" ]
cupsmime_generated_sources = [
"$scheduler_code_dir/filter.c",
"$scheduler_code_dir/mime.c",
"$scheduler_code_dir/type.c",
]
cupsimage_generated_sources = [
"$core_code_dir/raster-interstub.c",
"$core_code_dir/raster-stubs.c",
]
backend_generated_sources = [
"$backend_code_dir/ieee1284.c",
"$backend_code_dir/network.c",
"$backend_code_dir/runloop.c",
"$backend_code_dir/snmp-supplies.c",
]
cupsppdc_generated_sources = [
"$ppdc_code_dir/ppdc-array.cxx",
"$ppdc_code_dir/ppdc-attr.cxx",
"$ppdc_code_dir/ppdc-catalog.cxx",
"$ppdc_code_dir/ppdc-choice.cxx",
"$ppdc_code_dir/ppdc-constraint.cxx",
"$ppdc_code_dir/ppdc-driver.cxx",
"$ppdc_code_dir/ppdc-file.cxx",
"$ppdc_code_dir/ppdc-filter.cxx",
"$ppdc_code_dir/ppdc-font.cxx",
"$ppdc_code_dir/ppdc-group.cxx",
"$ppdc_code_dir/ppdc-import.cxx",
"$ppdc_code_dir/ppdc-mediasize.cxx",
"$ppdc_code_dir/ppdc-message.cxx",
"$ppdc_code_dir/ppdc-option.cxx",
"$ppdc_code_dir/ppdc-profile.cxx",
"$ppdc_code_dir/ppdc-shared.cxx",
"$ppdc_code_dir/ppdc-source.cxx",
"$ppdc_code_dir/ppdc-string.cxx",
"$ppdc_code_dir/ppdc-variable.cxx",
]
ppdc_generated_sources = [ "$ppdc_code_dir/ppdc.cxx" ]
mime_convs_generated_source = "$cups_code_dir/conf/mime.convs"
mime_types_generated_source = "$cups_code_dir/conf/mime.types"
action("cups_action") {
print("cups_action is exec")
script = "//third_party/cups/install.py"
outputs = []
outputs += cups_generated_sources
outputs += cups_deviced_generated_sources
outputs += cups_driverd_generated_sources
outputs += cups_exec_generated_sources
outputs += cupsd_generated_sources
outputs += cupsfilter_generated_sources
outputs += ipp_generated_sources
outputs += usb_generated_sources
outputs += lp_generated_sources
outputs += lpadmin_generated_sources
outputs += lpinfo_generated_sources
outputs += rastertopwg_generated_sources
outputs += cupsmime_generated_sources
outputs += cupsimage_generated_sources
outputs += backend_generated_sources
outputs += cupsppdc_generated_sources
outputs += ppdc_generated_sources
outputs += scheduler_util_generated_sources
outputs += [ mime_convs_generated_source ]
outputs += [ mime_types_generated_source ]
inputs = [ "//third_party/cups/cups-2.4.0-source.tar.gz" ]
cups_path = rebase_path("${target_gen_dir}", root_build_dir)
cups_source_path = rebase_path("//third_party/cups", root_build_dir)
args = [
"--gen-dir",
"$cups_path",
"--source-dir",
"$cups_source_path",
]
}
group("third_party_cups") {
deps = [
":cups",
@ -33,10 +225,12 @@ group("third_party_cups") {
":cups-exec",
":cupsd",
":cupsfilter",
":cupsimage",
":ipp",
":mime.convs",
":mime.types",
":rastertopwg",
":usb",
]
}
@ -46,7 +240,7 @@ config("cups_config") {
"$config_dir",
"$cups_code_dir",
"$core_code_dir",
"//third_party/libusb/libusb-1.0.26/libusb",
"//third_party/libusb",
"//third_party/openssl/include",
]
@ -59,100 +253,36 @@ config("cups_config") {
}
ohos_shared_library("cups") {
sources = [
"$core_code_dir/adminutil.c",
"$core_code_dir/array.c",
"$core_code_dir/auth.c",
"$core_code_dir/backchannel.c",
"$core_code_dir/backend.c",
"$core_code_dir/debug.c",
"$core_code_dir/dest-job.c",
"$core_code_dir/dest-localization.c",
"$core_code_dir/dest-options.c",
"$core_code_dir/dest.c",
"$core_code_dir/dir.c",
"$core_code_dir/encode.c",
"$core_code_dir/file.c",
"$core_code_dir/getdevices.c",
"$core_code_dir/getifaddrs.c",
"$core_code_dir/getputfile.c",
"$core_code_dir/globals.c",
"$core_code_dir/hash.c",
"$core_code_dir/http-addr.c",
"$core_code_dir/http-addrlist.c",
"$core_code_dir/http-support.c",
"$core_code_dir/http.c",
"$core_code_dir/ipp-file.c",
"$core_code_dir/ipp-support.c",
"$core_code_dir/ipp-vars.c",
"$core_code_dir/ipp.c",
"$core_code_dir/langprintf.c",
"$core_code_dir/language.c",
"$core_code_dir/md5.c",
"$core_code_dir/md5passwd.c",
"$core_code_dir/notify.c",
"$core_code_dir/options.c",
"$core_code_dir/ppd-attr.c",
"$core_code_dir/ppd-cache.c",
"$core_code_dir/ppd-conflicts.c",
"$core_code_dir/ppd-custom.c",
"$core_code_dir/ppd-emit.c",
"$core_code_dir/ppd-localize.c",
"$core_code_dir/ppd-mark.c",
"$core_code_dir/ppd-page.c",
"$core_code_dir/ppd-util.c",
"$core_code_dir/ppd.c",
"$core_code_dir/pwg-media.c",
"$core_code_dir/raster-error.c",
"$core_code_dir/raster-interpret.c",
"$core_code_dir/raster-interstub.c",
"$core_code_dir/raster-stream.c",
"$core_code_dir/raster-stubs.c",
"$core_code_dir/request.c",
"$core_code_dir/sidechannel.c",
"$core_code_dir/snmp.c",
"$core_code_dir/snprintf.c",
"$core_code_dir/string.c",
"$core_code_dir/tempfile.c",
"$core_code_dir/thread.c",
"$core_code_dir/tls-openssl.c",
"$core_code_dir/tls.c",
"$core_code_dir/transcode.c",
"$core_code_dir/usersys.c",
"$core_code_dir/util.c",
]
sources = cups_generated_sources
sources += cupsimage_generated_sources
deps = [
":cups_action",
"//third_party/openssl:libcrypto_shared",
"//third_party/openssl:libssl_shared",
"//third_party/zlib:libz",
]
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"
}
ohos_shared_library("cupsimage") {
sources = [
"$core_code_dir/raster-interstub.c",
"$core_code_dir/raster-stubs.c",
sources = cupsimage_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
]
deps = [ "//third_party/cups:cups" ]
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"
}
ohos_executable("rastertopwg") {
sources = [ "$filter_code_dir/rastertopwg.c" ]
deps = [ "//third_party/cups:cups" ]
sources = rastertopwg_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
]
install_enable = true
module_install_dir = "$cups_serverbin_dir/filter"
public_configs = [ ":cups_config" ]
@ -161,28 +291,23 @@ ohos_executable("rastertopwg") {
}
ohos_shared_library("backend") {
sources = [
"$backend_code_dir/ieee1284.c",
"$backend_code_dir/network.c",
"$backend_code_dir/runloop.c",
"$backend_code_dir/snmp-supplies.c",
sources = backend_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
]
deps = [ "//third_party/cups:cups" ]
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"
}
ohos_executable("ipp") {
sources = [ "$backend_code_dir/ipp.c" ]
sources = ipp_generated_sources
deps = [
":cups_action",
"//third_party/cups:backend",
"//third_party/cups:cups",
]
install_enable = true
module_install_dir = "$cups_serverbin_dir/backend"
public_configs = [ ":cups_config" ]
@ -191,14 +316,13 @@ ohos_executable("ipp") {
}
ohos_executable("usb") {
sources = [ "$backend_code_dir/usb.c" ]
sources = usb_generated_sources
deps = [
":cups_action",
"//third_party/cups:backend",
"//third_party/cups:cups",
"//third_party/libusb:libusb",
]
install_enable = true
module_install_dir = "$cups_serverbin_dir/backend"
public_configs = [ ":cups_config" ]
@ -209,10 +333,11 @@ ohos_executable("usb") {
#end of backend
ohos_executable("lpadmin") {
sources = [ "$cups_code_dir/systemv/lpadmin.c" ]
deps = [ "//third_party/cups:cups" ]
sources = lpadmin_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
]
install_enable = true
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
@ -220,10 +345,11 @@ ohos_executable("lpadmin") {
}
ohos_executable("lpinfo") {
sources = [ "$cups_code_dir/systemv/lpinfo.c" ]
deps = [ "//third_party/cups:cups" ]
sources = lpinfo_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
]
install_enable = true
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
@ -231,10 +357,11 @@ ohos_executable("lpinfo") {
}
ohos_executable("lp") {
sources = [ "$cups_code_dir/systemv/lp.c" ]
deps = [ "//third_party/cups:cups" ]
sources = lp_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
]
install_enable = true
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
@ -243,43 +370,23 @@ ohos_executable("lp") {
#ppdc
ohos_shared_library("cupsppdc") {
sources = [
"$ppdc_code_dir/ppdc-array.cxx",
"$ppdc_code_dir/ppdc-attr.cxx",
"$ppdc_code_dir/ppdc-catalog.cxx",
"$ppdc_code_dir/ppdc-choice.cxx",
"$ppdc_code_dir/ppdc-constraint.cxx",
"$ppdc_code_dir/ppdc-driver.cxx",
"$ppdc_code_dir/ppdc-file.cxx",
"$ppdc_code_dir/ppdc-filter.cxx",
"$ppdc_code_dir/ppdc-font.cxx",
"$ppdc_code_dir/ppdc-group.cxx",
"$ppdc_code_dir/ppdc-import.cxx",
"$ppdc_code_dir/ppdc-mediasize.cxx",
"$ppdc_code_dir/ppdc-message.cxx",
"$ppdc_code_dir/ppdc-option.cxx",
"$ppdc_code_dir/ppdc-profile.cxx",
"$ppdc_code_dir/ppdc-shared.cxx",
"$ppdc_code_dir/ppdc-source.cxx",
"$ppdc_code_dir/ppdc-string.cxx",
"$ppdc_code_dir/ppdc-variable.cxx",
sources = cupsppdc_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
]
deps = [ "//third_party/cups:cups" ]
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"
}
ohos_executable("ppdc") {
sources = [ "$ppdc_code_dir/ppdc.cxx" ]
sources = ppdc_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
"//third_party/cups:cupsppdc",
]
install_enable = true
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
@ -290,53 +397,23 @@ ohos_executable("ppdc") {
#scheduler
ohos_shared_library("cupsmime") {
sources = [
"$scheduler_code_dir/filter.c",
"$scheduler_code_dir/mime.c",
"$scheduler_code_dir/type.c",
sources = cupsmime_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
]
deps = [ "//third_party/cups:cups" ]
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"
}
ohos_executable("cupsd") {
sources = [
"$scheduler_code_dir/auth.c",
"$scheduler_code_dir/banners.c",
"$scheduler_code_dir/cert.c",
"$scheduler_code_dir/classes.c",
"$scheduler_code_dir/client.c",
"$scheduler_code_dir/colorman.c",
"$scheduler_code_dir/conf.c",
"$scheduler_code_dir/dirsvc.c",
"$scheduler_code_dir/env.c",
"$scheduler_code_dir/file.c",
"$scheduler_code_dir/ipp.c",
"$scheduler_code_dir/job.c",
"$scheduler_code_dir/listen.c",
"$scheduler_code_dir/log.c",
"$scheduler_code_dir/main.c",
"$scheduler_code_dir/network.c",
"$scheduler_code_dir/policy.c",
"$scheduler_code_dir/printers.c",
"$scheduler_code_dir/process.c",
"$scheduler_code_dir/quotas.c",
"$scheduler_code_dir/select.c",
"$scheduler_code_dir/server.c",
"$scheduler_code_dir/statbuf.c",
"$scheduler_code_dir/subscriptions.c",
"$scheduler_code_dir/sysman.c",
]
sources = cupsd_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
"//third_party/cups:cupsmime",
]
install_enable = true
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
@ -344,13 +421,12 @@ ohos_executable("cupsd") {
}
ohos_executable("cupsfilter") {
sources = [ "$scheduler_code_dir/cupsfilter.c" ]
sources = cupsfilter_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
"//third_party/cups:cupsmime",
]
install_enable = true
public_configs = [ ":cups_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
@ -358,16 +434,13 @@ ohos_executable("cupsfilter") {
}
ohos_executable("cups-deviced") {
sources = [
"$scheduler_code_dir/cups-deviced.c",
"$scheduler_code_dir/util.c",
]
sources = cups_deviced_generated_sources
sources += scheduler_util_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
"//third_party/cups:cupsmime",
]
install_enable = true
module_install_dir = "$cups_serverbin_dir/daemon"
public_configs = [ ":cups_config" ]
@ -376,16 +449,13 @@ ohos_executable("cups-deviced") {
}
ohos_executable("cups-driverd") {
sources = [
"$scheduler_code_dir/cups-driverd.cxx",
"$scheduler_code_dir/util.c",
]
sources = cups_driverd_generated_sources
sources += scheduler_util_generated_sources
deps = [
":cups_action",
"//third_party/cups:cups",
"//third_party/cups:cupsppdc",
]
install_enable = true
module_install_dir = "$cups_serverbin_dir/daemon"
public_configs = [ ":cups_config" ]
@ -394,10 +464,8 @@ ohos_executable("cups-driverd") {
}
ohos_executable("cups-exec") {
sources = [ "$scheduler_code_dir/cups-exec.c" ]
deps = []
sources = cups_exec_generated_sources
deps = [ ":cups_action" ]
install_enable = true
module_install_dir = "$cups_serverbin_dir/daemon"
public_configs = [ ":cups_config" ]
@ -406,16 +474,16 @@ ohos_executable("cups-exec") {
}
ohos_prebuilt_etc("mime.convs") {
exec_script(rebase_path("//third_party/cups/generate_mime_convs.py"),
[ rebase_path("//third_party/cups/cups-2.4.0/conf") ])
source = "$cups_code_dir/conf/mime.convs"
source = mime_convs_generated_source
deps = [ ":cups_action" ]
relative_install_dir = "cups/share/mime"
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"
}
ohos_prebuilt_etc("mime.types") {
source = "$cups_code_dir/conf/mime.types"
source = mime_types_generated_source
deps = [ ":cups_action" ]
relative_install_dir = "cups/share/mime"
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"

View File

@ -11,10 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cups_path = rebase_path("//third_party/cups")
exec_script("install.sh", [ "$cups_path" ])
print("cups installed successfully")
CUPS_SERVICE_DATA_DIR = "/data/service/el1/public/print_service/cups"
cups_bin_dir = "bin"

99
install.py Executable file
View File

@ -0,0 +1,99 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import tarfile
import argparse
import os
import subprocess
import sys
import shutil
def untar_file(tar_file_path, extract_path):
try:
tar_cmd = ['tar', '-zxf', tar_file_path, '-C', extract_path]
subprocess.run(tar_cmd, check=True)
except Exception as e:
print("tar error!")
return
def copy_file(dir):
src_name = '/mime.convs.in'
dest_name = '/mime.convs'
src_file = dir + src_name
dest_file = dir + dest_name
print(f'copy from %s to %s', src_file, dest_file)
shutil.copy2(src_file, dest_file)
def move_file(src_path, dst_path):
files = [
"backport-CVE-2022-26691.patch",
"backport-CVE-2023-32324.patch",
"backport-CVE-2023-34241.patch",
"ohos-multi-file-print.patch",
"ohos-modify-pthread.patch",
"ohos-add-openssl.patch",
"backport-CVE-2023-4504.patch",
"config.h"
]
for file in files:
src_file = os.path.join(src_path, file)
dst_file = os.path.join(dst_path, file)
shutil.copy(src_file, dst_file)
def apply_patch(patch_file, target_dir):
try:
if not os.path.exists(target_dir):
return
patch_cmd = ['patch', '-p1', "--fuzz=0", "--no-backup-if-mismatch", '-i', patch_file, '-d', target_dir]
subprocess.run(patch_cmd, check=True)
except Exception as e:
print("apply_patch error!")
return
def do_patch(target_dir):
patch_file = [
"backport-CVE-2022-26691.patch",
"backport-CVE-2023-32324.patch",
"backport-CVE-2023-34241.patch",
"ohos-multi-file-print.patch",
"ohos-modify-pthread.patch",
"ohos-add-openssl.patch",
"backport-CVE-2023-4504.patch"
]
for patch in patch_file:
apply_patch(patch, target_dir)
def main():
cups_path = argparse.ArgumentParser()
cups_path.add_argument('--gen-dir', help='generate path of log', required=True)
cups_path.add_argument('--source-dir', help='generate path of log', required=True)
args = cups_path.parse_args()
tar_file_path = os.path.join(args.source_dir, "cups-2.4.0-source.tar.gz")
target_dir = os.path.join(args.gen_dir, "cups-2.4.0")
convs_dir = os.path.join(target_dir, "conf")
untar_file(tar_file_path, args.gen_dir)
move_file(args.source_dir, target_dir)
do_patch(target_dir)
copy_file(convs_dir)
return 0
if __name__ == '__main__':
sys.exit(main())

View File

@ -1,29 +0,0 @@
#!/bin/bash
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
cd $1
if [ -d "cups-2.4.0" ];then
rm -rf cups-2.4.0
fi
tar xvf cups-2.4.0-source.tar.gz
cd $1/cups-2.4.0
patch -p1 < $1/backport-CVE-2022-26691.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/backport-CVE-2023-32324.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/backport-CVE-2023-34241.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/ohos-multi-file-print.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/ohos-modify-pthread.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/ohos-add-openssl.patch --fuzz=0 --no-backup-if-mismatch
patch -p1 < $1/backport-CVE-2023-4504.patch --fuzz=0 --no-backup-if-mismatch
exit 0