common Makefile.common,1.2,1.3
Cristian Gafton (gafton)
fedora-extras-commits at redhat.com
Wed Nov 24 01:22:34 UTC 2004
Changeset from: gafton
Update of /cvs/extras/common
In directory cvs.fedora.redhat.com:/tmp/cvs-serv7326
Modified Files:
Makefile.common
Log Message:
enable "make upload" targets
Index: Makefile.common
===================================================================
RCS file: /cvs/extras/common/Makefile.common,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.common 8 Nov 2004 02:51:58 -0000 1.2
+++ Makefile.common 24 Nov 2004 01:22:32 -0000 1.3
@@ -134,6 +134,79 @@
ls -l $@ ; \
fi
+# Support for uploading stuff into the repository. Since this is
+# pretty specific to the upload.cgi we use, we hardwire the assumption
+# that we're always using upload.cgi
+ifdef FILES
+
+UPLOAD_REPOSITORY ?= $(REPOSITORY)/upload.cgi
+# we hardwire curl in here because the upload rules are very dependent
+# on curl's behavior on missing pages, ISEs, etc.
+UPLOAD_CHECK = curl --silent --fail
+UPLOAD_CLIENT = curl --fail --show-error --progress-bar
+
+upload-check = $(UPLOAD_CHECK) -F "name=$(NAME)" -F "md5sum=$${m%%[[:space:]]*}" -F "filename=$$f" $(UPLOAD_REPOSITORY)
+upload-file = $(UPLOAD_CLIENT) -F "name=$(NAME)" -F "md5sum=$${m%%[[:space:]]*}" -F "file=@$$f" $(UPLOAD_REPOSITORY)
+
+define upload-request
+echo "Checking : $$b on $(UPLOAD_REPOSITORY)..." ; \
+check=$$($(upload-check)) ; retc=$$? ; \
+if test $$retc -ne 0 ; then \
+ echo "ERROR: could not check remote file status" ; \
+ exit -1 ; \
+elif test "$$check" = "Available" ; then \
+ echo "This file ($$m) is already uploaded" ; \
+elif test "$$check" = "Missing" ; then \
+ echo "Uploading: $$b to $(UPLOAD_REPOSITORY)..." ; \
+ $(upload-file) || exit 1 ; \
+fi
+endef
+
+# Upload the FILES, adding to the ./sources manifest
+upload: $(FILES)
+ @if ! test -f ./sources ; then touch ./sources ; fi
+ @if ! test -f ./.cvsignore ; then touch ./.cvsignore ; fi
+ @for f in $(FILES); do \
+ b="$$(basename $$f)" ; \
+ m="$$(cd $$(dirname $$f) && md5sum $$b)" ; \
+ if test "$$m" = "$$(grep $$b sources)" ; then \
+ echo "ERROR: file $$f is already listed in the sources file..." ; \
+ exit 1 ; \
+ fi ; \
+ chmod +r $$f ; \
+ echo ; $(upload-request) ; echo ; \
+ if test -z "$$(egrep ""[[:space:]]$$b$$"" sources)" ; then \
+ echo "$$m" >> sources ; \
+ else \
+ egrep -v "[[:space:]]$$b$$" sources > sources.new ; \
+ echo "$$m" >> sources.new ; \
+ mv sources.new sources ; \
+ fi ; \
+ if test -z "$$(egrep ""^$$b$$"" .cvsignore)" ; then \
+ echo $$b >> .cvsignore ; \
+ fi \
+ done
+ @if grep "^/sources/" CVS/Entries >/dev/null; then true ; else cvs -Q add sources; fi
+ @echo "Source upload succeeded. Don't forget to commit the new ./sources file"
+ @cvs update sources .cvsignore
+
+# Upload FILES and recreate the ./sources file to include only these FILES
+new-source new-sources: $(FILES)
+ @rm -f sources && touch sources
+ @rm -f .cvsignore && touch .cvsignore
+ @for f in $(FILES); do \
+ b="$$(basename $$f)" ; \
+ m="$$(cd $$(dirname $$f) && md5sum $$b)" ; \
+ chmod +r $$f ; \
+ echo ; $(upload-request) ; echo ; \
+ echo "$$m" >> sources ; \
+ echo "$$b" >> .cvsignore ; \
+ done
+ @if grep "^/sources/" CVS/Entries >/dev/null; then true ; else cvs -Q add sources; fi
+ @echo "Source upload succeeded. Don't forget to commit the new ./sources file"
+ @cvs update sources .cvsignore
+endif
+
# build for a particular arch
$(ARCHES) : sources $(TARGETS)
$(RPM_WITH_DIRS) --target $@ -ba $(SPECFILE)
@@ -276,3 +349,5 @@
gimmespec:
@echo "$(SPECFILE)"
+
+
More information about the fedora-extras-commits
mailing list