のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

b2g build error :Can't add inexistent file to zip

build.shのエラーです。

build/webapp-zip.js:311: Error: Error: Can't add inexistent file to zip : 
/home/user01/B2G_nexus/B2G/gaia/shared/style/responsive.css from: sms.gaiamobile.org
function addToZip(zip, pathInZip, file) {

  // Check @2x files
  if ( HIDPI != '*' && file.path.search('@2x') == -1 ) {
    var path2x = file.path.split('.')[0]+'@2x.'+file.path.split('.')[1];
    var file2x = new FileUtils.File(path2x);
    // @2x one will come later
    if ( file2x.exists() ) {
      return;
    }
  } else if ( file.path.search('@2x') != -1 ) {
     var pathInZip = pathInZip.split('@2x')[0]+pathInZip.split('@2x')[1];
  }

  if (isSubjectToBranding(file.path)) {
    file.append*1
    throw new Error('Can\'t add inexistent file to zip : ' + file.path); <===

確かにないな。

~/B2G_nexus/B2G/gaia/shared/style$ ls
README.md        buttons      confirm.css    headers      input_areas.css  switches
action_menu      buttons.css  edit_mode      headers.css  status           switches.css
action_menu.css  confirm      edit_mode.css  input_areas  status.css
 $cd B2G
 $ find ./ -name responsive.* -print
 ./gaia/apps/communications/contacts/js/utilities/responsive.js

homescreenで使用しているんだ。

以下のようなmakeを実行するとエラーがでる。

 $cd gaia
 $ make webapp-zip
 run-js-command  webapp-zip
 build/webapp-zip.js:311: Error: Error: Can't add inexistent file to zip :
 /home/m_fujii/B2G_nexus/B2G/gaia/shared/style/responsive.css from: sms.gaiamobile.org
 make: *** [webapp-zip] エラー 3

Makefileのこの部分

 266 # Generate profile/webapps/APP/application.zip
 267 webapp-zip: stamp-commit-hash install-xulrunner-sdk
 268 ifneq ($(DEBUG),1)
 269	@rm -rf apps/system/camera
 270	@cp -r apps/camera apps/system/camera
 271	@rm apps/system/camera/manifest.webapp
 272	@mkdir -p profile/webapps
 273	@$(call run-js-command, webapp-zip)
 274 endif
 417 .PHONY: install-xulrunner-sdk
 418 install-xulrunner-sdk:
 419 ifndef USE_LOCAL_XULRUNNER_SDK
 420 ifneq ($(XULRUNNER_SDK_DOWNLOAD),$(shell cat .xulrunner-url 2> /dev/null))
 421	rm -rf xulrunner-sdk
 422	$(DOWNLOAD_CMD) $(XULRUNNER_SDK_DOWNLOAD)
 423 ifeq ($(findstring MINGW32,$(SYS)), MINGW32)
 424	unzip xulrunner*.zip && rm xulrunner*.zip
 425 else
 426	tar xjf xulrunner*.tar.bz2 && rm xulrunner*.tar.bz2
 427 endif
 428	@echo $(XULRUNNER_SDK_DOWNLOAD) > .xulrunner-url
 429 endif
 430 endif # USE_LOCAL_XULRUNNER_SDK
432 define run-js-command
433	echo "run-js-command $1";                                                   \
434	JS_CONSTS='                                                                 \
435	const GAIA_DIR = "$(CURDIR)"; const PROFILE_DIR = "$(CURDIR)$(SEP)profile"; \
436	const GAIA_SCHEME = "$(SCHEME)"; const GAIA_DOMAIN = "$(GAIA_DOMAIN)";      \
437	const DEBUG = $(DEBUG); const LOCAL_DOMAINS = $(LOCAL_DOMAINS);             \
438	const HOMESCREEN = "$(HOMESCREEN)"; const GAIA_PORT = "$(GAIA_PORT)";       \
439	const GAIA_APP_SRCDIRS = "$(GAIA_APP_SRCDIRS)";                             \
440	const GAIA_LOCALES_PATH = "$(GAIA_LOCALES_PATH)";                           \
441	const LOCALES_FILE = "$(LOCALES_FILE)";                                     \
442	const BUILD_APP_NAME = "$(BUILD_APP_NAME)";                                 \
443	const PRODUCTION = "$(PRODUCTION)";                                         \
444	const GAIA_OPTIMIZE = "$(GAIA_OPTIMIZE)";                                   \
445	const HIDPI = "$(HIDPI)";                                     \
446	const DOGFOOD = "$(DOGFOOD)";                                               \
447	const OFFICIAL = "$(MOZILLA_OFFICIAL)";                                     \
448	const GAIA_DEFAULT_LOCALE = "$(GAIA_DEFAULT_LOCALE)";                       \
449	const GAIA_INLINE_LOCALES = "$(GAIA_INLINE_LOCALES)";                       \
450	const GAIA_ENGINE = "xpcshell";                                             \
451	const GAIA_DISTRIBUTION_DIR = "$(GAIA_DISTRIBUTION_DIR)";               	\
452	';                                                                          \
453	$(XULRUNNERSDK) $(XPCSHELLSDK) -e "$$JS_CONSTS" -f build/utils.js "build/$(strip $1).js"
454 endef
 658 # Generate a text file containing the current changeset of Gaia
 659 # XXX I wonder if this should be a replace-in-file hack. This would let us
 660 #     let us remove the update-offline-manifests target dependancy of the
 661 #     default target.
 662 stamp-commit-hash:
 663 	@(if [ -e gaia_commit_override.txt ]; then \
 664		cp gaia_commit_override.txt apps/settings/resources/gaia_commit.txt; \
 665	elif [ -d ./.git ]; then \
 666		git log -1 --format="%H%n%at" HEAD > apps/settings/resources/gaia_commit.txt; \
 667	else \
 668		echo 'Unknown Git commit; build date shown here.' >
                    apps/settings/resources/gaia_commit.txt; \
 669		date +%s >> apps/settings/resources/gaia_commit.txt; \
 670	fi)
 gaia/build/webapp-zip.jsのdumpのcomment out
 function debug(msg) {
   //dump('-*- webapps-zip.js ' + msg + '\n');
   dump('-*- webapps-zip.js ' + msg + '\n');
 }

webapp-zipのdump log

 $cd gaia
 $ make webapp-zip
  run-js-command  webapp-zip
  -*- webapps-zip.js # Create zip for: system.gaiamobile.org
  (略)
  -*- webapps-zip.js  +file to zip shared/style/action_menu/images/ui/alpha.png
  -*- webapps-zip.js  +file to zip shared/style/action_menu/images/ui/default.png
  build/webapp-zip.js:312: Error: Error: Can't add inexistent file to zip : 
  /home/user01/B2G_nexus/B2G/gaia/shared/style/responsive.css from: sms.gaiamobile.org
  make: *** [webapp-zip] エラー 3
 webapp.log 直

修正したファイルを元にもどす。

 $ git status
 # On branch master
 # Changes not staged for commit:
 #   (use "git add ..." to update what will be committed)
 #   (use "git checkout -- ..." to discard changes in working directory)
 #
 #	modified:   apps/music/js/metadata_scripts.js
 #	modified:   build/webapp-zip.js                <=== これが変更したファイル
 #
 $ git checkout --  build/webapp-zip.js                 <=== 変更を戻す
 $ git status
 # On branch master
 # Changes not staged for commit:
 #   (use "git add ..." to update what will be committed)
 #   (use "git checkout -- ..." to discard changes in working directory)
 #
 #	modified:   apps/music/js/metadata_scripts.js
 #
function debug(msg) {
  //dump('-*- webapps-zip.js ' + msg + '\n');
}

*1:OFFICIAL == 1) ? 'official' : 'unofficial'); } if (!file.exists(