0
going

Incomplete clean-up of source code.

Recommended Posts

I wish you all good health.

Using the "Armbian" build system, I noticed two bad points:

1 - incomplete cleaning of the source code before starting a new compilation, seen when patches add new files to the tree.

2 - Debian kernel source package includes the git directory.

 

1) All I do I'm fixing the version kernel (KERNELBRANCH="tag:v4.14.40") and collect several variants for one Board, changing the patchset for each version, adding or removing some.

Before each new compilation I'm doing a test of the purity of the source.

clean_repo()
{
	display_alert "clean_repo $PWD"
	#git status -s
	git reset --hard HEAD	# First, return the modified files.
	git clean -df			# Then delete all new, added files.
	#git status
}


compile_kernel()
{
	# A simple check ensures that we start with a clean slate.
	cd $SRC/cache/sources/$LINUXSOURCEDIR
	if [ "X$(git status -s)" != "X" ]; then
		clean_repo
	fi
	#
	... ...
}

 

2) Manufacturer's code Debian package:      (--exclude='./.git/')


	if [[ $BUILD_KSRC != no ]]; then
		display_alert "Compressing sources for the linux-source package"
		tar cp --directory="$kerneldir" --exclude='./.git/' --owner=root . \
			 | pv -p -b -r -s $(du -sb "$kerneldir" --exclude=='./.git/' | cut -f1) \
			| pixz -4 > $sources_pkg_dir/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.xz
		cp COPYING $sources_pkg_dir/usr/share/doc/linux-source-${version}-${LINUXFAMILY}/LICENSE
	fi

can be changed to view:    (--exclude="[.]git")

	if [[ $BUILD_KSRC != no ]]; then
		display_alert "Compressing sources for the linux-source package"
		tar cp --directory="$kerneldir" --exclude="[.]git" --exclude="[.]git[a-z]*" --owner=root . \
			 | pv -p -b -r -s $(du -sb "$kerneldir" --exclude="[.]git" --exclude="[.]git[a-z]*" | cut -f1) \
			| pixz -4 > $sources_pkg_dir/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.xz
		cp COPYING $sources_pkg_dir/usr/share/doc/linux-source-${version}-${LINUXFAMILY}/LICENSE
	fi

 

Share this post


Link to post
Share on other sites
5 hours ago, going said:

1 - incomplete cleaning of the source code before starting a new compilation, seen when patches add new files to the tree.

got fooled by this too in the beginnings.. :P I mostly work with 'CLEAN_LEVEL = sources' when I prepare patches which create new files (https://github.com/armbian/build/blob/d9849de58fcb8fe8f6c0b01d71b61c28a6bc6f35/config/templates/config-example.conf#L6-L10).

 

your solution looks smart (but to be honest, my git-fu is to low to be sure that this works reliable). You may create a PR where the maintainers will review it this works sufficient? Would save some bandwidth when preparing such patches cause I normally need more than one attempt for a proper patch. :)

  

Share this post


Link to post
Share on other sites
22 minutes ago, chwe said:

'CLEAN_LEVEL = sources'

large overhead when downloading.

git reset --hard HEAD	# First, return the modified files.
git clean -df			# Then delete all new, added files.

This code is guaranteed to work correctly. I use it for a month. "Clean slate" before you start the compilation, and no issues with the new patches.

Share this post


Link to post
Share on other sites
3 minutes ago, going said:

This code is guaranteed to work correctly. I use it for a month. "Clean slate" before you start the compilation, and no issues with the new patches.

Well, then I'm happy to see a PR from it and others probably too.. ;) 

overhead isn't that much an issue here.. thanks to fiber at home.. but for sure, if it works reliable I would still use it. :) 

Share this post


Link to post
Share on other sites
11 minutes ago, chwe said:

overhead isn't that much an issue here.. thanks to fiber at home..

:D I am somewhere in the Siberian province and use 3G modem.:(

Share this post


Link to post
Share on other sites

that's why I like your approach. Problem is, as long as downloading big junks of code doesn't hurt you, you don't care much. You may team up with @Igor or @zador.blood.stained how this can be implemented properly. I guess it should be here:

https://github.com/armbian/build/blob/88ea83e694d8c015c42a9ae6fb163b0e7470755e/lib/general.sh#L32-L81

But, to be honest.. I'm not 100% familiar with this part of the build-script to guide you how this should be done properly. I'm sure, they are. 

 

17 minutes ago, going said:

:D I am somewhere in the Siberian province and use 3G modem.:(

That's cool.  :) Seeing that the buildscript is used around the world and limited bandwidth helps that people think about issues which aren't 'that much an issue' for those without such limitations. I really hope we can implement it so that it gets default (or at least everyone can set it in the configs) for all armbian users. 

Share this post


Link to post
Share on other sites

I noticed this problem after I stopped the kernel version from moving up on a particular tag and started to change patches to remove errors.

Turned off a few patches to clear the field for observation. And saw that the big aufs patch (it adds a lot of new files) partially applied, causing even more errors, but my fixes have no effect.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
0