debian/bin/genorig.py: Add support for debian/copyright Files-Excluded field
This isn't part of the machine-readable copyright format 1.0, but is an extension supported by mk-origtargz.
This commit is contained in:
parent
27f02c775b
commit
4aa097dc5e
|
@ -3,12 +3,15 @@
|
||||||
import sys
|
import sys
|
||||||
sys.path.append("debian/lib/python")
|
sys.path.append("debian/lib/python")
|
||||||
|
|
||||||
|
import deb822
|
||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
import warnings
|
||||||
|
|
||||||
from debian_linux.debian import Changelog, VersionLinux
|
from debian_linux.debian import Changelog, VersionLinux
|
||||||
from debian_linux.patches import PatchSeries
|
from debian_linux.patches import PatchSeries
|
||||||
|
@ -60,6 +63,7 @@ class Main(object):
|
||||||
.st_mtime))
|
.st_mtime))
|
||||||
|
|
||||||
self.debian_patch()
|
self.debian_patch()
|
||||||
|
self.exclude_files()
|
||||||
os.umask(old_umask)
|
os.umask(old_umask)
|
||||||
self.tar(orig_date)
|
self.tar(orig_date)
|
||||||
finally:
|
finally:
|
||||||
|
@ -129,6 +133,24 @@ class Main(object):
|
||||||
series = PatchSeries(name, "debian/patches", fp)
|
series = PatchSeries(name, "debian/patches", fp)
|
||||||
series(dir=os.path.join(self.dir, self.orig))
|
series(dir=os.path.join(self.dir, self.orig))
|
||||||
|
|
||||||
|
def exclude_files(self):
|
||||||
|
self.log("Excluding file patterns specified in debian/copyright\n")
|
||||||
|
with open("debian/copyright") as f:
|
||||||
|
header = deb822.Deb822(f)
|
||||||
|
patterns = header.get("Files-Excluded", '').strip().split()
|
||||||
|
for pattern in patterns:
|
||||||
|
matched = False
|
||||||
|
for name in glob.glob(os.path.join(self.dir, self.orig, pattern)):
|
||||||
|
try:
|
||||||
|
shutil.rmtree(name)
|
||||||
|
except NotADirectoryError:
|
||||||
|
os.unlink(name)
|
||||||
|
matched = True
|
||||||
|
if not matched:
|
||||||
|
warnings.warn("Exclusion pattern '%s' did not match anything"
|
||||||
|
% pattern,
|
||||||
|
RuntimeWarning)
|
||||||
|
|
||||||
def tar(self, orig_date):
|
def tar(self, orig_date):
|
||||||
out = os.path.join("../orig", self.orig_tar)
|
out = os.path.join("../orig", self.orig_tar)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -21,6 +21,8 @@ linux (4.18~rc7-1~exp1) UNRELEASED; urgency=medium
|
||||||
* debian/bin/gencontrol_signed.py: Add certificate fingerprints to template
|
* debian/bin/gencontrol_signed.py: Add certificate fingerprints to template
|
||||||
metadata
|
metadata
|
||||||
* scripts/kernel-doc: Escape all literal braces in regexes (Closes: #905116)
|
* scripts/kernel-doc: Escape all literal braces in regexes (Closes: #905116)
|
||||||
|
* debian/bin/genorig.py: Add support for debian/copyright Files-Excluded
|
||||||
|
field
|
||||||
|
|
||||||
-- Uwe Kleine-König <ukleinek@debian.org> Sat, 21 Jul 2018 16:52:01 +0200
|
-- Uwe Kleine-König <ukleinek@debian.org> Sat, 21 Jul 2018 16:52:01 +0200
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue