-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for DPKG local caching #4117
Conversation
@Kalimuthu-Velappan , can you check following messages?
|
for a fresh build, it looks like /tmp/dpkg_cache is created with root privilidge only. can you fix this by explicitly create /tmp/dpkg_cache with 777 permission?
|
SPATH := $($(SONIC_ZTP)_SRC_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-ztp.mk rules/sonic-ztp.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files|grep -Ev "inband-ztp-ip|dhclient-exit-hooks.d/ztp")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need grep here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and uploaded the patchset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can still see the grep, can you double check?
SPATH := $($(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-platform-common.mk rules/sonic-platform-common.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files|grep -Ev "sonic_sfp|sonic_eeprom")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this special? why need grep here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sonic_sfp and sonic_eeprom are created as soft links. The git hash-object command is not working with soft links. Hence these files are excluded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jleveque , why do we have soft links? can we remove them?
|
||
SMDEP_PATHS := $(SPATH) $(SPATH)/SAI $(SPATH)/SAI/bm/behavioral-model $(SPATH)/SAI/test/ptf $(SPATH)/SAI/test/saithrift/ctypesgen | ||
$(foreach path, $(SMDEP_PATHS), $(eval $(path) :=$(filter-out $(SMDEP_PATHS),$(addprefix $(path)/, \ | ||
$(shell cd $(path) && git ls-files | grep -v " "))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have such complexity here? can you help to explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not really understand SMDEP has these $(SPATH)/SAI/bm/behavioral-model $(SPATH)/SAI/test/ptf $(SPATH)/SAI/test/saithrift/ctypesgen
and I see this error
fatal: Not a git repository: /data2/sonic/stretch/sonic-buildimage/.git/modules/sonic-sairedis/modules/SAI/modules/bm/behavioral-model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and uploaded the patchset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package has multiple Sub repo. The git hash-object command is not working for the repo directory name. Hence we need to exclude the directory name. We also need to exclude the files that has space on it.
First of all, really appreciated the work here. i do not see dep module for other platforms like barefoot, marvell. do you expect them to come up with the dep moduels? |
ea4172e
to
7cabd23
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
suggest |
suggest not to do a force push, just do a incremental push, easier for the code review. we will do squash merge eventually so all your commits related to this pr will be merged as one commits. |
do you support a read-only cache mode? for example, we build the cache for all nightly master build, and then for PR build, it only read from the cache, but it does not write to the cache. |
Added support for readonly and writeonly cache support
…On Tue, Feb 11, 2020 at 7:44 PM lguohan ***@***.***> wrote:
do you support a read-only cache mode? for example, we build the cache for
all nightly master build, and then for PR build, it only read from the
cache, but it does not write to the cache.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4117>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM2UC2XPKKV2ESYHCNHGUKLRCKXDJANCNFSM4KQ2LMOQ>
.
--
Thanks
- Kals
|
Yes, we have tested on the NFS mount. I will check this issue.
…On Thu, Feb 13, 2020 at 5:50 PM xumia ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Makefile.cache
<#4117 (comment)>
:
> +#
+# Parameters:
+# $(1) - target file name (without path)
+# $(2) - lock file path (only)
+# $(3) - designated lock file suffix
+# $(4) - flock timeout (in seconds)
+#
+# $(call MOD_LOCK,file,path,suffix,timeout)
+define MOD_LOCK
+ if [[ ! -f $(2)/$(1)_$(3).lock ]]; then
+ touch $(2)/$(1)_$(3).lock
+ chmod 777 $(2)/$(1)_$(3).lock;
+ fi
+ $(eval $(1)_lock_fd=$(subst ~,_,$(subst -,_,$(subst +,_,$(subst .,_,$(1))))))
+ exec {$($(1)_lock_fd)}<"$(2)/$(1)_$(3).lock";
+ if ! flock -x -w $(4) "$${$($(1)_lock_fd)}" ; then
Does it support NFS? /mnt/nfs is the mounted nfs path. It has a "Bad file
descriptor" issue, but the command "flock [options] | -c " works fine.
$ flock -x /mnt/nfs/test_lock.lock -c "echo test"
test
$ exec {test}<"/mnt/nfs/test_lock.lock"
$ flock -x -w 10 "${test}"
*flock: 15: Bad file descriptor*
$
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4117>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM2UC2VZIW7AYCP74YBYQ3LRCU3KPANCNFSM4KQ2LMOQ>
.
--
Thanks
- Kals
|
7cabd23
to
4ab0b0d
Compare
Added support for readonly and writeonly cache |
4ab0b0d
to
58bcae2
Compare
58bcae2
to
5abd84f
Compare
5abd84f
to
f7c6630
Compare
include $(PLATFORM_PATH)/raw-image.dep | ||
include $(PLATFORM_PATH)/one-aboot.dep | ||
include $(PLATFORM_PATH)/libsaithrift-dev.dep | ||
include $(PLATFORM_PATH)/docker-ptf-brcm.dep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is $(SYNCD)_CACHE_MODE
missing in this PR? I can only see $(SYNCD_VS)_CACHE_MODE
OK, I notice the file rules/sairedis.dep
DPKG caching framework provides the infrastructure to cache the sonic module/target .deb files into a local cache by tracking the target dependency files.SONIC build infrastructure is designed as a plugin framework where any new source code can be easily integrated into sonic as a module and that generates output as a .deb file. The source code compilation of a module is completely independent of other modules compilation. Inter module dependency is resolved through build artifacts like header files, libraries, and binaries in the form of Debian packages. For example module A depends on module B. While module A is being built, it uses B's .deb file to install it in the build docker.
The DPKG caching framework provides an infrastructure that caches a module's deb package and restores it back to the build directory if its dependency files are not modified. When a module is compiled for the first time, the generated deb package is stored at the DPKG cache location. On the subsequent build, first, it checks the module dependency file modification. If none of the dependent files is changed, it copies the deb package from the cache location, otherwise, it goes for local compilation and generates the deb package. The modified files should be checked-in to get the newer cache deb package.
This provides a huge improvement in build time and also supports the true incremental build by tracking the dependency files.
- How I did it
It takes two global arguments to enable the DPKG caching, the first one indicates the caching method and the second one describes the location of the cache.
SONIC_DPKG_CACHE_METHOD=cache
SONIC_DPKG_CACHE_SOURCE=
Dependency file tracking:
Dependency files are tracked for each target in two levels.
1. Common make infrastructure files - rules/config, rules/functions, slave.mk etc.
2. Per module files - files which are specific to modules, Makefile, debian/rules, patch files, etc.
Cache file tracking:
The Cache file is a compressed TAR ball of a module's target DEB file and its derived-target DEB files.
The cache filename is formed with the following format
Target Specific rules:
Caching can be enabled/disabled on a global level and also on the per-target level.
- How to verify it
- Description for the changelog
The DPKG caching framework provides the infrastructure to save the module-specific deb file to be cached by tracking the module's dependency files.
If the module's dependency files are not changed, it restores the module deb files from the cache storage.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)
DOCUMENT PR: