Skip to content

Commit

Permalink
Publish version 10.22.0-2 - Completions & testing
Browse files Browse the repository at this point in the history
Also, apply patches for the following issues in 10.22.0:

* Azure/azure-storage-azcopy#2483
* Azure/azure-storage-azcopy#2482

The second one by removing the version check entirely - I doubt many
Arch Linux users are interested in such a feature, especially if it adds
8 seconds to every invocation.
  • Loading branch information
carlsmedstad committed Dec 7, 2023
1 parent 858cb06 commit 7cc9c28
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 16 deletions.
11 changes: 7 additions & 4 deletions .SRCINFO
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pkgbase = azcopy
pkgdesc = A command-line utility designed for copying data to/from Microsoft Azure
pkgver = 10.22.0
pkgrel = 1
url = https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy
pkgrel = 2
url = https://github.com/Azure/azure-storage-azcopy
arch = x86_64
arch = i686
arch = arm
Expand All @@ -11,9 +11,12 @@ pkgbase = azcopy
arch = aarch64
license = MIT
makedepends = go
makedepends = git
replaces = azcopy-10
depends = glibc
source = azcopy-10.22.0.tar.gz::https://github.com/Azure/azure-storage-azcopy/archive/v10.22.0.tar.gz
source = remove-version-check.patch
source = fix-lifecyclemgr-nil-error.patch
sha512sums = e066a949098ba03770691cf7686e28c1adfdb8dca36f09933a0c5c3cde9dbd24e7e41ac4bc95c0bb35f3e01d2c68de75628aebae173f0e8d676be683965fcebf
sha512sums = d436770cf67213fd7118992d6c04a06e5604482b24213441296f2e18fe4653301652958019f7efeb460e54e3b673feb4cf5b1228d893ee39a81f55c9c0799e94
sha512sums = 524a0f75c3a736623fdf344f8b1d406557ed34c3582958f1a3c3ca222931b3edc0f727acf04d73f877951163e62e1ca3441bf579afef491bdde037901273ff90

pkgname = azcopy
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*
!.gitignore
!PKGBUILD
!.SRCINFO
!Makefile
!remove-version-check.patch
!fix-lifecyclemgr-nil-error.patch
77 changes: 65 additions & 12 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,31 +1,84 @@
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>
# Maintainer: Xuanrui Qi <[email protected]>
# Maintainer: Fabio 'Lolix' Loli <[email protected]>
# Maintainer: Jens Heremans <jensheremans[at]gmail[dot]com>
# Contributor: Jonas Heinrich <[email protected]>

pkgname=azcopy
pkgver=10.22.0
pkgrel=1
pkgrel=2
pkgdesc="A command-line utility designed for copying data to/from Microsoft Azure"
arch=('x86_64' 'i686' 'arm' 'armv6h' 'armv7h' 'aarch64')
url="https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy"
url="https://github.com/Azure/azure-storage-azcopy"
license=('MIT')
makedepends=('go' 'git')
replaces=('azcopy-10')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/Azure/azure-storage-azcopy/archive/v${pkgver}.tar.gz")
sha512sums=('e066a949098ba03770691cf7686e28c1adfdb8dca36f09933a0c5c3cde9dbd24e7e41ac4bc95c0bb35f3e01d2c68de75628aebae173f0e8d676be683965fcebf')
depends=('glibc')
makedepends=('go')
source=(
"${pkgname}-${pkgver}.tar.gz::$url/archive/v${pkgver}.tar.gz"
"remove-version-check.patch"
"fix-lifecyclemgr-nil-error.patch"
)
sha512sums=(
'e066a949098ba03770691cf7686e28c1adfdb8dca36f09933a0c5c3cde9dbd24e7e41ac4bc95c0bb35f3e01d2c68de75628aebae173f0e8d676be683965fcebf'
'd436770cf67213fd7118992d6c04a06e5604482b24213441296f2e18fe4653301652958019f7efeb460e54e3b673feb4cf5b1228d893ee39a81f55c9c0799e94'
'524a0f75c3a736623fdf344f8b1d406557ed34c3582958f1a3c3ca222931b3edc0f727acf04d73f877951163e62e1ca3441bf579afef491bdde037901273ff90'
)

prepare() {
mkdir -p "${srcdir}/src/github.com/Azure"
mv "${srcdir}/azure-storage-azcopy-${pkgver}" "${srcdir}/src/github.com/Azure/azure-storage-azcopy"
cd "${srcdir}/azure-storage-azcopy-${pkgver}"

# Due to the version check, each invocation takes ~8 seconds. See:
# https://github.com/Azure/azure-storage-azcopy/issues/2482
patch --forward --strip=1 --input="$srcdir/remove-version-check.patch"

# Fix intermittent nil pointer dereference in common/lifecyleMgr.go:375.
patch --forward --strip=1 --input="$srcdir/fix-lifecyclemgr-nil-error.patch"

# Avoid downloading Go dependencies in build() by doing it here instead
go mod download -x
}

build() {
cd "${srcdir}/src/github.com/Azure/azure-storage-azcopy"
go build -buildmode=pie
cd "${srcdir}/azure-storage-azcopy-${pkgver}"

export CGO_CPPFLAGS="$CPPFLAGS"
export CGO_CFLAGS="$CFLAGS"
export CGO_CXXFLAGS="$CXXFLAGS"
export CGO_LDFLAGS="$LDFLAGS"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"

go build -v -o azcopy

# Completions
./azcopy completion bash > azcopy.bash
./azcopy completion fish > azcopy.fish
./azcopy completion zsh > azcopy.zsh
}

