From: István Váradi Date: Tue, 24 Mar 2020 19:09:43 +0000 (+0100) Subject: Change Debian build to the new more Debian-y way X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~257^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7b2de328a252c1844b064e0c531e60f4d8614454;p=nextcloud-desktop.git Change Debian build to the new more Debian-y way Signed-off-by: István Váradi --- diff --git a/admin/linux/debian/drone-build.sh b/admin/linux/debian/drone-build.sh index ab426c131..209bb2016 100755 --- a/admin/linux/debian/drone-build.sh +++ b/admin/linux/debian/drone-build.sh @@ -3,6 +3,8 @@ set -xe shopt -s extglob +env + PPA=ppa:nextcloud-devs/client PPA_ALPHA=ppa:nextcloud-devs/client-alpha PPA_BETA=ppa:nextcloud-devs/client-beta @@ -10,7 +12,10 @@ PPA_BETA=ppa:nextcloud-devs/client-beta OBS_PROJECT=home:ivaradi OBS_PROJECT_ALPHA=home:ivaradi:alpha OBS_PROJECT_BETA=home:ivaradi:beta -OBS_PACKAGE=nextcloud-client +OBS_PACKAGE=nextcloud-desktop + +UBUNTU_DISTRIBUTIONS="xenial bionic eoan focal" +DEBIAN_DISTRIBUTIONS="buster stretch" pull_request=${DRONE_PULL_REQUEST:=master} @@ -33,7 +38,7 @@ fi set -x cd "${DRONE_WORKSPACE}" -read basever kind <<<$(admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog stable) +read basever revdate kind <<<$(admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog stable) cd "${DRONE_DIR}" @@ -49,55 +54,40 @@ fi origsourceopt="" -if ! wget http://ppa.launchpad.net/${repo}/ubuntu/pool/main/n/nextcloud-client/nextcloud-client_${basever}.orig.tar.bz2; then - cp -a ${DRONE_WORKSPACE} nextcloud-client_${basever} - tar cjf nextcloud-client_${basever}.orig.tar.bz2 --exclude .git nextcloud-client_${basever} - origsourceopt="-sa" -fi +cp -a ${DRONE_WORKSPACE} nextcloud-desktop_${basever}-${revdate} +tar cjf nextcloud-desktop_${basever}-${revdate}.orig.tar.bz2 --exclude .git --exclude binary nextcloud-desktop_${basever}-${revdate} -for distribution in xenial bionic eoan focal groovy stable oldstable; do - rm -rf nextcloud-client_${basever} - cp -a ${DRONE_WORKSPACE} nextcloud-client_${basever} +cd "${DRONE_WORKSPACE}" +git config --global user.email "drone@noemail.invalid" +git config --global user.name "Drone User" - cd nextcloud-client_${basever} +for distribution in ${UBUNTU_DISTRIBUTIONS} ${DEBIAN_DISTRIBUTIONS}; do + git checkout -- . + git clean -xdf - cp -a admin/linux/debian/debian . - if test -d admin/linux/debian/debian.${distribution}; then - tar cf - -C admin/linux/debian/debian.${distribution} . | tar xf - -C debian - fi + git fetch origin debian/dist/${distribution}/${DRONE_TARGET_BRANCH} + git checkout origin/debian/dist/${distribution}/${DRONE_TARGET_BRANCH} - admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution} - cp /tmp/tmpchangelog debian/changelog - if test -f admin/linux/debian/debian.${distribution}/changelog; then - cat admin/linux/debian/debian.${distribution}/changelog >> debian/changelog - else - cat admin/linux/debian/debian/changelog >> debian/changelog - fi + git merge ${DRONE_COMMIT} - for p in debian/post-patches/*.patch; do - if test -f "${p}"; then - echo "Applying ${p}" - patch -p1 < "${p}" - fi - done + admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution} ${revdate} + cp /tmp/tmpchangelog debian/changelog - fullver=`head -1 debian/changelog | sed "s:nextcloud-client (\([^)]*\)).*:\1:"` + fullver=`head -1 debian/changelog | sed "s:nextcloud-desktop (\([^)]*\)).*:\1:"` EDITOR=true dpkg-source --commit . local-changes dpkg-source --build . - dpkg-genchanges -S ${origsourceopt} > "../nextcloud-client_${fullver}_source.changes" + dpkg-genchanges -S -sa > "../nextcloud-desktop_${fullver}_source.changes" if test -f ~/.has_ppa_keys; then debsign -k7D14AA7B -S fi - - cd .. done +cd .. +ls -al if test "${pull_request}" = "master"; then - kind=`cat kind` - if test "$kind" = "alpha"; then PPA=$PPA_ALPHA OBS_PROJECT=$OBS_PROJECT_ALPHA @@ -107,24 +97,16 @@ if test "${pull_request}" = "master"; then fi if test -f ~/.has_ppa_keys; then - for changes in nextcloud-client_*~+([a-z])1_source.changes; do - case "${changes}" in - *oldstable1*) - ;; - *) - dput $PPA $changes > /dev/null - ;; - esac + for distribution in ${UBUNTU_DISTRIBUTIONS}; do + changes=$(ls -1 nextcloud-desktop_*~${distribution}1_source.changes) + if test -f "${changes}"; then + dput $PPA "${changes}" > /dev/null + fi done - for distribution in stable oldstable; do - if test "${distribution}" = "oldstable"; then - pkgsuffix=".${distribution}" - pkgvertag="~${distribution}1" - else - pkgsuffix="" - pkgvertag="" - fi + for distribution in ${DEBIAN_DISTRIBUTIONS}; do + pkgsuffix=".${distribution}" + pkgvertag="~${distribution}1" package="${OBS_PACKAGE}${pkgsuffix}" OBS_SUBDIR="${OBS_PROJECT}/${package}" @@ -136,10 +118,10 @@ if test "${pull_request}" = "master"; then osc delete ${OBS_SUBDIR}/* fi - cp ../nextcloud-client*.orig.tar.* ${OBS_SUBDIR}/ - cp ../nextcloud-client_*[0-9.][0-9]${pkgvertag}.dsc ${OBS_SUBDIR}/ - cp ../nextcloud-client_*[0-9.][0-9]${pkgvertag}.debian.tar* ${OBS_SUBDIR}/ - cp ../nextcloud-client_*[0-9.][0-9]${pkgvertag}_source.changes ${OBS_SUBDIR}/ + cp ../nextcloud-desktop*.orig.tar.* ${OBS_SUBDIR}/ + cp ../nextcloud-desktop_*[0-9.][0-9]${pkgvertag}.dsc ${OBS_SUBDIR}/ + cp ../nextcloud-desktop_*[0-9.][0-9]${pkgvertag}.debian.tar* ${OBS_SUBDIR}/ + cp ../nextcloud-desktop_*[0-9.][0-9]${pkgvertag}_source.changes ${OBS_SUBDIR}/ osc add ${OBS_SUBDIR}/* cd ${OBS_SUBDIR} diff --git a/admin/linux/debian/scripts/git2changelog.py b/admin/linux/debian/scripts/git2changelog.py index e15a0201b..3cc9c4151 100755 --- a/admin/linux/debian/scripts/git2changelog.py +++ b/admin/linux/debian/scripts/git2changelog.py @@ -28,24 +28,27 @@ def getCommitVersion(commit): major=None minor=None patch=None - for line in subprocess.check_output(["git", "show", - commit + ":VERSION.cmake"]).splitlines(): - m = re.match("set\( MIRALL_VERSION_([A-Z]+) +([0-9])+ *\)", line) - if m is not None: - kind=m.group(1) - version=m.group(2) - if kind=="MAJOR": - major=version - elif kind=="MINOR": - minor=version - elif kind=="PATCH": - patch=version - if major and minor and patch: - return major + "." + minor + "." + patch - else: + try: + for line in subprocess.check_output(["git", "show", + commit + ":VERSION.cmake"]).splitlines(): + m = re.match("set\( MIRALL_VERSION_([A-Z]+) +([0-9])+ *\)", line) + if m is not None: + kind=m.group(1) + version=m.group(2) + if kind=="MAJOR": + major=version + elif kind=="MINOR": + minor=version + elif kind=="PATCH": + patch=version + if major and minor and patch: + return major + "." + minor + "." + patch + else: + return None + except: return None -def collectEntries(baseCommit, baseVersion, kind): +def collectEntries(baseCommit, baseVersion, kind, finalRevDate): scriptdir = os.path.dirname(__file__) configPath = os.path.join(scriptdir, "git2changelog.cfg") @@ -117,7 +120,10 @@ def collectEntries(baseCommit, baseVersion, kind): if entries: (commit, name, email, date, revdate, subject, baseVersion, kind) = entries[-1] - revdate = datetime.datetime.now().strftime("%Y%m%d.%H%M%S")+ "." + commit + if finalRevDate is None: + revdate = datetime.datetime.now().strftime("%Y%m%d.%H%M%S")+ "." + commit + else: + revdate = finalRevDate entries[-1] = (commit, name, email, date, revdate, subject, baseVersion, kind) entries.reverse() @@ -126,32 +132,35 @@ def collectEntries(baseCommit, baseVersion, kind): def genChangeLogEntries(f, entries, distribution): latestBaseVersion = None + latestRevDate = None latestKind = None for (commit, name, email, date, revdate, subject, baseVersion, kind) in entries: if latestBaseVersion is None: latestBaseVersion = baseVersion + latestRevDate = revdate latestKind = kind upstreamVersion = baseVersion + "-" + revdate if distribution=="stable": version = upstreamVersion else: - version = upstreamVersion + "~" + distribution + "1" - print("nextcloud-client (%s) %s; urgency=medium" % (version, distribution), file=f) + version = upstreamVersion + "-1.0~" + distribution + "1" + print("nextcloud-desktop (%s) %s; urgency=medium" % (version, distribution), file=f) print(file=f) print(" * " + subject, file=f) print(file=f) print(" -- %s <%s> %s" % (name, email, date), file=f) print(file=f) - return (latestBaseVersion, latestKind) + return (latestBaseVersion, latestRevDate, latestKind) if __name__ == "__main__": distribution = sys.argv[2] + finalRevDate = sys.argv[3] if len(sys.argv)>3 else None #entries = collectEntries("8aade24147b5313f8241a8b42331442b7f40eef9", "2.2.4", "release") - entries = collectEntries("f9b1c724d6ab5431e0cd56b7cd834f2dd48cebb1", "2.4.0", "beta") - + entries = collectEntries("f9b1c724d6ab5431e0cd56b7cd834f2dd48cebb1", + "2.4.0", "beta", finalRevDate) with open(sys.argv[1], "wt") as f: - (baseVersion, kind) = genChangeLogEntries(f, entries, distribution) - print(baseVersion, kind) + (baseVersion, revdate, kind) = genChangeLogEntries(f, entries, distribution) + print(baseVersion, revdate, kind)