More fixes to Debian packaging and fix domain substitution

This commit is contained in:
Eloston
2018-08-20 05:33:19 +00:00
parent 6367aaffa4
commit 7680ae811f
4 changed files with 34 additions and 17 deletions
+3 -2
View File
@@ -34,7 +34,7 @@ def _substitute_path(path, regex_iter):
path is a pathlib.Path to the file to be domain substituted.
regex_iter is an iterable of regular expression namedtuple like from
config.DomainRegexList.get_pairs()
config.DomainRegexList.regex_pairs()
Returns a tuple of the CRC32 hash of the substituted raw content and the
original raw content; None for both entries if no substitutions were made.
@@ -129,7 +129,7 @@ def apply_substitution(config_bundle, source_tree, domainsub_cache):
if domainsub_cache.exists():
raise FileExistsError(domainsub_cache)
resolved_tree = source_tree.resolve()
regex_pairs = config_bundle.domain_regex.get_pairs()
regex_pairs = config_bundle.domain_regex.regex_pairs
fileindex_content = io.BytesIO()
with tarfile.open(
str(domainsub_cache), 'w:%s' % domainsub_cache.suffix[1:],
@@ -146,6 +146,7 @@ def apply_substitution(config_bundle, source_tree, domainsub_cache):
path = resolved_tree / relative_path
if not path.exists():
get_logger().warning('Skipping non-existant path: %s', path)
continue
crc32_hash, orig_content = _substitute_path(path, regex_pairs)
if crc32_hash is None:
get_logger().info('Path has no substitutions: %s', relative_path)
+2 -2
View File
@@ -50,7 +50,7 @@ mkdir -p build/src
./get_package.py debian_stretch build/src/debian
cd build/src
# Use dpkg-checkbuilddeps (from dpkg-dev) or mk-build-deps (from devscripts) to check for additional packages.
debian/rules download-source-locally
debian/rules setup-local-src
dpkg-buildpackage -b -uc
```
@@ -239,7 +239,7 @@ cd build/src
# Use dpkg-checkbuilddeps (from dpkg-dev) or mk-build-deps (from devscripts) to check for additional packages.
# If necessary, change the dependencies in debian/control to accomodate your environment.
# If necessary, modify AR, NM, CC, and CXX variables in debian/rules
debian/rules download-source-locally
debian/rules setup-local-src
dpkg-buildpackage -b -uc
```
+14 -13
View File
@@ -45,7 +45,7 @@ endif
config_bundle=$(shell cat debian/ungoogled-config-bundle)
# add gn flags from config bundle
defines+=$(shell debian/get_gnargs_shell config_bundles/$(config_bundle))
defines+=$(shell debian/scripts/get-gnargs-shell debian/scripts/ungoogled-chromium/config_bundles/$(config_bundle))
# some notes about embedded libraries
# can't use system nss since net/third_party/nss is heavily patched
@@ -68,19 +68,11 @@ out/Default/gn:
mkdir -p out/Default || true
./tools/gn/bootstrap/bootstrap.py -o out/Default/gn -s -j$(njobs)
override_dh_quilt_patch:
cd debian/scripts/ungoogled-chromium; python3 -m buildkit patches export -b config_bundles/$(config_bundle) ../../patches/
cd debian/scripts/ungoogled-chromium; python3 -m buildkit prune -b config_bundles/$(config_bundle) ../../../
cd debian/scripts/ungoogled-chromium; python3 -m buildkit domains apply -b config_bundles/$(config_bundle) -c domsubcache.tar.gz ../../../
dh_quilt_patch
override_dh_quilt_unpatch:
cd debian/scripts/ungoogled-chromium; python3 -m buildkit domains revert -c domsubcache.tar.gz ../../../
dh_quilt_unpatch
override_dh_auto_configure:
# output compiler information
$(CXX) --version
# apply domain substitution
if [ ! -e debian/scripts/ungoogled-chromium/domsubcache.tar.gz ]; then cd debian/scripts/ungoogled-chromium; python3 -m buildkit domains apply -b config_bundles/$(config_bundle) -c domsubcache.tar.gz ../../../; fi
# use system flot
for file in $(flotpaths); do ln -sf $$file third_party/flot; done
# put yasm script in the location expected by gn
@@ -96,6 +88,11 @@ override_dh_auto_build-indep: out/Default/gn
./out/Default/gn gen out/Default --args="$(defines)" --fail-on-unused-args
ninja -j$(njobs) -C out/Default packed_resources
override_dh_prep:
# building is done by this step; remove domain substitution
if [ -e debian/scripts/ungoogled-chromium/domsubcache.tar.gz ]; then cd debian/scripts/ungoogled-chromium; python3 -m buildkit domains revert -c domsubcache.tar.gz ../../../; fi
dh_prep
override_dh_auto_install-arch:
cp out/Default/chrome out/Default/chromium
cp out/Default/content_shell out/Default/chromium-shell
@@ -137,7 +134,7 @@ override_dh_auto_clean:
url=https://gsdview.appspot.com/chromium-browser-official
version=$(shell dpkg-parsechangelog -S Version | sed s/-.*//)
extract=chromium-$(version)
tarfile=$(extract)-lite.tar
tarfile=$(extract).tar
tarball=$(tarfile).xz
debvers=../ungoogled-chromium-browser_$(version)
origtxz=$(debvers).orig.tar.xz
@@ -145,6 +142,7 @@ removed=$(debvers).files-removed
seconds=$(debvers).seconds
get-orig-source:
cd debian/scripts/ungoogled-chromium; python3 -m buildkit patches export -b config_bundles/$(config_bundle) ../../patches/; fi
wget -nv --show-progress -c $(url)/$(tarball) -O ../$(tarball)
cp /usr/bin/mk-origtargz debian/scripts
patch -p1 < debian/scripts/mk-origtargz.patch
@@ -153,6 +151,7 @@ get-orig-source:
echo $$(($$(date +%s) - $$(cat $(seconds)))) seconds
test ! -e $(extract) || rm -rf $(extract)
tar xf ../$(tarball)
cd debian/scripts/ungoogled-chromium; python3 -m buildkit prune -b config_bundles/$(config_bundle) ../../../$(extract)
echo $$(($$(date +%s) - $$(cat $(seconds)))) seconds
while read line; do rm -rf $$line; done < $(removed)
cd $(extract) && ../debian/scripts/check-upstream
@@ -164,7 +163,9 @@ get-orig-source:
echo $$(($$(date +%s) - $$(cat $(seconds)))) seconds | tee seconds
@mv -f seconds $(seconds)
download-source-locally:
setup-local-src:
mkdir ../download_cache || true
cd debian/scripts/ungoogled-chromium; python3 -m buildkit downloads retrieve -b config_bundles/$(config_bundle) -c ../../../../download_cache
cd debian/scripts/ungoogled-chromium; python3 -m buildkit downloads unpack -b config_bundles/$(config_bundle) -c ../../../../download_cache ../../../
cd debian/scripts/ungoogled-chromium; python3 -m buildkit prune -b config_bundles/$(config_bundle) ../../../
cd debian/scripts/ungoogled-chromium; python3 -m buildkit patches export -b config_bundles/$(config_bundle) ../../patches/; fi
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env python3
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'scripts' / 'ungoogled-chromium'))
from buildkit.config import ConfigBundle
sys.path.pop(0)
def _item_generataor(config_bundle):
for key, value in config_bundle.gn_flags.items():
yield '='.join((key, value.replace('"', '\\"')))
if __name__ == '__main__':
print(' '.join(_item_generataor(ConfigBundle(sys.argv[1]))), end='')