Skip to content

Commit

Permalink
Merge pull request #96 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 2.10.0
  • Loading branch information
andyone authored Aug 26, 2021
2 parents 7d02f4b + 4975e06 commit 9bd1105
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Check specs with Perfecto
uses: essentialkaos/perfecto-action@master
uses: essentialkaos/perfecto-action@v1
with:
files: rpmbuilder.spec rpmbuilder-node.spec

Expand Down
11 changes: 1 addition & 10 deletions SOURCES/libexec/build-local.shx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ localBuild() {
$($pre)
fi

[[ -n "$git" ]] && packSourcesFromGit "$spec"
[[ -n "$svn" ]] && packSourcesFromSvn "$spec"
[[ -n "$bzr" ]] && packSourcesFromBzr "$spec"
[[ -n "$hg" ]] && packSourcesFromHg "$spec"
[[ -n "$gopack" ]] && packGolangSources "$spec"

[[ -n "$repo_spec" ]] && spec="$repo_spec"

[[ -n "$pack" || -n "$source_list" ]] && packSources "$spec" && show ""

packSources "$spec"
processSpec "$spec"

show ""
Expand Down
11 changes: 1 addition & 10 deletions SOURCES/libexec/build-remote.shx
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,7 @@ remoteBuild() {
$($pre)
fi

[[ -n "$git" ]] && packSourcesFromGit "$spec"
[[ -n "$svn" ]] && packSourcesFromSvn "$spec"
[[ -n "$bzr" ]] && packSourcesFromBzr "$spec"
[[ -n "$hg" ]] && packSourcesFromHg "$spec"
[[ -n "$gopack" ]] && packGolangSources "$spec"

[[ -n "$repo_spec" ]] && spec="$repo_spec"

[[ -n "$pack" || -n "$source_list" ]] && packSources "$spec" && show ""

packSources "$spec"
processSpec "$spec"

show ""
Expand Down
22 changes: 16 additions & 6 deletions SOURCES/libexec/sources-remote.shx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ downloadRemoteSources() {
doExit $ERROR_ARGS
fi

[[ -n "$git" ]] && packSourcesFromGit "$spec"
[[ -n "$svn" ]] && packSourcesFromSvn "$spec"
[[ -n "$bzr" ]] && packSourcesFromBzr "$spec"
[[ -n "$hg" ]] && packSourcesFromHg "$spec"
[[ -n "$gopack" ]] && packGolangSources "$spec"
packRemoteSources "$spec"

local source_file sources_list source_file_name patches_list files

Expand All @@ -42,7 +38,7 @@ downloadRemoteSources() {
files="$sources_list $patches_list"

for source_file in $files ; do
if [[ "$source_file" =~ ^(http|https|ftp) ]] ; then
if isURL "$source_file" ; then
source_file_name=$(basename "$source_file")

if [[ -f "$dlcache/$source_file_name" ]] ; then
Expand Down Expand Up @@ -136,3 +132,17 @@ isAccessibleURL() {
return 1
fi
}

# Checks if given string is URL (http/https/ftp)
#
# 1: Data (String)
#
# Code: Yes
# Echo: No
isURL() {
if [[ "$1" =~ ^(http|https|ftp) ]] ; then
return 0
fi

return 1
}
51 changes: 50 additions & 1 deletion SOURCES/libexec/sources.shx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,62 @@ require "sources-scm"

################################################################################

packSources() {
local spec="$1"

packRemoteSources "$spec"

if [[ -n "$repo_spec" ]] ; then
spec="$repo_spec"
fi

if [[ -n "$pack" || -n "$source_list" ]] ; then
packLocalSources "$spec"
show ""
fi
}

packRemoteSources() {
local spec="$1"
local sources

if [[ -n "${git}${svn}${bzr}${hg}${gopack}" ]] ; then
IFS=" " read -r -a sources <<< "$(getSources "$spec")"

if isURL "${sources[0]}" ; then
error "The sources section cannot contain the URL to the sources when downloading with git/svn/hg/bzr/gopack is used"
doExit $ERROR_SOURCE
fi
fi

if [[ -n "$git" ]] ; then
packSourcesFromGit "$spec"
fi

if [[ -n "$svn" ]] ; then
packSourcesFromSvn "$spec"
fi

if [[ -n "$bzr" ]] ; then
packSourcesFromBzr "$spec"
fi

if [[ -n "$hg" ]] ; then
packSourcesFromHg "$spec"
fi

if [[ -n "$gopack" ]] ; then
packGolangSources "$spec"
fi
}

# Pack sources to archive file
#
# 1: Path to spec file (String)
#
# Code: No
# Echo: No
packSources() {
packLocalSources() {
show "Packing source files to archive…"

local spec="$1"
Expand Down
2 changes: 1 addition & 1 deletion SOURCES/rpmbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi
APP="RPMBuilder"

# Utility version (String)
VER="2.9.0"
VER="2.10.0"

################################################################################

Expand Down
6 changes: 5 additions & 1 deletion rpmbuilder.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Summary: RPM package build helper
Name: rpmbuilder
Version: 2.9.0
Version: 2.10.0
Release: 0%{?dist}
License: Apache License, Version 2.0
Group: Development/Tools
Expand Down Expand Up @@ -55,6 +55,10 @@ rm -rf %{buildroot}
################################################################################

%changelog
* Thu Aug 26 2021 Anton Novojilov <[email protected]> - 2.10.0-0
- Improved fetching data from remote sources
- Code refactoring

* Tue Aug 17 2021 Anton Novojilov <[email protected]> - 2.9.0-0
- Improved sources cleanup process

Expand Down

0 comments on commit 9bd1105

Please sign in to comment.