Solved DEL_FILE inside project.pro
-
Hi,
I have in installer.pro among others:
# create offline installer INPUT = $$PWD/config/config.xml $$PWD/packages offlineInstaller.depends = copydata offlineInstaller.input = INPUT offlineInstaller.output = $$INSTALLER_OFFLINE offlineInstaller.commands = $$(QTDIR)/../../QtIFW2.0.3/bin/binarycreator --offline-only -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT} offlineInstaller.CONFIG += target_predeps no_link combine QMAKE_EXTRA_COMPILERS += offlineInstaller # create repository for release CONFIG(release, debug|release) { #HERE ADDITIONAL STEP QMAKE_POST_LINK += $$(QTDIR)/../../QtIFW2.0.3/bin/repogen -p $$PWD/packages -i my_app_package --update $$OUT_PWD/../repository }
So first offline installer is generated and then repository for updates for old versions.
I need to insert step between the two, as update repository must not have some files/direcories that installer needs.I have tried some options that I have seen on the web, but nothing seems to work
deleteConfig.commands = $(DEL_FILE) $$PWD/packages/my_app_package/data/app.conf deleteConfig.output = $$PWD/packages/my_app_package/data/ deleteConfig.input = $$PWD/packages/my_app_package/data/ QMAKE_EXTRA_COMPILERS += deleteConfig
OR
QMAKE = del $$PWD/packages/my_app_package/data/app.conf
OR
QMAKE_CLEAN += $$PWD/packages/my_app_package/data/app.conf
OR
rmfile.commands = $(DEL_FILE) $$PWD/packages/my_app_package/data/app.conf first.depends = $(first) rmfile export(first.depends) export(rmfile.commands) QMAKE_EXTRA_TARGETS += first rmfile
Is something essentially wrong with adding the step to delete file before repogen ?
Best Regards
Marek -
Did you took a look at PRE_TARGETDEPS ?
-
Hi,
Thank you for hint.
I have looked at PRE_TARGETDEPS, though there is not much documentation, except undocumented ;)
http://paulf.free.fr/undocumented_qmake.html
https://wiki.qt.io/Undocumented_QMakeI have managed to add del file, but the problem is that delete file doesnt wait for installer creation process to finish (which is in fact QMAKE_EXTRA_COMPILERS ). There is option CONFIG+= target_predeps but it doesnt wait, maybe because there is no real target in my .pro file
I have used dirty hack to wait some seconds, but it is really not the solution .
Full .pro file below.
How to make delete file step to wait for QMAKE_EXTRA_COMPILERS to finish, or maybe I should rewrite everything using TARGETS with command to generate installer and then repo?
Will Makefile wait for each target to finish specified command?# Before run make project, need to put executable file and dlls into # $$PWD/installer/packages/my_package_app/data TEMPLATE = aux CONFIG(debug, debug|release) { INSTALLER_OFFLINE = $$OUT_PWD/../InstallerDebug/MyApp.offline INSTALLER_ONLINE = $$OUT_PWD/../InstallerDebug/MyApp.online DESTDIR_WIN = $$PWD/packages/my_package_app/data DESTDIR_WIN ~= s,/,\\,g PWD_WIN = $$OUT_PWD/../MyAppDebug PWD_WIN ~= s,/,\\,g copydata.commands = $(COPY_DIR) $$PWD_WIN $$DESTDIR_WIN first.depends = $(first) copydata export(first.depends) export(copydata.commands) QMAKE_EXTRA_TARGETS += first copydata } else { INSTALLER_OFFLINE = $$OUT_PWD/../InstallerRelease/MyApp.offline INSTALLER_ONLINE = $$OUT_PWD/../InstallerRelease/MyApp.online # package data dir DESTDIR_WIN = $$PWD/packages/my_package_app/data DESTDIR_WIN ~= s,/,\\,g # app data dir PWD_WIN = $$OUT_PWD/../MyAppRelease PWD_WIN ~= s,/,\\,g copydata.commands = $(COPY_DIR) $$PWD_WIN $$DESTDIR_WIN first.depends = $(first) copydata export(first.depends) export(copydata.commands) QMAKE_EXTRA_TARGETS += first copydata } # offline installer INPUT = $$PWD/config/config.xml $$PWD/packages offlineInstaller.depends = copydata offlineInstaller.input = INPUT offlineInstaller.output = $$INSTALLER_OFFLINE offlineInstaller.commands = $$(QTDIR)/../../QtIFW2.0.3/bin/binarycreator --offline-only -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT} offlineInstaller.CONFIG += target_predeps no_link combine QMAKE_EXTRA_COMPILERS += offlineInstaller installerOk.depends=copydata installerOk.commands=@echo sleep command QMAKE_EXTRA_TARGETS += installerOk # generate repo CONFIG(release, debug|release) { sleepCmd.depends=installerOk sleepCmd.commands=ping -n 120 127.0.0.1 > null QMAKE_EXTRA_TARGETS += sleepCmd FILE_TO_DEL=$$PWD/packages/my_app_package/data/app.conf FILE_TO_DEL ~= s,/,\\,g deleteConfig.depends = sleepCmd deleteConfig.commands = $(DEL_FILE) $$FILE_TO_DEL deleteConfig.output = $$PWD/packages/my_app_package/data/ deleteConfig.input = $$PWD/packages/my_app_package/data/ QMAKE_EXTRA_TARGETS += deleteConfig PRE_TARGETDEPS+=deleteConfig sleepCmd installerOk QMAKE_POST_LINK += $$(QTDIR)/../../QtIFW2.0.3/bin/repogen -p $$PWD/packages -i my_app_package --update $$OUT_PWD/../repository } DISTFILES += \ packages/my_app_package/meta/package.xml \ config/config.xml
Best Regards
Marek -
Just thought about something: you can have several commands in QMAKE_POST_LINK so you could call the delete command before
reopen
directly there. -
I have tried this and I did:
QMAKE_POST_LINK +=$(DEL_FILE) $$FILE_TO_DEL
QMAKE_POST_LINK += $$(QTDIR)/../../QtIFW2.0.3/bin/repogen -p $$PWD/packages -i my_app_package --update $$OUT_PWD/../repositorybut then commands are executed as one with DEL_FILE at the beginning - not good ;)
luckily it failed with - unknown argument.I will try to separate them with ; or &&
-
it works.
Short update:
FILE_TO_DEL=$$PWD/packages/cutecomfort.panel/data/ccbox-panel.conf FILE_TO_DEL ~= s,/,\\,g QMAKE_POST_LINK += @echo removing file ; QMAKE_POST_LINK += $(DEL_FILE) $$FILE_TO_DEL ; QMAKE_POST_LINK += $$(QTDIR)/../../QtIFW2.0.3/bin/repogen -p $$PWD/packages -i my_app_package --update $$OUT_PWD/../repository }
Thank you.
Marek -
I used
RETURN = $$escape_expand(\\r\\n)
and then add$$RETURN
between line of commands in order to separate them.IIRC, there could be a simpler way for that in Qt 5 but right now I don't remember...
-
The point is that I have learnd some more about QMAKE files and thaat whats matter ;)
Cheers
Marek -
It works for few files:
RETURN = $$escape_expand(\n\t) FILE_TO_DEL= test/1.txt test/2.txt FILE_TO_DEL ~= s,/,\\,g QMAKE_POST_LINK += $$RETURN $(DEL_FILE) $$FILE_TO_DEL ;
But It's don't work with recursive folder remove, or using
test/*.txt
. It freezes.There is still no pretty
QMAKE_CLEAN
-way? -
You can your
DEL_DIR
for folders.