Skip to content

Commit

Permalink
build: don't pack git-ignored files into tars
Browse files Browse the repository at this point in the history
When temporary operating-system-specific files like .DS_Store
(a macOS Finder artifact) are packed into the dist/ tars, it
creates version control noise and can make the source-matches-tars
check fail unnecessarily.

This updates `make dist` to first `git clean` away any git-ignored
files. It also changes `make unpack` to work in the case where the
source directories are missing, which is useful when you want to
unpack the tars from scratch.

Finally, this commit re-runs `make dist`, so that the dist/
tars no longer have unnecessary OS-specific files in them.
  • Loading branch information
kdmccormick committed Feb 6, 2024
1 parent 661f848 commit 4104aa8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.DS_Store?
.ehthumbs.db
Icon?
Thumbs.db.DS_Store
Thumbs.db
._*
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ help: ## Display this help message.
clean: ## Delete all generated course and library exports.
rm -f $(COURSE_TAR) $(LIBRARY_TAR)

dist: ## Create/overwrite exports in ./dist/ folder for course and libary.
dist: clean ## Create/overwrite exports in ./dist/ folder for course and libary.
cd $(COURSE) && tar czfv ../$(COURSE_TAR) ./course/
cd $(LIBRARY) && tar czfv ../$(LIBRARY_TAR) ./library/

clean: ## Remove hidden system files that are ignored by git.
git clean -dfX

unpack: ## Unpack course and library exports from ./dist/ folder into source OLX.
[ -f $(COURSE_TAR) ] && (cd $(COURSE) && tar xzfv ../$(COURSE_TAR)) || echo "No course to unpack."
[ -f $(LIBRARY_TAR) ] && (cd $(LIBRARY) && tar xzfv ../$(LIBRARY_TAR)) || echo "No content library to unpack."
[ -f $(COURSE_TAR) ] && mkdir -p $(COURSE) && (cd $(COURSE) && tar xzfv ../$(COURSE_TAR)) || echo "No course to unpack."
[ -f $(LIBRARY_TAR) ] && mkdir -p $(LIBRARY) && (cd $(LIBRARY) && tar xzfv ../$(LIBRARY_TAR)) || echo "No content library to unpack."

import: dist ## Import course and libraries into a locally-running Tutor instance. Requires an admin user.
$(TUTOR) mounts add cms,cms-worker:.:/openedx/data/$(REPO_NAME)
Expand Down
Binary file modified dist/demo-content-library.tar.gz
Binary file not shown.
Binary file modified dist/demo-course.tar.gz
Binary file not shown.

0 comments on commit 4104aa8

Please sign in to comment.