check() {
cd "${srcdir}/azure-storage-azcopy-${pkgver}"

# Skip failing tests - not sure why they fail.
_unit_tests=$(
go list ./... \
| grep -v 'github.com/Azure/azure-storage-azcopy/v10/cmd' \
| grep -v 'github.com/Azure/azure-storage-azcopy/v10/common' \
| grep -v 'github.com/Azure/azure-storage-azcopy/v10/e2etest' \
| grep -v 'github.com/Azure/azure-storage-azcopy/v10/ste' \
| sort
)
# shellcheck disable=SC2086
go test $_unit_tests
}

package() {
install -Dm755 "${srcdir}/src/github.com/Azure/azure-storage-azcopy/azure-storage-azcopy" "${pkgdir}/usr/bin/azcopy"
install -Dm644 "${srcdir}/src/github.com/Azure/azure-storage-azcopy/LICENSE" "${pkgdir}/usr/share/licenses/$pkgname/LICENSE"
cd "${srcdir}/azure-storage-azcopy-${pkgver}"

install -Dm755 azcopy "${pkgdir}/usr/bin/azcopy"

install -Dm644 azcopy.bash "${pkgdir}/usr/share/bash-completion/completions/azcopy"
install -Dm644 azcopy.fish "${pkgdir}/usr/share/fish/vendor_completions.d/azcopy.fish"
install -Dm644 azcopy.zsh "${pkgdir}/usr/share/zsh/site-functions/_azcopy"

install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/$pkgname/LICENSE"
}
15 changes: 15 additions & 0 deletions fix-lifecyclemgr-nil-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/common/lifecyleMgr.go b/common/lifecyleMgr.go
index 57ba87d7..ed0a5f9e 100644
--- a/common/lifecyleMgr.go
+++ b/common/lifecyleMgr.go
@@ -372,7 +372,9 @@ func (lcm *lifecycleMgr) Exit(o OutputBuilder, applicationExitCode ExitCode) {
exitCode: applicationExitCode,
}

- AzcopyCurrentJobLogger.CloseLog()
+ if AzcopyCurrentJobLogger != nil {
+ AzcopyCurrentJobLogger.CloseLog()
+ }
if applicationExitCode != EExitCode.NoExit() {
// stall forever until the success message is printed and program exits
lcm.SurrenderControl()
54 changes: 54 additions & 0 deletions remove-version-check.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/cmd/root.go b/cmd/root.go
index 621c25e7..f3f8fa0d 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -54,7 +54,6 @@ var azcopyAwaitContinue bool
var azcopyAwaitAllowOpenFiles bool
var azcopyScanningLogger common.ILoggerResetable
var azcopyCurrentJobID common.JobID
-var azcopySkipVersionCheck bool
var retryStatusCodes string

type jobLoggerInfo struct {
@@ -161,15 +160,6 @@ var rootCmd = &cobra.Command{
common.IncludeAfterFlagName, IncludeAfterDateFilter{}.FormatAsUTC(adjustedTime))
jobsAdmin.JobsAdmin.LogToJobLog(startTimeMessage, common.LogInfo)

- if !azcopySkipVersionCheck {
- // spawn a routine to fetch and compare the local application's version against the latest version available
- // if there's a newer version that can be used, then write the suggestion to stderr
- // however if this takes too long the message won't get printed
- // Note: this function is necessary for non-help, non-login commands, since they don't reach the corresponding
- // beginDetectNewVersion call in Execute (below)
- beginDetectNewVersion()
- }
-
if debugSkipFiles != "" {
for _, v := range strings.Split(debugSkipFiles, ";") {
if strings.HasPrefix(v, "/") {
@@ -201,16 +191,6 @@ func Execute(logPathFolder, jobPlanFolder string, maxFileAndSocketHandles int, j
if err := rootCmd.Execute(); err != nil {
glcm.Error(err.Error())
} else {
- if !azcopySkipVersionCheck {
- // our commands all control their own life explicitly with the lifecycle manager
- // only commands that don't explicitly exit actually reach this point (e.g. help commands and login commands)
- select {
- case <-beginDetectNewVersion():
- // noop
- case <-time.After(time.Second * 8):
- // don't wait too long
- }
- }
glcm.Exit(nil, common.EExitCode.Success())
}
}
@@ -227,8 +207,6 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cmdLineExtraSuffixesAAD, trustedSuffixesNameAAD, "", "Specifies additional domain suffixes where Azure Active Directory login tokens may be sent. The default is '"+
trustedSuffixesAAD+"'. Any listed here are added to the default. For security, you should only put Microsoft Azure domains here. Separate multiple entries with semi-colons.")

- rootCmd.PersistentFlags().BoolVar(&azcopySkipVersionCheck, "skip-version-check", false, "Do not perform the version check at startup. Intended for automation scenarios & airgapped use.")
-
// Note: this is due to Windows not supporting signals properly
rootCmd.PersistentFlags().BoolVar(&cancelFromStdin, "cancel-from-stdin", false, "Used by partner teams to send in `cancel` through stdin to stop a job.")

0 comments on commit 7cc9c28

Please sign in to comment.