1
0

provide upstream source

This commit is contained in:
Konstantin Demin 2024-10-29 05:12:06 +03:00
parent b4ab39d64d
commit 769f655cd9
3 changed files with 154 additions and 22 deletions

10
debian/README.source vendored
View File

@ -19,12 +19,6 @@ installed.
It involves deleting files for DFSG compliance, as listed in the
Files-Excluded field in debian/copyright.
2) Run: make -f debian/rules orig
This will apply the main quilt series to the upstream source, which
will usually fail due to conflicts with upstream changes. You need
to resolve those by dropping or refreshing patches.
Recording updates in the changelog
----------------------------------
@ -158,10 +152,6 @@ debian/control Generates the control file by invoking the
code to make sure that it is never run during an automatic
build.
orig Populate the current directory with all files from the unpacked
upstream tarball in ../orig/linux_${ver} and apply the Debian
quilt patch stack.
clean-generated Clean up all auto-generated files inside the ./debian directory
maintainerclean What clean-generated does and additionally also cleans up all

153
debian/bin/new-release vendored Executable file
View File

@ -0,0 +1,153 @@
#!/bin/sh
set -ef
prj_dir=$(readlink -f "$(dirname "$0")/../..")
cd "${prj_dir}"
[ -s debian/changelog ]
dpkg-parsechangelog --show-field Source | grep -Eq '^linux'
ch_ver=$(dpkg-parsechangelog --show-field Version)
ch_dist=$(dpkg-parsechangelog --show-field Distribution)
do_idle() {
nice -n +40 chrt -i 0 ionice -c 3 "$@"
}
v=$1
if [ -z "$v" ] ; then
v=$(echo "${ch_ver}" | sed -E 's/^\d+://;s/-[^-]+$//')
fi
IFS=. read -r major minor __patch <<-EOF
$v
EOF
[ -n "${minor}" ]
ver_path="v${major}.${minor}"
[ "${minor}" = 0 ] || ver_path="v${major}.x"
tarball_new="linux_${v}.orig.tar"
tarball_new_comp="${tarball_new}.xz"
do_compress() { do_idle xz -1vv "$1" ; }
while ! [ -s "../${tarball_new_comp}" ] ; do
tarball_path_web="pub/linux/kernel/${ver_path}"
tarball_path_git="pub/scm/linux/kernel/git/stable/linux.git/snapshot"
tarball_orig="linux-${v}.tar.xz"
tarball_fallback="linux-${v}.tar.gz"
src_dir="linux-${v}"
d=$(mktemp -d)
cd "$d/"
tarball_ok=0
while [ ${tarball_ok} = 0 ] ; do
[ -s "${prj_dir}/../${tarball_orig}" ] || break
tar xf "${prj_dir}/../${tarball_orig}" || break
tarball_ok=1 ; break
done
if [ "${tarball_ok}" = 0 ] ; then
rm -rf "${src_dir}"
do_download() { do_idle aria2c -c -V -j 8 -x 4 -s 16 "$@" ; }
# aria_opts_pxy='--connect-timeout=5 --retry-wait=5 --timeout=30'
aria_opts_web='--connect-timeout=15 --retry-wait=15 --timeout=240'
set +e
while : ; do
do_download ${aria_opts_web} \
"https://cdn.kernel.org/${tarball_path_web}/${tarball_orig}" \
"https://kernel.org/${tarball_path_web}/${tarball_orig}" \
&& break
do_download ${aria_opts_web} \
"https://cdn.kernel.org/${tarball_path_web}/${tarball_fallback}" \
"https://kernel.org/${tarball_path_web}/${tarball_fallback}" \
"https://git.kernel.org/${tarball_path_git}/${tarball_fallback}" \
&& break
true ; break
done
set -e
while [ "${tarball_ok}" = 0 ] ; do
rm -rf "${src_dir}"
[ -s "${tarball_orig}" ] || break
tar xf "${tarball_orig}" || break
cp -nv "${tarball_orig}" "${prj_dir}/../${tarball_orig}"
tarball_ok=1 ; break
done
while [ "${tarball_ok}" = 0 ] ; do
rm -rf "${src_dir}"
[ -s "${tarball_fallback}" ] || break
tar xf "${tarball_fallback}" || break
tarball_ok=1 ; break
done
rm -f "${tarball_orig}" "${tarball_fallback}"
fi
[ "${tarball_ok}" = 1 ] || {
cd "/"
rm -rfv "$d"
exit 1
}
list_excluded() {
local file field
file="${prj_dir}/debian/copyright"
field='Files-Excluded'
[ -s "${file}" ]
sed -E -n \
-e "/^${field}:/,/^\S/{s/^${field}://;p;}" \
< "${file}" \
| sed -E \
-e '$!{/^.+$/H;d;};x;s/(\s|\n)+/ /g;s/^ //;'
}
files_exclude=$(list_excluded)
for i in ${files_exclude} ; do
case "$i" in
*\** | *\?* )
find "${src_dir}/" -path "${src_dir}/$i" -exec rm -rfv {} +
;;
* )
rm -rfv "${src_dir}/$i"
;;
esac
done
tar_opts='--blocking-factor=1 --numeric-owner --owner=0 --group=0 --no-xattrs --no-selinux --no-acls'
find "${src_dir}/" ! -type d -printf '%p\0' | sort -zuV \
| tar ${tar_opts} --null -T - -cf "${tarball_new}"
do_compress "${tarball_new}"
cp -v "${tarball_new_comp}" "${prj_dir}/../"
cd "${prj_dir}/"
rm -rf "$d/"
done
if [ -z "$2" ] ; then
pkg_ver="${v}-1"
if [ "${pkg_ver}" != "${ch_ver}" ] ; then
dch -D "${ch_dist}" -v "${pkg_ver}" \
'New upstream stable update:' \
"https://www.kernel.org/pub/linux/kernel/${ver_path}/ChangeLog-${v}"
fi
else
pkg_ver="${v}-$2"
shift 2
dch -D "${ch_dist}" -v "${pkg_ver}" "${@:-write reason here}"
fi

13
debian/rules vendored
View File

@ -49,17 +49,6 @@ binary-indep: build-indep
dh_testdir
$(MAKE) -f debian/rules.gen binary-indep
DIR_ORIG = ../orig/$(DEB_SOURCE)-$(DEB_VERSION_EPOCH_UPSTREAM)
TAR_ORIG = ../$(DEB_SOURCE)_$(DEB_VERSION_EPOCH_UPSTREAM).orig.tar.xz
orig: $(DIR_ORIG)
rsync --delete --exclude /debian --exclude .git --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
QUILT_PATCHES='$(CURDIR)/debian/patches' QUILT_PC=.pc quilt push --quiltrc - -a -q --fuzz=0
$(DIR_ORIG): $(TAR_ORIG)
mkdir -p ../orig
tar -C ../orig -xaf $(TAR_ORIG)
CLEAN_PATTERNS := $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/lib/python/debian_linux/__pycache__ $$(find debian -maxdepth 1 -type d -name 'linux-*') debian/*-tmp debian/*.substvars
clean-generated:
@ -122,4 +111,4 @@ debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES)
@echo
exit 1
.PHONY: binary binary-% build build-% clean debian/control-real orig setup source clean-generated
.PHONY: binary binary-% build build-% clean debian/control-real setup source clean-generated