Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. DEL_FILE inside project.pro
Qt 6.11 is out! See what's new in the release blog

DEL_FILE inside project.pro

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
12 Posts 4 Posters 8.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FrankiPL
    wrote on last edited by
    #3

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Did you took a look at PRE_TARGETDEPS ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • F Offline
        F Offline
        FrankiPL
        wrote on last edited by
        #5

        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_QMake

        I 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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Just thought about something: you can have several commands in QMAKE_POST_LINK so you could call the delete command before reopen directly there.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Marek
            wrote on last edited by
            #7

            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/../repository

            but 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 &&

            1 Reply Last reply
            0
            • F Offline
              F Offline
              FrankiPL
              wrote on last edited by
              #8

              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

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #9

                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...

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Marek
                  wrote on last edited by
                  #10

                  The point is that I have learnd some more about QMAKE files and thaat whats matter ;)

                  Cheers
                  Marek

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    flart
                    wrote on last edited by
                    #11

                    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?

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      You can your DEL_DIR for folders.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved