Opened 14 years ago

Closed 14 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
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 14 years ago.
fixed the previous broken patch due to manual editing.
5479-ExtractArchiveToHaikuImage--implementation-2.patch (32.7 KB ) - added by mmadia 14 years ago.
changes per comment 2

Download all attachments as: .zip

Change History (7)

by mmadia, 14 years ago

fixed the previous broken patch due to manual editing.

comment:1 by mmadia, 14 years ago

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 by bonefish, 14 years ago

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.

in reply to:  2 comment:3 by mmadia, 14 years ago

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.

by mmadia, 14 years ago

changes per comment 2

comment:4 by mmadia, 14 years ago

Blocking: 5490 added

comment:5 by bonefish, 14 years ago

Resolution: fixed
Status: newclosed

Thanks! Applied in hrev35634.

Note: See TracTickets for help on using tickets.