Opened 14 years ago

Closed 14 years ago

#5454 closed enhancement (fixed)

[patch] added rule UntarArchive

Reported by: mmadia Owned by: bonefish
Priority: normal Milestone: R1
Component: Build System Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #5457
Platform: All

Description

This patch adds the ability to extract tar.gz files within the build system. This functionality will be needed by upcoming patches for installing the firmwares of various wireless hardware.

Attachments (2)

FileRules-Rule-UntarArchive-v3.patch (2.5 KB ) - added by mmadia 14 years ago.
fixed UntarArchive1 to work in linux
FileRules-Rule-UntarArchive-v4.patch (3.4 KB ) - added by mmadia 14 years ago.
Updated to abstract UnzipArchive as ExtractArchive.

Download all attachments as: .zip

Change History (9)

comment:1 by mmadia, 14 years ago

Blocking: 5457 added

by mmadia, 14 years ago

fixed UntarArchive1 to work in linux

comment:2 by mmadia, 14 years ago

Type: bugenhancement

To note, the intel 3945 and 4965 firmware archives have some odd file permissions that may cause issues on multi-user systems.

/generated/x86gcc2/tmp> ls -l iprowifi3945/ iprowifi4965/
iprowifi3945/:
total 6
drwxr-xr-x 1 191127 10545 2048 Jul 26  2007 iwlwifi-3945-ucode-2.14.1.5

iprowifi4965/:
total 6
drwxr-xr-x 1 191127 10545 2048 Nov 22  2007 iwlwifi-4965-ucode-4.44.1.20

comment:3 by bonefish, 14 years ago

Since the UntarArchive is, save for some renaming, an exact copy of UnzipArchive, I'd rather see that solved differently. Either by introducing a helper rule parameterized over the actions to be executed. Or -- I think I like that option better -- by just generalizing UnzipArchive to execute the respective actions implied by the archive file extension.

If you want to do that feel free. Otherwise I'll put it on my TODO list.

comment:4 by mmadia, 14 years ago

How could I sniff the archive file extension?

Do you mean something along these lines?

rule UnArchive directory : entries : archiveFile : archiveType : grist
{
	# UnArchive <directory> : <entries> : <archiveFile> : <archiveType> : [ : <grist> ]
....
	# one-time initialization for the main target (the directory)
	if ! [ on $(directory) return $(INITIALIZED) ] {
		# make sure the parent dir exists
		local parentDir = $(directory:PG=dir) ;
		Depends $(directory) : $(parentDir) ;
		MkDir $(parentDir) ;

		NoUpdate $(directory) ;
		Depends $(directory) : $(archiveFile) ;
		if [ $(archiveType) == zip ] {
			UnzipArchive1 $(directory) : $(archiveFile) ;
		} else if [ $(archiveType) == tgz ] {
			UntarArchive1 $(directory) : $(archiveFile) ;
		} else { 
			Exit "Missing paramters in UnArchive. Need to specify archive type." ;
		}
		INITIALIZED on $(directory) = 1 ;
	}
...

in reply to:  4 comment:5 by bonefish, 14 years ago

Replying to mmadia:

How could I sniff the archive file extension?

In the jam language $(myVariable:S) translates to the file name extension (*s*uffix) of the file name stored in $(myVariable). Have a look at buildtools/trunk/jam/Jam.html for more info on the language. For an example of extension handling cf. the Object rule.

by mmadia, 14 years ago

Updated to abstract UnzipArchive as ExtractArchive.

comment:6 by mmadia, 14 years ago

Thanks for the tip!

I overlooked 80char limit with this and the other patches. Once the implementation is how you like it, i'll gladly resubmit final patches. Also, I haven't tested the behavior with .tar.gz yet. Though, my #5457 was updated and jam -q @nightly-raw built successfully.

build/jam/OptionalBuildFeatures was the only occurrence of UnzipArchive to be found. It was also updated in this patch.

Afterwards, I could look into updating the UnzipArchiveTo* and AddUnzipFile* rules if desired.

in reply to:  6 comment:7 by bonefish, 14 years ago

Resolution: fixed
Status: newclosed

Replying to mmadia:

I've applied the patch in hrev35616.

I overlooked 80char limit with this and the other patches.

Fixed in the commit.

Once the implementation is how you like it, i'll gladly resubmit final patches. Also, I haven't tested the behavior with .tar.gz yet. Though, my #5457 was updated and jam -q @nightly-raw built successfully.

IIRC the ":S" only selects the last extension, i.e. the ".gz". If that is indeed so, something like the following might work to check for ".tar.gz":

...
case .gz :
{
  local baseName = $(archiveFile:B) ;
  if $(baseName:S) = .tar {
    ...
  } else {
    ...
  }
}

Afterwards, I could look into updating the UnzipArchiveTo* and AddUnzipFile* rules if desired.

Only, if there's a reason to do that. I wouldn't want to add complexity, if not needed.

Note: See TracTickets for help on using tickets.