maint: remove obsolete CI/maint and re-implement source index

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Yury V. Zaytsev 2024-10-26 18:22:29 +02:00
parent 73ef95df41
commit a018086f48
28 changed files with 231 additions and 278 deletions

48
.github/workflows/update-sources.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: update-sources
on:
push:
branches:
- master
jobs:
update-sources:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install GNU Global
run: sudo apt-get install -y global exuberant-ctags python3-pygments
- name: Checkout source repo
uses: actions/checkout@v4
with:
repository: MidnightCommander/source
path: HTML
ref: gh-pages
ssh-key: ${{ secrets.SOURCE_DEPLOY_KEY }}
- name: Create sources index
run: |
pushd HTML
git rm -rf *
popd
gtags
htags --suggest -t "Welcome to the Midnight Commander source tour!"
./maint/htagsfix
- name: Deploy to GitHub
run: |
cd HTML
touch .nojekyll
echo "source.midnight-commander.org" > CNAME
git config user.name "GitHub Actions"
git config user.email "github@midnight-commander.org"
git add .
git commit -m "Deploy to GitHub Pages"
git push --force-with-lease

View File

@ -1,31 +0,0 @@
language: c
sudo: true
env:
- CFLAGS=-Wno-error=shadow
install:
- sudo apt-get update -qq
- sudo apt-get install -y autoconf gettext autopoint libtool check indent
- sudo apt-get install -y e2fslibs-dev libaspell-dev libglib2.0-dev libgpm-dev libncurses5-dev libslang2-dev libssh2-1-dev libx11-dev unzip
- sudo apt-get install -y wget exuberant-ctags python-pygments ruby
before_script:
- git fetch --tags
script:
- ./maint/utils/check-indent.sh
- ./autogen.sh
- ./maint/utils/travis-build.sh
after_success:
- openssl aes-256-cbc -K $encrypted_036881b9e9dd_key -iv $encrypted_036881b9e9dd_iv -in ./maint/utils/deploy-key.enc -out $HOME/.ssh/deploy-key -d
- chmod 600 $HOME/.ssh/deploy-key
- echo "Host github.com" >> $HOME/.ssh/config
- echo " IdentityFile ~/.ssh/deploy-key" >> $HOME/.ssh/config
deploy:
provider: script
script: ./maint/utils/travis-deploy.sh
on:
branch: master

View File

@ -1,4 +0,0 @@
Please run the following command:
make indent
in the build root directory before each new commit.

View File

@ -1,7 +0,0 @@
This directory contains files used to maintain the project.
It should not be included into any releases or even snapshots.
Please run periodically the following command:
make cppcheck
in the build root directory. Fix as possible all code analysis
issues which found by the command.

View File

@ -1,9 +0,0 @@
This is a list of system configurations that we test the Midnight
Commander on. Feel free to add your own entries. To get your system
identification, run config.guess from the config subdirectory.
i386-unknown-freebsd4.11 Roland Illig <roland.illig@gmx.de>
i386-unknown-netbsdelf1.6.2 Roland Illig <roland.illig@gmx.de>
i686-pc-linux-gnu (SuSE 7.2) Roland Illig <roland.illig@gmx.de>
powerpc-ibm-aix4.3.3.0 Roland Illig <roland.illig@gmx.de>
sparc-sun-solaris2.8 Roland Illig <roland.illig@gmx.de>

View File

@ -27,7 +27,7 @@ set -e
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname $(dirname $(dirname $(pwd))))} MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname "$(dirname "$(pwd)")")}
#*** include section (source functions, for example) ******************* #*** include section (source functions, for example) *******************
@ -38,8 +38,8 @@ findIncludeDupsInDir() {
for i in $(find "${dir_name}" -name '*.[ch]'); do for i in $(find "${dir_name}" -name '*.[ch]'); do
file_name=$(echo $i | ${SED-sed} 's@'"${MC_SOURCE_ROOT_DIR}/"'@@g') file_name=$(echo $i | ${SED-sed} 's@'"${MC_SOURCE_ROOT_DIR}/"'@@g')
[ $(grep "^\s*${file_name}$" -c "${MC_SOURCE_ROOT_DIR}/maint/utils/find-dup-includes/exclude-list.cfg") -ne 0 ] && continue [ $(grep "^\s*${file_name}$" -c "${MC_SOURCE_ROOT_DIR}/maint/find-dup-includes/exclude-list.cfg") -ne 0 ] && continue
"${MC_SOURCE_ROOT_DIR}/maint/utils/find-dup-includes/find-in-one-file.pl" "${i}" "${MC_SOURCE_ROOT_DIR}/maint/find-dup-includes/find-in-one-file.pl" "${i}"
done done
} }

180
maint/htagsfix Executable file
View File

