diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-01-07 17:24:08 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-01-07 17:24:08 (EST) |
commit | 2a2f1745ace9c33b22831ce67d96416cd229864d (patch) | |
tree | 1e5d8f8065e9593bc9972c1ac126cdefa530f3a6 |
Initial commit
-rw-r--r-- | .gitignore | 10 | ||||
-rwxr-xr-x | build | 18 | ||||
-rw-r--r-- | changelog | 5 | ||||
-rw-r--r-- | control | 7 | ||||
-rwxr-xr-x | extract-copyright-comments | 216 | ||||
-rw-r--r-- | format | 1 | ||||
-rwxr-xr-x | release | 13 | ||||
-rw-r--r-- | source.mk | 37 |
8 files changed, 307 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dd90d0e --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Vim swap and other dot files +.* +!.gitignore + +# Source archives +*-*.orig.tar.* +keyring.gpg + +# Work area +tmp/ @@ -0,0 +1,18 @@ +#!/usr/bin/make -f + +include ../source.mk + +nop: + @: + +build: + oh-autoconfigure + oh-autobuild + touch $@ + +install: build + oh-autoinstall + oh-fixperms + oh-strip + oh-installfiles + oh-shlibdeps diff --git a/changelog b/changelog new file mode 100644 index 0000000..342182c --- /dev/null +++ b/changelog @@ -0,0 +1,5 @@ +e2fsprogs (1.45.6-1) trunk + + * Initial release. + + -- Patrick McDermott <patrick.mcdermott@libiquity.com> Thu, 07 Jan 2021 17:18:30 -0500 @@ -0,0 +1,7 @@ +Maintainer: Patrick McDermott <patrick.mcdermott@libiquity.com> +Build-Depends: + opkbuild (>= 4.2.1), + opkhelper-3.0 (>= 3.1.3), + busybox (>= 1.32.0-1), + gpg, dirmngr, gpgconf, gpg-agent, +Homepage: http://e2fsprogs.sourceforge.net/ diff --git a/extract-copyright-comments b/extract-copyright-comments new file mode 100755 index 0000000..9cbf6bf --- /dev/null +++ b/extract-copyright-comments @@ -0,0 +1,216 @@ +#!/bin/sh +# +# Extract comments containing copyright notices from C/C++ files +# +# Copyright (C) 2020 Patrick McDermott +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +set -eu + +LF=' +' +HT=' ' + +bufc= +bufi= +c= + +getc() +{ + if [ ${bufi} -ge ${bufc} ]; then + c='' + else + eval "c=\${bufv_${bufi}}" + bufi=$((${bufi} + 1)) + fi +} + +extract_cxx_comment() +{ + local indent="${1}" + shift 1 + local comment='//' + + while :; do + getc + case "${c}" in + "${LF}") + break + ;; + '') + printf '\tError: Unterminated C++ comment\n' \ + 1>&2 + return 1 + ;; + *) + comment="${comment}${c}" + ;; + esac + done + + if printf '%s' "${comment}" | grep -Eqi \ + 'copyright|\(c\)|license|public domain' + then + printf '\t%s\n' "${indent}${comment}" + fi + + return 0 +} + +extract_c_comment() +{ + local indent="${1}" + shift 1 + local comment='/*' + local asterisk=false + + while :; do + getc + case "${c}" in + '*') + asterisk=true + comment="${comment}${c}" + ;; + '/') + comment="${comment}${c}" + if ${asterisk}; then + break + fi + ;; + '') + printf '\tError: Unterminated C comment\n' 1>&2 + return 1 + ;; + *) + asterisk=false + comment="${comment}${c}" + ;; + esac + done + + if printf '%s' "${comment}" | grep -Eqi \ + 'copyright|\(c\)|license|public domain' + then + printf '%s\n' "${indent}${comment}" | sed 's/^/\t/' + fi + + return 0 +} + +extract() +{ + local fn="${1}" + shift 1 + local newline=true + local indent='' + local quote= + + printf '%s\n' "${fn}" + + # Read file into array + eval "$(awk -v FS='' -v j=0 -v squote="'" -v esc_squote="'\\\\''" ' + { + for (i = 1; i <= NF; ++i) { + sub(squote, esc_squote, $i); + printf("bufv_%d=" squote "%s" squote "\n", + j++, $i); + }; + printf("bufv_%d=" squote "\n" squote "\n", j++); + } + END { + printf("bufc=%d", j); + } + ')" + bufi=0 + + while :; do + getc + case "${c}" in + '/') + newline=false + getc + case "${c}" in + '/') + extract_cxx_comment "${indent}"\ + || return 1 + ;; + '*') + extract_c_comment "${indent}" \ + || return 1 + ;; + esac + ;; + "${LF}") + newline=true + indent='' + ;; + "${HT}" | ' ') + if ${newline}; then + indent="${indent}${c}" + fi + ;; + "'" | '"') + newline=false + quote="${c}" + while :; do + getc + case "${c}" in + "${quote}") + break + ;; + \\) + # This doesn't + # explicitly handle + # octal, hexadecimal, or + # Unicode sequences; but + # it's good enough to + # handle escaped quotes. + getc + ;; + esac + done + ;; + '') + break + ;; + *) + newline=false + ;; + esac + done + + return 0 +} + +main() +{ + local f= + + if [ ${#} -eq 0 ]; then + extract 'INPUT' || return 1 + else + for f in "${@}"; do + if [ x"${f}" = x'-' ]; then + extract 'INPUT' || return 1 + else + extract "${f}" 0<"${f}" || return 1 + fi + done + fi + + return 0 +} + +main "${@}" @@ -0,0 +1 @@ +2.0 @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eu + +read src ver <<-EOF + $(sed '1s/^\(.*\) (\(.*\)) .*$/\1 \2/; q;' changelog) + EOF + +sed '/^ -- .* /{ s/^\( -- .* \).*$/\1'"$(LC_ALL='POSIX' date \ + '+%a, %d %b %Y %H:%M:%S %z')"'/; :l; n; b l; };' changelog >changelog~ +mv changelog~ changelog +git commit -m "changelog: Release ${src} ${ver}" -- changelog +git tag "${src}/${ver}" HEAD diff --git a/source.mk b/source.mk new file mode 100644 index 0000000..da0904c --- /dev/null +++ b/source.mk @@ -0,0 +1,37 @@ +z = gz +keys = \ + '3AB0 57B7 E78D 945C 8C55 91FB D36F 769B C118 04F0' + +upstream_sf_base = https://downloads.sourceforge.net/project/$(OPK_SOURCE) +upstream_path = $(OPK_SOURCE)/v$(OPK_SOURCE_VERSION_UPSTREAM) +upstream_archive = $(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).tar.$(z) +upstream_url = $(upstream_sf_base)/$(upstream_path)/$(upstream_archive) +source_archive = ../$(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).orig.tar.$(z) + +GNUPGHOME = gnupghome +# TODO: When GnuPG is built with TLS support, delete the second "keyserver" line +# to switch to a non-SKS keyserver. We can't switch yet, because the Web server +# at keys.openpgp.org redirects (HTTP 301) to HTTPS (and enforces it with HSTS). +keyserver = hkps://keys.openpgp.org +keyserver = hkp://pool.sks-keyservers.net +keyring = ../keyring.gpg +cleanup = gpgconf --kill all; rm -Rf '$(GNUPGHOME)'; sleep 5 + +$(keyring): + gpg --recv-keys $(keys) || { rm -Rf '$@'; exit 1; } + rm -f '$@~' + +$(source_archive): $(keyring) + wget -c '$(upstream_url)' '$(upstream_url).asc' + gpg --verify '$(upstream_archive).asc' + mv '$(upstream_archive)' '$(source_archive)' + +source: + install -m 0700 -d '$(GNUPGHOME)' + umask 0177; printf 'keyserver $(keyserver)\n' \ + 1>'$(GNUPGHOME)/dirmngr.conf' + umask 0177; printf 'no-default-keyring\nkeyring $(keyring)\nverbose\n' \ + 1>'$(GNUPGHOME)/gpg.conf' + GNUPGHOME='$(GNUPGHOME)' $(MAKE) -f ../source.mk '$(source_archive)' \ + || { $(cleanup); exit 1; } + $(cleanup) |