使用pkgs --update 下载解压zip文件是解析会出现错误
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
Research direction
Start at handle_zip_package and inspect how zipfile.ZipFile.namelist() is used to determine package_folder_name, including the Windows path conversion. Reproduce the issue with pkgs --update and v2.5.0_for_rtthread.zip, then verify that extraction and database paths include the complete package contents rather than only .github/workflows/.
Written by the indexing model from the issue text.
Description
例如:
解压v2.5.0_for_rtthread.zip 时找到的第一个文件是littlefs-refs-tags-v2.5.0_for_rtthread.github\workflows\下面的文件
def handle_zip_package 中
package_folder_name = os.path.split(right_path)[0]
package_folder_name 就成了littlefs-refs-tags-v2.5.0_for_rtthread.github\workflows
所以最终解压的内容经过cp就只有.github\workflows\ 下的文件
是否改成这样,找第一个item, 因为第一个itme永远是压缩包本身的文件夹
def handle_zip_package(archive_filename, bsp_package_path, package_name, package_info):
package_version = package_info['ver']
package_temp_path = os.path.join(bsp_package_path, "package_temp")
try:
if remove_folder(package_temp_path):
os.makedirs(package_temp_path)
except Exception as e:
logging.warning('Error message : {0}'.format(e))
logging.info("BSP packages path {0}".format(bsp_package_path))
logging.info("BSP package temp path: {0}".format(package_temp_path))
logging.info("archive filename : {0}".format(archive_filename))
try:
flag = True
package_folder_name = ""
package_name_with_version = ""
arch = zipfile.ZipFile(archive_filename, "r")
for item in arch.namelist():
arch.extract(item, package_temp_path)
if is_windows():
right_path = item.replace('/', '\\')
else:
right_path = item
# Gets the folder name and changed folder name only once
if flag:
package_folder_name = os.path.split(right_path)[0]
package_name_with_version = package_name + '-' + package_version
flag = False
if not os.path.isdir(os.path.join(package_temp_path, item)):
right_name_to_db = right_path.replace(package_folder_name, package_name_with_version, 1)
right_path = os.path.join("package_temp", right_path)
pkgsdb.save_to_database(right_name_to_db, archive_filename, right_path)
arch.close()
if not move_package_to_bsp_packages(package_folder_name, package_name, package_temp_path, package_version,
bsp_package_path):
return False
except Exception as e:
logging.warning('unpack error message : {0}'.format(e))
logging.warning('unpack {0} failed'.format(os.path.basename(archive_filename)))
# remove temp folder and archive file
remove_folder(package_temp_path)
os.remove(archive_filename)
return False
return True
- Dominant language
- Python
- Stars
- 79
- Forks
- 64
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RT-Thread/env
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
【建议】能否将env的包全部离线化Open
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
改进 env 的文档Open
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
juandresrodca/AdminForge#66 ·
Maintainers usually reply within 1 day
-
backend/local comp/tools P2 tool/terminal type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NousResearch/hermes-agent#158788 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
public-apis/public-apis#9330 · 1 reaction ·
Maintainers usually reply within 12 days
-
approved author-page correction move-papers
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
acl-org/acl-anthology#11043 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day