Make dist target also working on Windows, add distdfsg target
This commit is contained in:
parent
a592f55473
commit
60472e057f
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -11,5 +11,6 @@ mkinstalldirs export-ignore
|
||||||
package export-ignore
|
package export-ignore
|
||||||
fc.sh export-ignore
|
fc.sh export-ignore
|
||||||
UpdateResources.bat export-ignore
|
UpdateResources.bat export-ignore
|
||||||
|
BuildVersion.bat export-ignore
|
||||||
*.sln export-ignore
|
*.sln export-ignore
|
||||||
WindowsInstaller export-ignore
|
WindowsInstaller export-ignore
|
||||||
|
|
|
@ -472,4 +472,9 @@ endif(FREECAD_MAINTAINERS_BUILD AND NOT WIN32)
|
||||||
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR}
|
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
add_custom_target(distdfsg-git
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
|
||||||
|
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR} --dfsg
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,15 @@
|
||||||
# Python script to make source tarballs.
|
# Python script to make source tarballs.
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys, os, getopt, tarfile, gzip, time, StringIO
|
import sys, os, getopt, tarfile, gzip, time, StringIO, platform
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
srcdir="."
|
srcdir="."
|
||||||
bindir="."
|
bindir="."
|
||||||
|
dfsg=False
|
||||||
|
wta=""
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], "sb:", ["srcdir=","bindir="])
|
opts, args = getopt.getopt(sys.argv[1:], "sb:", ["srcdir=","bindir=","dfsg"])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -20,6 +22,16 @@ def main():
|
||||||
srcdir = a
|
srcdir = a
|
||||||
if o in ("-b", "--bindir"):
|
if o in ("-b", "--bindir"):
|
||||||
bindir = a
|
bindir = a
|
||||||
|
if o in ("--dfsg"):
|
||||||
|
dfsg = True
|
||||||
|
wta = "--worktree-attributes"
|
||||||
|
|
||||||
|
if dfsg:
|
||||||
|
gitattr = open("src/.gitattributes","w")
|
||||||
|
gitattr.write("zipios++ export-ignore\n")
|
||||||
|
gitattr.write("Pivy-0.5 export-ignore\n")
|
||||||
|
gitattr.write("Pivy export-ignore\n")
|
||||||
|
gitattr.close()
|
||||||
|
|
||||||
# revision number
|
# revision number
|
||||||
info=os.popen("git rev-list HEAD").read()
|
info=os.popen("git rev-list HEAD").read()
|
||||||
|
@ -29,7 +41,10 @@ def main():
|
||||||
version = "0.13.%s" % (revision)
|
version = "0.13.%s" % (revision)
|
||||||
|
|
||||||
DIRNAME = "%(p)s-%(v)s" % {'p': PACKAGE_NAME, 'v': version}
|
DIRNAME = "%(p)s-%(v)s" % {'p': PACKAGE_NAME, 'v': version}
|
||||||
TARNAME = DIRNAME + '.tar.gz'
|
TARNAME = DIRNAME + '.tar'
|
||||||
|
TGZNAME = DIRNAME + '.tar.gz'
|
||||||
|
if dfsg:
|
||||||
|
TGZNAME = DIRNAME + '-dfsg.tar.gz'
|
||||||
|
|
||||||
verfile = open("%s/src/Build/Version.h" % (bindir), 'r')
|
verfile = open("%s/src/Build/Version.h" % (bindir), 'r')
|
||||||
verstream = StringIO.StringIO(verfile.read())
|
verstream = StringIO.StringIO(verfile.read())
|
||||||
|
@ -39,19 +54,37 @@ def main():
|
||||||
verinfo.size = len(verstream.getvalue())
|
verinfo.size = len(verstream.getvalue())
|
||||||
verinfo.mtime = time.time()
|
verinfo.mtime = time.time()
|
||||||
|
|
||||||
print "git archive --worktree-attributes --prefix=%s/ HEAD" % (DIRNAME)
|
print "git archive %s --prefix=%s/ HEAD" % (wta, DIRNAME)
|
||||||
tardata = os.popen("git archive --worktree-attributes --prefix=%s/ HEAD"
|
if platform.system() == 'Windows':
|
||||||
% (DIRNAME)).read()
|
os.popen("git archive %s --prefix=%s/ --output=%s HEAD"
|
||||||
|
% (wta, DIRNAME, TARNAME)).read()
|
||||||
|
|
||||||
|
tar = tarfile.TarFile(mode="a", name=TARNAME)
|
||||||
|
tar.addfile(verinfo, verstream)
|
||||||
|
tar.close()
|
||||||
|
|
||||||
|
out = gzip.open(TGZNAME, "wb")
|
||||||
|
tardata = open(TARNAME, 'rb')
|
||||||
|
out.write(tardata.read())
|
||||||
|
out.close()
|
||||||
|
tardata.close()
|
||||||
|
os.remove(TARNAME)
|
||||||
|
else:
|
||||||
|
tardata = os.popen("git archive %s --prefix=%s/ HEAD"
|
||||||
|
% (wta, DIRNAME)).read()
|
||||||
tarstream = StringIO.StringIO(tardata)
|
tarstream = StringIO.StringIO(tardata)
|
||||||
|
|
||||||
tar = tarfile.TarFile(mode="a", fileobj=tarstream)
|
tar = tarfile.TarFile(mode="a", fileobj=tarstream)
|
||||||
tar.addfile(verinfo, verstream)
|
tar.addfile(verinfo, verstream)
|
||||||
tar.close()
|
tar.close()
|
||||||
|
|
||||||
out = gzip.open(TARNAME, "wb")
|
out = gzip.open(TGZNAME, "wb")
|
||||||
out.write(tarstream.getvalue())
|
out.write(tarstream.getvalue())
|
||||||
out.close()
|
out.close()
|
||||||
print "Created " + TARNAME
|
|
||||||
|
if dfsg:
|
||||||
|
os.remove("src/.gitattributes")
|
||||||
|
print "Created " + TGZNAME
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user