Skip to content

pkg/pkg.mk: use intermediate state files#13036

Merged
fjmolinas merged 6 commits intoRIOT-OS:masterfrom
basilfx:feature/save_state_and_dependencies
Jan 8, 2020
Merged

pkg/pkg.mk: use intermediate state files#13036
fjmolinas merged 6 commits intoRIOT-OS:masterfrom
basilfx:feature/save_state_and_dependencies

Conversation

@basilfx
Copy link
Copy Markdown
Member

@basilfx basilfx commented Jan 6, 2020

Contribution description

This is an updated version of #11553 by @cladmi . I did my best to fix all the merge errors. It might be a fix for #13030.

I don't have that much Makefile experience, so I hope someone can help me to get this sorted out.

Testing procedure

Copy pasted:

  • Build all packages (lets see CI)
  • See if it is indeed incremental (on packages with and without patches)
  • See if it detects package modification (removal/addition of patches)

Issues/PRs references

#11553
#13030

@basilfx basilfx added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Area: pkg Area: External package ports labels Jan 6, 2020
@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 6, 2020

Some tests I performed, that turned out to work OK.

Git package with patches:

  • compiled tests/pkg_u8g2 (clean) -> full compile
  • compiled tests/pkg_u8g2 (dirty) -> no recompile
  • touched pkg/u8g2/Makefile, then compiled tests/pkg_u8g2 (dirty) -> git clean + full compile

Git package without patches:

  • compiled tests/cpu_efm32_features (clean) -> full compile
  • compiled tests/cpu_efm32_features (dirty) -> no recompile
  • touched pkg/gecko_sdk/Makefile, then compiled tests/cpu_efm32_features (dirty) -> git clean + no recompile

@basilfx basilfx added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 6, 2020
@basilfx basilfx force-pushed the feature/save_state_and_dependencies branch 2 times, most recently from 9da176b to 4b4edd3 Compare January 7, 2020 10:31
@fjmolinas
Copy link
Copy Markdown
Contributor

@basilfx are you basing you squash commits on testing for every pkg? Maybe we can split up testing?

@fjmolinas
Copy link
Copy Markdown
Contributor

@basilfx are you basing you squash commits on testing for every pkg? Maybe we can split up testing?

I'm very interested int his one as well and would like to see it in for the release.

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 7, 2020

@fjmolinas Yeah, I was squashing them directly, sorry ;-)

I'll add new commits for next fixes. But I hope that most of them are solved right now. We'll see in a few minutes.

@fjmolinas
Copy link
Copy Markdown
Contributor

I merged #12805 without thinkins of this PR, sorry.. will stall other pkgs until this one gets in.

@fjmolinas
Copy link
Copy Markdown
Contributor

@basilfx basilfx force-pushed the feature/save_state_and_dependencies branch from 4b4edd3 to a336810 Compare January 7, 2020 13:34
@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 7, 2020

@fjmolinas Yes, on it. Will also rebase on master to include utensor.

Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

@fjmolinas
Copy link
Copy Markdown
Contributor

pkg/relic also needs fixing, here is a gist https://gist.github.com/fjmolinas/3d77a86bfd6a87e4a1cfb46bb1dc863c.

@fjmolinas
Copy link
Copy Markdown
Contributor

@basilfx how should we proceed with testing? make per pkg test? We have already tested a bunch anyway.

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 7, 2020

@fjmolinas I'm not sure what we should test more. I'm quite sure that every package has at least one application to test it, and they all seem to work. Maybe @kaspar030 can give some suggestions?

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 7, 2020

@fjmolinas If you agree then I will squash it, clean up the messages and remove the WIP tag. Then we have a clean slate again for reviewing.

@fjmolinas
Copy link
Copy Markdown
Contributor

@fjmolinas If you agree then I will squash it, clean up the messages and remove the WIP tag. Then we have a clean slate again for reviewing.

Yep go ahead!

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 7, 2020

@fjmolinas Before I do, do you know how I could improve pkg/u8g2/Makefile?

The additional steps in all: should only happen after patching. But solely adding an additional target $(PKG_PREPARED) doesn't work.

@fjmolinas
Copy link
Copy Markdown
Contributor

