Opened 6 years ago

Last modified 6 years ago

#14391 new bug

makefile-engine fails creating catalogs

Reported by: ahwayakchih Owned by: bonefish
Priority: normal Milestone: R1
Component: Build System Version: R1/Development
Keywords: Cc: humdinger, PulkoMandy
Blocked By: Blocking:
Platform: All

Description

When run for a project that did not have localisation before, make catalogs fails with following error:

/SVM> make catalogs
/boot/system/develop/etc/makefile-engine:260: recipe for target 'objects.x86_64-cc7-release/application/x-vnd.Shard.SVM' failed
make: *** [objects.x86_64-cc7-release/application/x-vnd.Shard.SVM] Error 1

Objects folder is there, binary was created with previous commands, catkeys were created just fine. But application/x-vnd.Shard.SVM does not exist.

It looks like mkdir used by makefile-engine fails because application subfolder does not exist, so it cannot crate sube-sub-folder.

After replacing mkdir with mkdir -p on line 260 (https://github.com/haiku/haiku/blob/9a152c9cb030c923e74090a96662a64cd5946995/data/develop/makefile-engine#L260) everything works fine.

Change History (6)

comment:1 by waddlesplash, 6 years ago

Cc: humdinger PulkoMandy added

You probably want make bindcatalogs, I think, as this adds the catalogs to the binary. It looks like those rules have been broken since forever; actually I'm not sure why they exist?

CCing humdinger and PulkoMandy for their input.

comment:2 by ahwayakchih, 6 years ago

AFAIK make bindcatalogs injects catkey files into binary. make catalogs converts catkey files into catalog files.

You're right that i don't need catalog files, if i bind translations into binary anyway.

Still, make catalogs may work just fine, if only mkdir -p is used there instead of mkdir.

Also, now that you pointed out that make bindcatalogs does not need catalog files anyway, maybe it should be renamed to make bindcatkeys :)? Or something less specific, like make bindlocales for example?

comment:3 by humdinger, 6 years ago

I've never actually used separate catalog files for localization. They may come in useful when you'd otherwise would have to update a huge package, just for an additional language. Then you could rather offer a small language pack that installs the catalog to /boot/system/data/locale/catalogs/yourappname
Theoretically... as I said, I never tried that...

Also, now that you pointed out that make bindcatalogs does not need catalog files anyway, maybe it should be renamed to make bindcatkeys :)? Or something less specific, like make bindlocales for example?

Sensible suggestion. I think the name comes from the process of converting catkeys to catalogs which then are added to the binary's resources.
However, keep in mind how many recipes and people's build scripts etc. would have to be changed.

comment:4 by ahwayakchih, 6 years ago

I've never actually used separate catalog files for localization. They may come in useful when you'd otherwise would have to update a huge package, just for an additional language

You're right. I tried it because i was following guide on how to localize apps and was trying everything.

Looks like either mkdir -p needs to be used, or APP_MIME_SIG has to be escaped to prevent application/ part of MIME type being used as sub-folder name.

However, keep in mind how many recipes and people's build scripts etc. would have to be changed.

Oh, you're right. Hmm... maybe rename it, but keep old one at the same time? Old one could echo deprecation warning and then call the new one internally.

comment:5 by waddlesplash, 6 years ago

No, I believe bindcatalogs makes catalogs internally and then binds them to the file. It just doesn't use the intermediate catalogs target. So the name is still appropriate.

comment:6 by ahwayakchih, 6 years ago

Makefile-engine part (https://github.com/haiku/haiku/blob/546fafa0a1d5adf099af6795f9eaf6a625e9fe33/data/develop/makefile-engine#L372-L373) looks like this:

bindcatalogs :
	for lc in $(LOCALES); do linkcatkeys -o $(TARGET) -s $(APP_MIME_SIG) -tr -l $$lc $(CATKEYS_DIR)/$$lc.catkeys; done

At first look there are catkeys everywhere there, but i've checked source of linkcatkeys and then kits/locale/DefaultCatalog.cpp and yeah, you're right: it "compiles" the same type of data (flattened {{BMessage}}) as to the catalog files. Thanks :).

I guess it's confusing because the tool name is linkcatkeys, it says it takes catalogFiles as input:

		"usage: linkcatkeys [-v] [-t(a|f|r)] [-o <outfile>] [-l <catalogLang>]\n"
		"                   -s <catalogSig> <catalogFiles>\n"

(https://github.com/haiku/haiku/blob/master/src/bin/locale/linkcatkeys.cpp#L30-L31), but really it reads data from catkey files (both when creating catalog files and when injecting data as resource) all the while makefile command name suggests it does something with catalog files... Maybe linkcatkeys usage should say <catkeyFiles>? Although internally it does still considers them "catalog" files, only in "plaintext" format ;).

Anyway, back to the topic: can we fix makefile-engine so make catalogs command works? Not sure how catalog files are found after installation. Should it be a folder named after full MIME, e.g., application/x-vnd.vendor.app (so, slash should be escaped somehow), or a folder path, where application/ part of MIME is parent folder of x-vnd.vendor.app folder (in which case mkdir -p would fix the problem)?

Version 0, edited 6 years ago by ahwayakchih (next)
Note: See TracTickets for help on using tickets.