mirror of
https://review.coreboot.org/flashrom.git
synced 2025-08-18 21:00:15 +02:00
Convert flashrom to git
- Drop support for Subversion in the getrevision script and Makefile. - Refinement of getrevision to have a single function determining the new flashrom version string (based on git describe). - Add .gitignore and .gitattributes file (the latter to limit exports). - Restore modification dates of the exported files from the VCS. - Stop exporting VCS log dumps to CHANGELOG. This makes no sense. - Export VCS metadata needed by the Makefile to versioninfo.inc - Do not export the pre-"compiled" manpage. It can be generated like anything else from the code dump with versioninfo.inc - Add some initial client-side git hooks that get installed automatically on make runs: * pre-commit: - test for whitespace errors via git diff-index --check * commit-msg: - Use the up to date hook from gerrit to add Change-Id tags. Unlike the upstream hook, add them to fixup/squash changes too to allow for our staging process. - Test for duplicate sign-offs/acks. * When pushing to one of the upstream repositories check mandatory rules: - existing signoffs and acks in all new commits - no deletions of branches - no new branches other than versioned branches (e.g., 0.0.x) - no history rewriting of branches - Various other small refinements, bikesheddings and cosmetic changes to slow down progress of flashrom and humanity as a whole. Original-Change-Id: I64eef21982cac0a0a7419bcd2c8a936672ae9cb2 Original-Reviewed-on: https://review.coreboot.org/19206 Original-Reviewed-by: Nico Huber <nico.h@gmx.de> Original-Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Change-Id: I325edb7d9890c412a44ecacb5161268d3dbccc57 Signed-off-by: Stefan Tauner <stefan.tauner@gmx.at> Signed-off-by: David Hendricks <dhendricks@fb.com> Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/21923 Acked-by: Stefan Tauner <stefan.tauner@gmx.at>
This commit is contained in:
73
Makefile
73
Makefile
@@ -526,23 +526,23 @@ LIB_OBJS = layout.o flashrom.o udelay.o programmer.o helpers.o
|
||||
|
||||
CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o
|
||||
|
||||
# Set the flashrom version string from the highest revision number of the checked out flashrom files.
|
||||
# Note to packagers: Any tree exported with "make export" or "make tarball"
|
||||
# will not require subversion. The downloadable snapshots are already exported.
|
||||
SVNVERSION := $(shell ./util/getrevision.sh -u 2>/dev/null )
|
||||
# versioninfo.inc stores metadata required to build a packaged flashrom. It is generated by the export rule and
|
||||
# imported below. If versioninfo.inc is not found and the variables are not defined by the user, the info will
|
||||
# be obtained using util/getrevision.sh, which is the common case during development.
|
||||
-include versioninfo.inc
|
||||
VERSION ?= $(shell ./util/getrevision.sh --revision)
|
||||
MAN_DATE ?= $(shell ./util/getrevision.sh --date $(PROGRAM).8.tmpl 2>/dev/null)
|
||||
|
||||
RELEASE := 0.9.9
|
||||
VERSION := $(RELEASE)-$(SVNVERSION)
|
||||
RELEASENAME ?= $(VERSION)
|
||||
SCMDEF := -D'FLASHROM_VERSION="$(VERSION)"'
|
||||
|
||||
SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"'
|
||||
# No spaces in release names unless set explicitly
|
||||
RELEASENAME ?= $(shell echo "$(VERSION)" | sed -e 's/ /_/')
|
||||
|
||||
# Inform user if there is no meaningful version string. If there is version information from a VCS print
|
||||
# something anyway because $(info...) will print a line break in any case which would look suspicious.
|
||||
# The && between the echos is a workaround for old versions of GNU make that issue the error "unterminated
|
||||
# variable reference" if a semicolon is used instead.
|
||||
$(info $(shell ./util/getrevision.sh -c 2>/dev/null || echo "Files don't seem to be under version control." && \
|
||||
echo "Replacing all version templates with $(VERSION)." ))
|
||||
# Inform user of the version string
|
||||
$(info Replacing all version templates with $(VERSION).)
|
||||
|
||||
# If a VCS is found then try to install hooks.
|
||||
$(shell ./util/getrevision.sh -c 2>/dev/null && ./util/git-hooks/install.sh)
|
||||
|
||||
###############################################################################
|
||||
# Default settings of CONFIG_* variables.
|
||||
@@ -1024,7 +1024,7 @@ libflashrom.a: $(LIBFLASHROM_OBJS)
|
||||
TAROPTIONS = $(shell LC_ALL=C tar --version|grep -q GNU && echo "--owner=root --group=root")
|
||||
|
||||
%.o: %.c .features
|
||||
$(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_CFLAGS) $(SVNDEF) -o $@ -c $<
|
||||
$(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_CFLAGS) $(SCMDEF) -o $@ -c $<
|
||||
|
||||
# Make sure to add all names of generated binaries here.
|
||||
# This includes all frontends and libflashrom.
|
||||
@@ -1349,7 +1349,7 @@ $(PROGRAM).8.html: $(PROGRAM).8
|
||||
|
||||
$(PROGRAM).8: $(PROGRAM).8.tmpl
|
||||
@# Add the man page change date and version to the man page
|
||||
@sed -e 's#.TH FLASHROM 8 ".*".*#.TH FLASHROM 8 "$(shell ./util/getrevision.sh -d $(PROGRAM).8.tmpl 2>/dev/null)" "$(VERSION)"#' <$< >$@
|
||||
@sed -e 's#.TH FLASHROM 8 ".*".*#.TH FLASHROM 8 "$(MAN_DATE)" "$(VERSION)"#' <$< >$@
|
||||
|
||||
install: $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/sbin
|
||||
@@ -1357,25 +1357,42 @@ install: $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
|
||||
$(INSTALL) -m 0755 $(PROGRAM)$(EXEC_SUFFIX) $(DESTDIR)$(PREFIX)/sbin
|
||||
$(INSTALL) -m 0644 $(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8
|
||||
|
||||
export: $(PROGRAM).8
|
||||
@rm -rf $(EXPORTDIR)/flashrom-$(RELEASENAME)
|
||||
@svn export -r BASE . $(EXPORTDIR)/flashrom-$(RELEASENAME)
|
||||
@sed "s/^SVNVERSION.*/SVNVERSION := $(SVNVERSION)/" Makefile >$(EXPORTDIR)/flashrom-$(RELEASENAME)/Makefile
|
||||
@cp $(PROGRAM).8 "$(EXPORTDIR)/flashrom-$(RELEASENAME)/$(PROGRAM).8"
|
||||
@svn log >$(EXPORTDIR)/flashrom-$(RELEASENAME)/ChangeLog
|
||||
@echo Exported $(EXPORTDIR)/flashrom-$(RELEASENAME)/
|
||||
_export: $(PROGRAM).8
|
||||
@rm -rf "$(EXPORTDIR)/flashrom-$(RELEASENAME)"
|
||||
@mkdir -p "$(EXPORTDIR)/flashrom-$(RELEASENAME)"
|
||||
@git archive HEAD | tar -x -C "$(EXPORTDIR)/flashrom-$(RELEASENAME)"
|
||||
# Generate versioninfo.inc containing metadata that would not be available in exported sources otherwise.
|
||||
@echo "VERSION = $(VERSION)" > "$(EXPORTDIR)/flashrom-$(RELEASENAME)/versioninfo.inc"
|
||||
@echo "MAN_DATE = $(MAN_DATE)" >> "$(EXPORTDIR)/flashrom-$(RELEASENAME)/versioninfo.inc"
|
||||
# Restore modification date of all tracked files not marked 'export-ignore' in .gitattributes.
|
||||
# sed is required to filter out file names having the attribute set.
|
||||
# The sed program saves the file name in the hold buffer and then checks if the respective value is 'set'.
|
||||
# If so it ignores the rest of the program, which otherwise restores the file name and prints it.
|
||||
@git ls-tree -r -z -t --full-name --name-only HEAD | \
|
||||
git check-attr -z --stdin export-ignore | \
|
||||
sed -zne 'x;n;n;{/^set$$/b;};x;p;' | \
|
||||
xargs -0 sh -c 'for f; do \
|
||||
touch -d $$(git log --pretty=format:%cI -1 HEAD -- "$$f") \
|
||||
"$(EXPORTDIR)/flashrom-$(RELEASENAME)/$$f"; \
|
||||
done' dummy_arg0
|
||||
|
||||
tarball: export
|
||||
@tar cjf $(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2 -C $(EXPORTDIR)/ $(TAROPTIONS) flashrom-$(RELEASENAME)/
|
||||
@rm -rf $(EXPORTDIR)/flashrom-$(RELEASENAME)
|
||||
@echo Created $(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2
|
||||
export: _export
|
||||
@echo "Exported $(EXPORTDIR)/flashrom-$(RELEASENAME)/"
|
||||
|
||||
tarball: _export
|
||||
@tar -cz --format=ustar -f "$(EXPORTDIR)/flashrom-$(RELEASENAME).tar.gz" -C $(EXPORTDIR)/ \
|
||||
$(TAROPTIONS) "flashrom-$(RELEASENAME)/"
|
||||
# Delete the exported directory again because it is most likely what's expected by the user.
|
||||
@rm -rf "$(EXPORTDIR)/flashrom-$(RELEASENAME)"
|
||||
@echo Created "$(EXPORTDIR)/flashrom-$(RELEASENAME).tar.gz"
|
||||
|
||||
djgpp-dos: clean
|
||||
make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip
|
||||
|
||||
libpayload: clean
|
||||
make CC="CC=i386-elf-gcc lpgcc" AR=i386-elf-ar RANLIB=i386-elf-ranlib
|
||||
|
||||
.PHONY: all install clean distclean compiler hwlibs features export tarball djgpp-dos featuresavailable libpayload
|
||||
.PHONY: all install clean distclean compiler hwlibs features _export export tarball featuresavailable libpayload
|
||||
|
||||
# Disable implicit suffixes and built-in rules (for performance and profit)
|
||||
.SUFFIXES:
|
||||
|
Reference in New Issue
Block a user