fjmolinas commented Jan 7, 2020

The additional steps in all: should only happen after patching. But solely adding an additional target $(PKG_PREPARED) doesn't work.

I'm not sure I understand all already has $(PKG_PREPARED) as a prerequisite in pkg/pkg.mk: all: $(PKG_PREPARED) and that depends on $(PKG_PATCH) so the dependency is already met.

Or by improve you mean you want to move them out of the all target?

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 7, 2020

The additional steps in all: should only happen after patching. But solely adding an additional target $(PKG_PREPARED) doesn't work.

I'm not sure I understand all already has $(PKG_PREPARED) as a prerequisite in pkg/pkg.mk: all: $(PKG_PREPARED) and that depends on $(PKG_PATCH) so the dependency is already met.

Or by improve you mean you want to move them out of the all target?

Currently, when recompiling, the files are copied again. One of these files is u8g2_riotos.c, that is compiled every time.

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 7, 2020

Also, I think the whole git-downloaded target can be removed, right? it still exists in some dist/tools/* packages, but we could removed it without consequences for dist/tools/kconfiglib.

@fjmolinas
Copy link
Copy Markdown
Contributor

Also, I think the whole git-downloaded target can be removed, right? it still exists in some dist/tools/* packages, but we could removed it without consequences for dist/tools/kconfiglib.

Yes it what I was saying when commenting on kconfiglib. Before all dist/tools needed git-downloaded because there was no prepare stage, this is not the case since thet include pkg/pkg.mk which makes the dependency on PKG_DOWNLOADED.

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 7, 2020

Ok, cool. I though you were only talking about the changes I made to some of the dist/tools/* files :-)

@fjmolinas
Copy link
Copy Markdown
Contributor

Currently, when recompiling, the files are copied again. One of these files is u8g2_riotos.c, that is compiled every time.

Ohh ok, hmm... I'm not sure.., how do you check that it is compiled every time?

@fjmolinas
Copy link
Copy Markdown
Contributor

If you would run QUIET=0 make, you'll see it compiles again (GCC is invoked every time for some U8g2 files).

Oh this I do see, but that was not the case before right? I seem to recall it not being the case at one point.

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 8, 2020

If I remove a patch, it keeps recompiling. The contents of bin/pkg/native/u8g2/.pkg-state.git-patched.d is:

/home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-patched: /home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0001-add-RIOT-OS-interface.patch /home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded Makefile /home/basilfx/RIOT/RIOT/pkg/pkg.mk /home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0002-test.patch
/home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0001-add-RIOT-OS-interface.patch:
/home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded:
Makefile:
/home/basilfx/RIOT/RIOT/pkg/pkg.mk:
/home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0002-test.patch:

Note that it still depends on the 0002-test.patch, that I removed.

So I guess this file should be updated whenever the folder with the patches change?

@fjmolinas
Copy link
Copy Markdown
Contributor

If I remove a patch, it keeps recompiling. The contents of bin/pkg/native/u8g2/.pkg-state.git-patched.d is.

/home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-patched: /home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0001-add-RIOT-OS-interface.patch /home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded Makefile /home/basilfx/RIOT/RIOT/pkg/pkg.mk /home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0002-test.patch
/home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0001-add-RIOT-OS-interface.patch:
/home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded:
Makefile:
/home/basilfx/RIOT/RIOT/pkg/pkg.mk:
/home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0002-test.patch:

So I guess this file should be updated whenever the folder with the patches change?

I was getting to the same thing: this seems to fix it

$(PKG_PATCHED): $(PKG_PATCHES) $(PKG_DOWNLOADED) $(MAKEFILE_LIST)
	rm -r $(PKG_PATCHED).d
	$(call gen_dependency_files,[email protected],$^)
	$(Q)$(GIT_IN_PKG) clean $(GIT_QUIET) -xdff '**' $(PKG_STATE:$(PKG_BUILDDIR)/%=':!%*')
	$(Q)$(GIT_IN_PKG) checkout $(GIT_QUIET) -f $(PKG_VERSION)
	$(Q)$(GIT_IN_PKG) $(GITFLAGS) am $(GITAMFLAGS) $(PKG_PATCHES) </dev/null
	@touch $@

But not sure why $(file >$1,$@: $2) doesnt overwrrite the file.

@fjmolinas
Copy link
Copy Markdown
Contributor

I was getting to the same thing: this seems to fix it This removes the file altogether so wrong fix.

@fjmolinas
Copy link
Copy Markdown
Contributor

fjmolinas commented Jan 8, 2020

/home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-patched: /home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0001-add-RIOT-OS-interface.patch /home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded Makefile /home/basilfx/RIOT/RIOT/pkg/pkg.mk /home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0002-test.patch
/home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0001-add-RIOT-OS-interface.patch:
/home/basilfx/RIOT/RIOT/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded:
Makefile:
/home/basilfx/RIOT/RIOT/pkg/pkg.mk:
/home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0002-test.patch:

From this we can see the issue is that home/basilfx/RIOT/RIOT/pkg/u8g2/patches/0002-test.patch: is present in the MAKEFILE_LIST variable.

I think the file just needs to be deleted, its overwriting but not cleaning the old content.

@fjmolinas
Copy link
Copy Markdown
Contributor

fjmolinas commented Jan 8, 2020

Ok, I bumped my head against the wall and said a lot of stupid things. But now I understand (the following helped me as well http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/).

When we generate $(PKG_PATCHED).d we generate a file of the sort:

pkg-state.git-patched: $(PKG_PATCHED)/pkg/u8g2/patches/0001-add-RIOT-OS-interface.patch $(PKG_PATCHED)/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded  Makefile $(PKG_PATCHED)/pkg/pkg.mk $(PKG_PATCHED)/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-patched.d
$(PKG_PATCHED)/pkg/u8g2/patches/0001-add-RIOT-OS-interface.patch:
$(PKG_PATCHED)/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded:
Makefile:
$(PKG_PATCHED)/pkg/pkg.mk:
$(PKG_PATCHED)/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-patched.d:

The first line is important since it adds the old pre-requisites as a pre-requisite for $(PKG_PATCHED). This is needed when a pre-requisites is removed since otherwise $(PKG_PATCHED) wouldn't get built since none of the current pre-requisites have change (Only dissapeared).

The Issue was that we were generating the new requistes with all pre-requisites:

	$(call gen_dependency_files,[email protected],$^)

including the old ones we just added!!! so of course it gets re-built all the time, duh. So instead of doing that lets only use the current pre-requisites, edit: and add some prints.

index eff633a6f..cedc654ba 100644
--- a/pkg/pkg.mk
+++ b/pkg/pkg.mk
@@ -69,23 +69,31 @@ GIT_IN_PKG = git -C $(PKG_BUILDDIR) --git-dir=.git --work-tree=.
 #   $1: output file name
 gen_dependency_files = $(file >$1,$@: $2)$(foreach f,$2,$(file >>$1,$(f):))
 
+# When $(PKG_PATCHED).d is included $(PKG_PATCHED) pre-requisites will include
+# the old pre-requisites forcing a rebuild on pre-requisite removal, but we do
+# not want to generate $(PKG_PATCHED).d with the old pre-requisites
+PKG_PATCHED_PRE_REQUISITES = $(PKG_PATCHES) $(PKG_DOWNLOADED) $(MAKEFILE_LIST)
+
 # Patch the package
 # * create dependencies files
 # * clean, without removing the 'state' files
 # * checkout the wanted base commit
 # * apply patches if there are any. (If none, it does nothing)
-$(PKG_PATCHED): $(PKG_PATCHES) $(PKG_DOWNLOADED) $(MAKEFILE_LIST)
-       $(call gen_dependency_files,[email protected],$^)
+$(PKG_PATCHED): $(PKG_PATCHED_PRE_REQUISITES)
+       $(info [INFO] patch $(PKG_NAME))
+       $(call gen_dependency_files,[email protected],$(PKG_PATCHED_PRE_REQUISITES))
        $(Q)$(GIT_IN_PKG) clean $(GIT_QUIET) -xdff '**' $(PKG_STATE:$(PKG_BUILDDIR)/%=':!%*')
        $(Q)$(GIT_IN_PKG) checkout $(GIT_QUIET) -f $(PKG_VERSION)
        $(Q)$(GIT_IN_PKG) $(GITFLAGS) am $(GITAMFLAGS) $(PKG_PATCHES) </dev/null
        @touch $@
 
 $(PKG_DOWNLOADED): $(MAKEFILE_LIST) | $(PKG_BUILDDIR)/.git
+       $(info [INFO] updating $(PKG_NAME) $(PKG_DOWNLOADED))
        $(Q)$(GIT_IN_PKG) fetch $(GIT_QUIET) $(PKG_URL) $(PKG_VERSION)
        echo $(PKG_VERSION) > $@
 
 $(PKG_BUILDDIR)/.git:
+       $(info [INFO] cloning $(PKG_NAME))
        $(Q)rm -Rf $(PKG_BUILDDIR)
        $(Q)mkdir -p $(PKG_BUILDDIR)
        $(Q)$(GITCACHE) clone $(PKG_URL) $(PKG_VERSION) $(PKG_BUILDDIR)

@fjmolinas
Copy link
Copy Markdown
Contributor

Testing:

  • First build after distclean
make -C tests/pkg_u8g2/
make: Entering directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
Building application "tests_pkg_u8g2" for "native" with MCU "native".

[INFO] cloning u8g2
Cloning into '/home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2'...
remote: Enumerating objects: 265, done.
remote: Counting objects: 100% (265/265), done.
remote: Compressing objects: 100% (209/209), done.
remote: Total 31275 (delta 132), reused 158 (delta 50), pack-reused 31010
Receiving objects: 100% (31275/31275), 79.94 MiB | 22.32 MiB/s, done.
Resolving deltas: 100% (20663/20663), done.
Updating files: 100% (3146/3146), done.
HEAD is now at f08ff974 issue #556
[INFO] updating u8g2 /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded
echo f08ff974c03e5c848bc5d2ae3fddb6a97897881a > /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/.pkg-state.git-downloaded
[INFO] patch u8g2
"make" -C /home/francisco/workspace/RIOT2/pkg/u8g2
cp -u src/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/Makefile
cp -u src/csrc/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/Makefile
cp -u src/csrc/u8g2_riotos.c /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/u8g2_riotos.c
cp -u src/sys/sdl/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/sdl/common/Makefile
cp -u src/sys/utf8/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common/Makefile
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common
"make" -C /home/francisco/workspace/RIOT2/boards/native
"make" -C /home/francisco/workspace/RIOT2/boards/native/drivers
"make" -C /home/francisco/workspace/RIOT2/core
"make" -C /home/francisco/workspace/RIOT2/cpu/native
"make" -C /home/francisco/workspace/RIOT2/cpu/native/periph
"make" -C /home/francisco/workspace/RIOT2/cpu/native/stdio_native
"make" -C /home/francisco/workspace/RIOT2/cpu/native/vfs
"make" -C /home/francisco/workspace/RIOT2/drivers
"make" -C /home/francisco/workspace/RIOT2/drivers/periph_common
"make" -C /home/francisco/workspace/RIOT2/sys
"make" -C /home/francisco/workspace/RIOT2/sys/auto_init
"make" -C /home/francisco/workspace/RIOT2/sys/div
"make" -C /home/francisco/workspace/RIOT2/sys/test_utils/interactive_sync
"make" -C /home/francisco/workspace/RIOT2/sys/xtimer
   text    data     bss     dec     hex filename
  50889     588   50140  101617   18cf1 /home/francisco/workspace/RIOT2/te
  • second build no changes
make -C tests/pkg_u8g2/
make: Entering directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
Building application "tests_pkg_u8g2" for "native" with MCU "native".

make[1]: Nothing to be done for 'prepare'.
"make" -C /home/francisco/workspace/RIOT2/pkg/u8g2
cp -u src/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/Makefile
cp -u src/csrc/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/Makefile
cp -u src/csrc/u8g2_riotos.c /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/u8g2_riotos.c
cp -u src/sys/sdl/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/sdl/common/Makefile
cp -u src/sys/utf8/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common/Makefile
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common
"make" -C /home/francisco/workspace/RIOT2/boards/native
"make" -C /home/francisco/workspace/RIOT2/boards/native/drivers
"make" -C /home/francisco/workspace/RIOT2/core
"make" -C /home/francisco/workspace/RIOT2/cpu/native
"make" -C /home/francisco/workspace/RIOT2/cpu/native/periph
"make" -C /home/francisco/workspace/RIOT2/cpu/native/stdio_native
"make" -C /home/francisco/workspace/RIOT2/cpu/native/vfs
"make" -C /home/francisco/workspace/RIOT2/drivers
"make" -C /home/francisco/workspace/RIOT2/drivers/periph_common
"make" -C /home/francisco/workspace/RIOT2/sys
"make" -C /home/francisco/workspace/RIOT2/sys/auto_init
"make" -C /home/francisco/workspace/RIOT2/sys/div
"make" -C /home/francisco/workspace/RIOT2/sys/test_utils/interactive_sync
"make" -C /home/francisco/workspace/RIOT2/sys/xtimer
   text    data     bss     dec     hex filename
  50889     588   50140  101617   18cf1 /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/tests_pkg_u8g2.elf
make: Leaving directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
  • add a patch, repuilds pkg (can check with QUIET=1 )
make -C tests/pkg_u8g2/
make: Entering directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
Building application "tests_pkg_u8g2" for "native" with MCU "native".

[INFO] patch u8g2
"make" -C /home/francisco/workspace/RIOT2/pkg/u8g2
cp -u src/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/Makefile
cp -u src/csrc/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/Makefile
cp -u src/csrc/u8g2_riotos.c /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/u8g2_riotos.c
cp -u src/sys/sdl/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/sdl/common/Makefile
cp -u src/sys/utf8/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common/Makefile
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common
"make" -C /home/francisco/workspace/RIOT2/boards/native
"make" -C /home/francisco/workspace/RIOT2/boards/native/drivers
"make" -C /home/francisco/workspace/RIOT2/core
"make" -C /home/francisco/workspace/RIOT2/cpu/native
"make" -C /home/francisco/workspace/RIOT2/cpu/native/periph
"make" -C /home/francisco/workspace/RIOT2/cpu/native/stdio_native
"make" -C /home/francisco/workspace/RIOT2/cpu/native/vfs
"make" -C /home/francisco/workspace/RIOT2/drivers
"make" -C /home/francisco/workspace/RIOT2/drivers/periph_common
"make" -C /home/francisco/workspace/RIOT2/sys
"make" -C /home/francisco/workspace/RIOT2/sys/auto_init
"make" -C /home/francisco/workspace/RIOT2/sys/div
"make" -C /home/francisco/workspace/RIOT2/sys/test_utils/interactive_sync
"make" -C /home/francisco/workspace/RIOT2/sys/xtimer
   text    data     bss     dec     hex filename
  50889     588   50140  101617   18cf1 /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/tests_pkg_u8g2.elf
make: Leaving directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
  • remove patch
make -C tests/pkg_u8g2/
make: Entering directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
Building application "tests_pkg_u8g2" for "native" with MCU "native".

[INFO] patch u8g2
"make" -C /home/francisco/workspace/RIOT2/pkg/u8g2
cp -u src/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/Makefile
cp -u src/csrc/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/Makefile
cp -u src/csrc/u8g2_riotos.c /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/u8g2_riotos.c
cp -u src/sys/sdl/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/sdl/common/Makefile
cp -u src/sys/utf8/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common/Makefile
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common
"make" -C /home/francisco/workspace/RIOT2/boards/native
"make" -C /home/francisco/workspace/RIOT2/boards/native/drivers
"make" -C /home/francisco/workspace/RIOT2/core
"make" -C /home/francisco/workspace/RIOT2/cpu/native
"make" -C /home/francisco/workspace/RIOT2/cpu/native/periph
"make" -C /home/francisco/workspace/RIOT2/cpu/native/stdio_native
"make" -C /home/francisco/workspace/RIOT2/cpu/native/vfs
"make" -C /home/francisco/workspace/RIOT2/drivers
"make" -C /home/francisco/workspace/RIOT2/drivers/periph_common
"make" -C /home/francisco/workspace/RIOT2/sys
"make" -C /home/francisco/workspace/RIOT2/sys/auto_init
"make" -C /home/francisco/workspace/RIOT2/sys/div
"make" -C /home/francisco/workspace/RIOT2/sys/test_utils/interactive_sync
"make" -C /home/francisco/workspace/RIOT2/sys/xtimer
   text    data     bss     dec     hex filename
  50889     588   50140  101617   18cf1 /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/tests_pkg_u8g2.elf
make: Leaving directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
  • check it is not recompiling
QUIET=1 make -C tests/pkg_u8g2/
make: Entering directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
printf "%s " MODULE_auto_init MODULE_board MODULE_core MODULE_core_msg MODULE_cpu MODULE_div MODULE_native-drivers MODULE_periph MODULE_periph_common MODULE_periph_gpio MODULE_periph_pm MODULE_periph_timer MODULE_periph_uart MODULE_stdin MODULE_stdio_native MODULE_sys MODULE_test_utils_interactive_sync MODULE_u8g2_utf8 MODULE_xtimer PKG_u8g2 \
  | awk 'BEGIN {RS=" "}{ gsub("-", "_", $0); \
      printf "config %s\n\tbool\n\tdefault y\n", toupper($0)}' \
  | /home/francisco/workspace/RIOT2/dist/tools/lazysponge/lazysponge.py --verbose /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/generated/Kconfig.dep
Keeping old /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/generated/Kconfig.dep (88c67795065d4a643ff10ec861a11f81)
\
if ! test -f /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/generated/.editedconfig; then \
  if ! test -z ""; then \
    /home/francisco/workspace/RIOT2/dist/tools/kconfiglib/merge_config.py /home/francisco/workspace/RIOT2/Kconfig /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/generated/merged.config  ; \
  else \
    rm -f /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/generated/merged.config; \
  fi \
fi
Building application "tests_pkg_u8g2" for "native" with MCU "native".

KCONFIG_CONFIG=/home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/generated/merged.config /home/francisco/workspace/RIOT2/dist/tools/kconfiglib/genconfig.py --header-path /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/generated/autoconf.h /home/francisco/workspace/RIOT2/Kconfig
'/home/francisco/workspace/RIOT2/dist/tools/genconfigheader/genconfigheader.sh' -DTEST_OUTPUT=1 -DTEST_SPI=0 -DTEST_I2C=0 -DTEST_ADDR=0x3c -DTEST_PIN_CS=GPIO_PIN\(0,0\) -DTEST_PIN_DC=GPIO_PIN\(0,0\) -DTEST_PIN_RESET=GPIO_PIN\(0,0\) -DTEST_DISPLAY= -include '/home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/generated/autoconf.h' -DDEVELHELP -Werror -Wall -Wextra -pedantic -std=gnu11 -m32 -fstack-protector-all -ffunction-sections -fdata-sections -DDEBUG_ASSERT_VERBOSE -DRIOT_APPLICATION=\"tests_pkg_u8g2\" -DBOARD_NATIVE=\"native\" -DRIOT_BOARD=BOARD_NATIVE -DCPU_NATIVE=\"native\" -DRIOT_CPU=CPU_NATIVE -DMCU_NATIVE=\"native\" -DRIOT_MCU=MCU_NATIVE -fno-common -Wall -Wextra -Wmissing-include-dirs -fno-delete-null-pointer-checks -fdiagnostics-color -Wstrict-prototypes -Wold-style-definition -gz -Wformat=2 -Wformat-overflow -Wformat-truncation -include '/home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/riotbuild/riotbuild.h' -DRIOT_VERSION=\"2020.01-devel-1606-g7a962f-pull/13036\" -DMODULE_AUTO_INIT -DMODULE_BOARD -DMODULE_CORE -DMODULE_CORE_MSG -DMODULE_CPU -DMODULE_DIV -DMODULE_NATIVE_DRIVERS -DMODULE_PERIPH -DMODULE_PERIPH_COMMON -DMODULE_PERIPH_GPIO -DMODULE_PERIPH_PM -DMODULE_PERIPH_TIMER -DMODULE_PERIPH_UART -DMODULE_STDIN -DMODULE_STDIO_NATIVE -DMODULE_SYS -DMODULE_TEST_UTILS_INTERACTIVE_SYNC -DMODULE_U8G2 -DMODULE_U8G2_UTF8 -DMODULE_XTIMER \
        | '/home/francisco/workspace/RIOT2/dist/tools/lazysponge/lazysponge.py' --verbose '/home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/riotbuild/riotbuild.h.in'
Keeping old /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/riotbuild/riotbuild.h.in (f058070ed3985146aca16e72e3d113ed)
make[1]: Entering directory '/home/francisco/workspace/RIOT2/pkg/u8g2'
make[1]: Nothing to be done for 'prepare'.
make[1]: Leaving directory '/home/francisco/workspace/RIOT2/pkg/u8g2'
"make" -C /home/francisco/workspace/RIOT2/pkg/u8g2
make[1]: Entering directory '/home/francisco/workspace/RIOT2/pkg/u8g2'
cp -u src/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/Makefile
cp -u src/csrc/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/Makefile
cp -u src/csrc/u8g2_riotos.c /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc/u8g2_riotos.c
cp -u src/sys/sdl/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/sdl/common/Makefile
cp -u src/sys/utf8/common/Makefile /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common/Makefile
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2
make[2]: Entering directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2'
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/csrc
"make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2/sys/utf8/common
make[2]: Leaving directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/pkg/native/u8g2'
make[1]: Leaving directory '/home/francisco/workspace/RIOT2/pkg/u8g2'
DIRS=" " APPLICATION_BLOBS="" \
  "make" -C /home/francisco/workspace/RIOT2/tests/pkg_u8g2 -f /home/francisco/workspace/RIOT2/makefiles/application.inc.mk
make[1]: Entering directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
"make" -C /home/francisco/workspace/RIOT2/boards/native
make[2]: Entering directory '/home/francisco/workspace/RIOT2/boards/native'
"make" -C /home/francisco/workspace/RIOT2/boards/native/drivers
make[2]: Leaving directory '/home/francisco/workspace/RIOT2/boards/native'
"make" -C /home/francisco/workspace/RIOT2/core
make[2]: Entering directory '/home/francisco/workspace/RIOT2/core'
make[2]: Leaving directory '/home/francisco/workspace/RIOT2/core'
"make" -C /home/francisco/workspace/RIOT2/cpu/native
make[2]: Entering directory '/home/francisco/workspace/RIOT2/cpu/native'
"make" -C /home/francisco/workspace/RIOT2/cpu/native/periph
"make" -C /home/francisco/workspace/RIOT2/cpu/native/stdio_native
make[3]: Entering directory '/home/francisco/workspace/RIOT2/cpu/native/stdio_native'
make[3]: Leaving directory '/home/francisco/workspace/RIOT2/cpu/native/stdio_native'
"make" -C /home/francisco/workspace/RIOT2/cpu/native/vfs
make[2]: Leaving directory '/home/francisco/workspace/RIOT2/cpu/native'
"make" -C /home/francisco/workspace/RIOT2/drivers
make[2]: Entering directory '/home/francisco/workspace/RIOT2/drivers'
"make" -C /home/francisco/workspace/RIOT2/drivers/periph_common
make[3]: Entering directory '/home/francisco/workspace/RIOT2/drivers/periph_common'
make[3]: Leaving directory '/home/francisco/workspace/RIOT2/drivers/periph_common'
make[2]: Leaving directory '/home/francisco/workspace/RIOT2/drivers'
"make" -C /home/francisco/workspace/RIOT2/sys
make[2]: Entering directory '/home/francisco/workspace/RIOT2/sys'
"make" -C /home/francisco/workspace/RIOT2/sys/auto_init
make[3]: Entering directory '/home/francisco/workspace/RIOT2/sys/auto_init'
make[3]: Leaving directory '/home/francisco/workspace/RIOT2/sys/auto_init'
"make" -C /home/francisco/workspace/RIOT2/sys/div
make[3]: Entering directory '/home/francisco/workspace/RIOT2/sys/div'
make[3]: Leaving directory '/home/francisco/workspace/RIOT2/sys/div'
"make" -C /home/francisco/workspace/RIOT2/sys/test_utils/interactive_sync
"make" -C /home/francisco/workspace/RIOT2/sys/xtimer
make[3]: Entering directory '/home/francisco/workspace/RIOT2/sys/xtimer'
make[3]: Leaving directory '/home/francisco/workspace/RIOT2/sys/xtimer'
make[2]: Leaving directory '/home/francisco/workspace/RIOT2/sys'
make[1]: Leaving directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'
gcc /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/cpu/startup.o -Wl,--start-group /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/application_tests_pkg_u8g2.a  /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/auto_init.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/board.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/core.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/cpu.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/div.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/native-drivers.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/periph.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/stdio_native.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/sys.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/test_utils_interactive_sync.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/u8g2.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/u8g2_utf8.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/xtimer.a /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/periph_common.a -lm -Wl,--end-group -m32 -ldl -Wl,--gc-sections -ffunction-sections -Wl,-Map=/home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/tests_pkg_u8g2.map -o /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/tests_pkg_u8g2.elf
size  /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/tests_pkg_u8g2.elf
   text    data     bss     dec     hex filename
  50889     588   50140  101617   18cf1 /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/tests_pkg_u8g2.elf
mkdir -p /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native
touch /home/francisco/workspace/RIOT2/tests/pkg_u8g2/bin/native/.test
make: Leaving directory '/home/francisco/workspace/RIOT2/tests/pkg_u8g2'

@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 8, 2020

Thanks for looking into this issue! I can confirm it works as well.

Also confirmed that changing the pkg/u8g2/Makefile still triggers a rebuild, or changing any of the patches.

cladmi and others added 6 commits January 8, 2020 20:54
The file must not change the default goal otherwise it could change
packages behavior.
This should prevent issues where the Makefile use 'PKG_BUILDDIR' before
them being defined.

This will also allow changing the state targets to be file targets.
Rely on file creation and dependencies instead of .PHONY targets.
Files will be rebuilt when changing version as the main `Makefile` will
have been updated. All steps are re-done on version change.

When deleting patches, the '.prepare' step should be redone thanks
to the included 'patch-dep.inc' file (TODO TEST ME).

Implementation in order:

* '.git': means the repository has been cloned.
* '.git-downloaded': Fetches the wanted version
* '.git-prepared': will clean checkout the version and apply patches
Prepare for handling pkg state with files. So it requires having the
path defined before declaring targets. In addition, it cleans up the
old git-download target.
Prepare for handling pkg state with files. So it requires having the
path defined before declaring targets. In addition, it cleans up the
old git-download target.
@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 8, 2020

Murdock looks OK. Shall I give it another rebase?

I'm not sure which things we should test more. I guess that we covered most of it already.

@fjmolinas
Copy link
Copy Markdown
Contributor

Murdock looks OK. Shall I give it another rebase?

I'm not sure which things we should test more. I guess that we covered most of it already.

I think we should be ok, there are some needed cleanups I have noticed here and there, but the main functionality is OK:

I think yous should go ahead with the rebase :)

@basilfx basilfx force-pushed the feature/save_state_and_dependencies branch from e29370d to f08116f Compare January 8, 2020 21:03
Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK!

@fjmolinas
Copy link
Copy Markdown
Contributor

GO! Thanks a lot for taking over #11553 and getting the ball rolling @basilfx!

@fjmolinas fjmolinas merged commit c8461a4 into RIOT-OS:master Jan 8, 2020
@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented Jan 8, 2020

Thank you as well for all the help with reviewing, testing and Makefile-fixxing!

@basilfx basilfx deleted the feature/save_state_and_dependencies branch January 8, 2020 22:09
@haukepetersen
Copy link
Copy Markdown
Contributor

Seems like this PR broke PKG_SOURCE_LOCAL. Now when specifying e.g. PKG_SOURCE_LOCAL_NIMBLE=xxx make ..., the package is copied from the given location into the bin path, but it is not build anymore -> see #13055

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants