archlinux-downgrade / downgrade

Downgrade packages in Arch Linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help with cram test function

Ste74 opened this issue · comments

❓ Questions/Help

Checklist

  • No duplicate issues/PRs
  • [x ] Are you running the latest downgrade release from the AUR?

Environment

  • System information:
Linux ste74-dev 6.1.27-2-MANJARO #1 SMP PREEMPT_DYNAMIC Thu May 4 06:46:21 UTC 2023 x86_64 GNU/Linux
  • Downgrade version:
11.3.0

Questions/Help

Hi there,

i m part of Manjaro Team and i love downgrade but since Manjaro is not Arch i have patched your program for integrate our overlays packages. I have disabled check into pkgbuild because it fail but not understand how debug it because on the Archlinux side nothing is changed i have only added a checking for know where download the package. You can see here . manjaro-downgrade.patch is the current patch for adapt downgrade for our user case.

Thanks in advance for any tips
Cheers
Stefano Capitani

Hi Stefano, thanks for the question.

I do not fully understand the issue. Is cram raising an error when testing or does it concern PKGBUILD when building the package?

Please provide error logs and commands that you used, so I can reproduce the error.

Hi, thank you for answear.
Step for reproduce:
git clone git clone https://gitlab.manjaro.org/packages/community/manjaro-downgrade.git
cd manjaro-downgrade
git checkout github
makepkg -sr

errors:

    ~/manjaro-downgrade    github ?1    export LANG=C && makepkg -srCcf
==> Making package: manjaro-downgrade 2.0-2 (lun 8 mag 2023, 18:27:24)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...

Packages (1) python-cram-0.7-10

Total Installed Size:  0,17 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
:: Processing package changes...
(1/1) installing python-cram                       [######################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
==> Retrieving sources...
  -> Found downgrade-11.3.0.tar.gz
  -> Found atreya.pgp
  -> Found manjaro-downgrade.patch
==> Validating source files with sha256sums...
    downgrade-11.3.0.tar.gz ... Passed
    atreya.pgp ... Passed
    manjaro-downgrade.patch ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting downgrade-11.3.0.tar.gz with bsdtar
==> Starting prepare()...
patching file bin/downgrade
==> Removing existing $pkgdir/ directory...
==> Starting check()...
cram test
...!
--- test/main/invalid-input.t
+++ test/main/invalid-input.t.err
@@ -8,6 +8,7 @@
   > printf "ignore: %s\n" "${to_ignore[@]}"
   > printf "install: %s\n" "${to_install[@]}"
   > printf "exit code: %s\n" "$exit_code"
+  error: package 'foo|bar' was not found
   Failed to parse A.L.A.
   No results found
   Unable to downgrade foo|bar
.....................................
# Ran 41 tests, 0 skipped, 1 failed.
make: *** [Makefile:34: test] Error 1
==> ERROR: A failure occurred in check().
    Aborting...
==> Removing installed dependencies...
checking dependencies...

Packages (1) python-cram-0.7-10

Total Removed Size:  0,17 MiB

:: Do you want to remove these packages? [Y/n] 
:: Processing package changes...
(1/1) removing python-cram                         [######################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
    ~/manjaro-downgrade    github ?1    

Sorry for the foreign characters, i use custom zsh shell.

Stefano

cram test
...!
--- test/main/invalid-input.t
+++ test/main/invalid-input.t.err
@@ -8,6 +8,7 @@
   > printf "ignore: %s\n" "${to_ignore[@]}"
   > printf "install: %s\n" "${to_install[@]}"
   > printf "exit code: %s\n" "$exit_code"
+  error: package 'foo|bar' was not found
   Failed to parse A.L.A.
   No results found
   Unable to downgrade foo|bar
.....................................
# Ran 41 tests, 0 skipped, 1 failed.
make: *** [Makefile:34: test] Error 1

The diff above originates from the following line throwing an error:

LC_ALL=C.UTF8 "$PACMAN" -Qi "$1" 2>/dev/null | awk -F " : " '

error: package 'foo|bar' was not found should not be logged since we redirect stderr to /dev/null. So the problem could be with the redirection or the line being streamed to stdout instead.

Do you encounter this error when you build without the .patch files?

The patch adds the following line,

if [[ $(pacman -Si $name | grep '@manjaro') ]]

Which I suspect is where the extra output comes from:

% pacman -Si 'foo|bar'
error: package 'foo|bar' was not found

That shell is not correct. It should probably be more like,

if pacman -Si "$name" &>dev/null | grep -Fq '@manjaro'; then

So this seems to be a bug in the patch and unrelated to downgrade.

@atreyasha the line you quoted is probably not the source because you can see it (correctly) includes 2>/dev/null and is (also correctly) checking the output instead of passing it uselessly to [[ ;)

Thank you to point me .. pacman -Si Is the guilty so Need to modify this check ..

Thank you again

Cheers
Stefano