Opened 9 years ago

Closed 9 years ago

#5479 closed enhancement (fixed)

[patch] More support for *.tgz

Reported by: mmadia Owned by: bonefish
Priority: normal Milestone: R1
Component: Build System Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #5455, #5490
Has a Patch: no Platform: All

Description

Per request in http://dev.haiku-os.org/ticket/5455#comment:5 , this patch abstracts the rules, actions, & related code for unzipping an archive directly to the image file. The new code supports .zip & .tgz

Some notes:

  • Due to reliance upon $(variable:S), .tar.gz is currently not supported.
  • OptionalPackages can also be .tgz. However the file extension is parsed from the URL, which may present some shortcomings.
  • build/scripts/build_haiku_* is passed "tar" instead of <build>tar, due to not having tar as a build system tool (src/tools/tar)
  • An updated patch for #5455 has not been tested. Instead, Vision was repackaged as .tgz, its original .zip removed, build/jam/OptionalPackages patched, and Vision was confirmed to extract properly in jam -q @nightly-raw -- both in jam output & looking at the mounted imagefile.

jam -q @nightly-raw output clipping:

Extracting /generated/x86gcc2/download/yasm-0.8.0-r1a1-x86-gcc2-2009-08-30.zip ...
Extracting /generated/x86gcc4/alternative_system_libs.zip ...
Extracting /generated/x86gcc2/download/Vision-0.9.7-H-090423.tgz ...
Deleting old MIME database ...
Installing MIME database ...
Unmounting ...
...updated 510 target(s)...
/generated/x86gcc2> 

Attachments (2)

5479-ExtractArchiveToHaikuImage.patch (13.5 KB) - added by mmadia 9 years ago.
fixed the previous broken patch due to manual editing.
5479-ExtractArchiveToHaikuImage--implementation-2.patch (32.7 KB) - added by mmadia 9 years ago.
changes per comment 2

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by mmadia

fixed the previous broken patch due to manual editing.

comment:1 Changed 9 years ago by mmadia

as mentioned in the attachment's comment, *--implementation-2.patch has the file's extension included as part of InstallOptionalHaikuImagePackage's first argument. This allows *.tar.gz to be supported and removes the assumption that the url will contain the file's extension.

comment:2 Changed 9 years ago by bonefish

Looks good. A few remarks:

  • DownloadOptionalPackage still contains some commented out code, probably from experimenting. Since the rule has become an alias of DownloadFile and is used only in one instance, I'd just remove it.
  • CreateContainerExtractFilesScript: I suppose the note is mostly obsolete and at least the commented out code should be removed. Have you checked out the sh vs. bash question?
  • Regarding code duplication in build_haiku_image, build_haiku_cd, and probably other scripts, that's indeed annoying. It would be nice to unify the scripts again or at least move commonly used code to a sourceable helper script. That's material for a separate undertaking, though.
  • No need to pass "tar" to the script at all. As long as we don't add Haiku-specific extensions (like attribute support), using the build platform's tar in the script is just fine.

comment:3 in reply to:  2 Changed 9 years ago by mmadia

Replying to bonefish:

  • CreateContainerExtractFilesScript: Have you checked out the sh vs. bash question?

Yes, with the following script on FreeBSD

#!/bin/sh

test()
{
	case "$archiveFile" in
		*.zip)
			echo "*.zip)"
			;;
		*.tgz|*.tar.gz)
			echo "*.tgz|*.tar.gz)"
			;;
		*)
			echo "Unhandled archive extension in build_haiku_image extractFile()"
			exit 1
			;;
	esac
}

archiveFile="arstarst.tgz"
test
archiveFile="arstarst.tar.gz"
test
archiveFile="arstarst.zip"
test
archiveFile="arstarst.fault"
test
echo "why didn't i exit?"  #Note, this line never outputs. The script output follows the logic.

For cleaning up the scripts, i'll /newticket it.

The other remarks have been addressed in the new attachment.

Changed 9 years ago by mmadia

changes per comment 2

comment:4 Changed 9 years ago by mmadia

Blocking: 5490 added

comment:5 Changed 9 years ago by bonefish

Resolution: fixed
Status: newclosed

Thanks! Applied in hrev35634.

Note: See TracTickets for help on using tickets.