@ -0,0 +1,180 @@
#!/usr/bin/env ruby
#
# Fixes htags' output so that files have fixed names. E.g., S/542.html -> D/whatever.c.h.
#
# It addresses the following problem:
#
# "Can htags create permanent addresses?"
# http://lists.gnu.org/archive/html/help-global/2015-11/msg00002.html
#
require 'fileutils'
require 'pp'
Encoding.default_external = "BINARY"
$base = '.' # Where the HTML is stored.
$verbose = false
$debug = false
$create_subdirs = false # Experimental feature. Doesn't really work.
# Bonus: highlight the target line.
$css = "
a:target {
position: absolute;
left: 0;
height: 1.35em;
width: 100%;
background: yellow;
opacity: .5;
z-index: -1000;
}
"
#
# Computes pretty names for files:
#
# '.../S/456.html' => 'S/modules/tty.c.html'
#
def prettyname(full_path, prefix, kind, nid, ext)
gist = nid
start = IO.read(full_path, 1024)
if start =~ /<title>(.*?)<\/title>/ then
gist = $1
gist.gsub!(%r{/+$}, '') # remove trailing '/'s.
if not $create_subdirs then
gist.gsub!('/', '--')
end
gist.gsub!(%r{[^a-zA-Z0-9_.,/-]}, '-') # clean special characters.
end
return kind + '/' + gist + ext
end
class Counter
class << self
def init(total)
@total = total
end
def reset()
@count = 0
end
def report()
print "[#{@count}/#{@total}]\r"
@count += 1
end
def finish()
puts
end
end
end
#
# Returns a table explaining how to rename the files. E.g.:
#
# {
# 'S/456.html' => 'S/modules/tty.c.html'
# ...
# }
#
def build_cnv_tbl()
Counter.reset()
cnv = {}
Dir[$base + '/{[A-Z],files}/*.html'].each do |full_path|
#p full_path
if full_path =~ /(.*)\/((\w+)\/(\d+)(\.\w+))$/ then
prefix = $1 # "/home/joe/.../HTML"
path = $2 # "S/323.html"
kind = $3 # "S"
nid = $4 # "323"
ext = $5 # ".html"
pretty = prettyname(full_path, prefix, kind, nid, ext)
cnv[path] = pretty
end
Counter.report()
end
Counter.finish()
return cnv
end
#
# Make all the substiutions inside the files:
#
# <a href='../S/456.html'> --> <a href='../S/modules/tty.c.html'>
# ...
#
def mksub(cnv)
Counter.reset()
Dir[$base + '/**/*.html'].each do |path|
kind = path[$base.length .. -1][/\w+/]
text = IO.read(path)
fixed = text.gsub(/(<a href='(?:..\/)?)([^'#]+)/) do |a|
prefix = $1
target = $2
if cnv[target] then
target = cnv[target]
elsif cnv[kind + '/' + target] then
# This is a relative link of the form: href='456.html'
if cnv[kind + '/' + target].match /\/(.*)/ # converts "s/whatever.html" to "whatever.html"
target = $1
end
end
prefix + target
end
# Fix a problem in Opera, where empty lines are squashed.
fixed.gsub!(%r{(<a id='L\d+' name='L\d+'></a>)\n}, "\\1 \n")
if text != fixed then
IO.write(path, fixed)
puts(path + " modified") if $debug
end
Counter.report()
end
Counter.finish()
end
#
# Rename the files.
#
def rename(cnv)
Counter.reset()
cnv.each do |a, b|
src = $base + '/' + a
trg = $base + '/' + b
if $create_subdirs then
FileUtils.mkdir_p(File.dirname(trg))
end
File.rename(src, trg)
Counter.report()
end
Counter.finish()
end
def better_css(css_path)
text = IO.read(css_path)
IO.write(css_path, text + $css)
end
def main()
if not File.exists?($base + '/help.html') then
$base += '/HTML'
if not File.exists?($base + '/help.html') then
puts "Error: This doesn't look like htags' output directory."
exit(1)
end
end
Counter.init( Dir[$base + '/**/*.html'].length )
puts "Figuring out pretty names..."
cnv = build_cnv_tbl()
pp cnv if $verbose
puts "Updating links in files..."
mksub(cnv)
puts "Renaming files..."
rename(cnv)
puts "Enhancing the css..."
better_css($base + '/style.css')
puts "Done."
end
main()

View File

@ -1,47 +0,0 @@
#!/bin/bash
#
# Midnight Commander - check source code indentation
#
# Copyright (C) 2015
# The Free Software Foundation, Inc.
#
# Written by:
# Slava Zanko <slavazanko@gmail.com>, 2015
#
# This file is part of the Midnight Commander.
#
# The Midnight Commander 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.
#
# The Midnight Commander 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 -e
set -x
findUnindentedFiles() {
local directory=$1
find "${directory}" -name '*.[ch]' -print0 | \
xargs -0 indent \
--gnu-style \
--format-first-column-comments \
--indent-level4 \
--brace-indent0 \
--line-length100 \
--no-tabs \
--blank-lines-after-procedures
return $(git ls-files --modified | wc -l)
}
( findUnindentedFiles "lib" && findUnindentedFiles "src" && findUnindentedFiles "tests" ) || {
echo "Sources not indented"
git ls-files --modified
exit 1
}

Binary file not shown.

View File

@ -1 +0,0 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOpXSX8KMkqFPoXx4H+q0b9/taVceIoQu2QQQqqA/5MvlM0XD/YTBP2Nba235R+WSnC0F887+96xK7kx/48JrQeW5n+tle4Ot0NNfN0ON6pzhktshTk1YQUQfs5NDSXhBFXynTM9VgmXfFGxmG3nx+ym+hhN57IHnbwAQT5rk1cetaZNjoTVhEbVSzKJgqTQk1hUqRUuNFePPrXaMaqiWhaRl1gPYWQeNlqykT9p5tKgzbhO4lmwIGj+AUHOatTcp2qbgUElcUQuwd5Wt2CwvsM/8Pb1BUHHEl93qxERe4Nhxq98QOlqIoZa5gznIfw5iPXRpB9t5ijVL5qadWoNjn travis@midnight-commander.org

View File

@ -1,105 +0,0 @@
#!/bin/bash
#
# Midnight Commander - build and test common configurations
#
# Copyright (C) 2015
# The Free Software Foundation, Inc.
#
# Written by:
# Slava Zanko <slavazanko@gmail.com>, 2015
# Yury V. Zaytsev <yury@shurup.com>, 2015
#
# This file is part of the Midnight Commander.
#
# The Midnight Commander 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.
#
# The Midnight Commander 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 -e
set -x
function do_build() {
make
make -k check
make install
}
# Build distribution archive
mkdir -p distrib && cd $_
../configure
make dist-bzip2
DISTFILE=$(ls mc-*.tar.bz2)
DISTDIR=$(basename "$DISTFILE" .tar.bz2)
tar -xjf $DISTFILE
cd $DISTDIR
# Build default configuration (S-Lang)
mkdir -p build-default && pushd $_
../configure \
--prefix="$(pwd)/INSTALL_ROOT" \
--with-screen=slang \
--enable-maintainer-mode \
--enable-mclib \
--enable-charset \
--enable-aspell \
--enable-tests \
--enable-werror
do_build
popd
# Build default configuration (ncurses)
mkdir -p build-ncurses && pushd $_
../configure \
--prefix="$(pwd)/INSTALL_ROOT" \
--with-screen=ncurses \
--enable-maintainer-mode \
--enable-mclib \
--enable-charset \
--enable-aspell \
--enable-tests \
--enable-werror
do_build
popd
# Build all disabled
mkdir -p build-all-disabled && pushd $_
../configure \
--prefix="$(pwd)/INSTALL_ROOT" \
--disable-maintainer-mode \
--disable-mclib \
--disable-charset \
--disable-aspell \
--disable-largefile \
--disable-nls \
--disable-vfs \
--disable-background \
--without-x \
--without-gpm-mouse \
--without-internal-edit \
--without-diff-viewer \
--without-subshell \
--enable-tests \
--enable-werror
do_build
popd

View File

@ -1,71 +0,0 @@
#!/bin/bash
#
# Midnight Commander - deployment script for Travis CI
#
# Copyright (C) 2016
# The Free Software Foundation, Inc.
#
# Written by:
# Yury V. Zaytsev <yury@shurup.com>, 2016
#
# This file is part of the Midnight Commander.
#
# The Midnight Commander 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.
#
# The Midnight Commander 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 -e
set -x
GLOBAL_VERSION="6.5.7"
GLOBAL_URL="http://ftp.gnu.org/pub/gnu/global/global-${GLOBAL_VERSION}.tar.gz"
HTAGSFIX_URL="https://github.com/mooffie/htagsfix/raw/master/htagsfix"
mkdir .global && pushd .global # ignored by GLOBAL's indexer
wget ${GLOBAL_URL}
tar zxvf global-${GLOBAL_VERSION}.tar.gz > /dev/null 2>&1
pushd global-${GLOBAL_VERSION}
./configure --prefix=$(pwd)/install > /dev/null 2>&1
make > /dev/null 2>&1
make install > /dev/null 2>&1
popd
export PATH="$(pwd)/global-${GLOBAL_VERSION}/install/bin:$PATH"
popd
gtags -v > /dev/null 2>&1
htags --suggest -t "Welcome to the Midnight Commander source tour!" > /dev/null 2>&1
wget --no-check-certificate ${HTAGSFIX_URL}
ruby htagsfix > /dev/null 2>&1
cd HTML
touch .nojekyll
echo "source.midnight-commander.org" > CNAME
git init
git config user.name "Travis CI"
git config user.email "travis@midnight-commander.org"
git add . > /dev/null 2>&1
git commit -m "Deploy to GitHub Pages" > /dev/null 2>&1
git push --force --quiet git@github.com:MidnightCommander/source.git master:gh-pages > /dev/null 2>&1
exit 0