LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   slackpkg vs. third-party package repository (https://www.linuxquestions.org/questions/slackware-14/slackpkg-vs-third-party-package-repository-4175427364/)

phenixia2003 06-04-2016 12:21 PM

Hello,

Quote:

Originally Posted by zerouno (Post 5555429)
Seems that
Code:

sed -e 1iTEXT -e 1d filename
does work, but I'm not sure that
Code:

sed --expression "${PRIORITYIDX}i${PKGDATA[*]}"  --expression "${LINEIDX}d" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
does work for any $PRIORITYIDX and for any $LINEIDX

hmm, correct me if I'm wrong, but, if you insert before deleting, you should delete at LINEIDX+1 when PRIORITYIDX (ie. insert point) < LINEIDX (ie. delete point).


Quote:

Originally Posted by zerouno (Post 5555429)
currently I've solved with
Code:

if [ ${PRIORITYIDX} -ne ${LINEIDX} ];then
  mv ${TMPDIR}/pkglist ${TMPDIR}/pkglist.old
  sed --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
fi

since it is not useful to remove and reinsert the same line at the same point

I'm ok with that.

--
SeB

zerouno 06-04-2016 04:29 PM

Quote:

Originally Posted by phenixia2003 (Post 5555890)
hmm, correct me if I'm wrong, but, if you insert before deleting, you should delete at LINEIDX+1 when PRIORITYIDX (ie. insert point) < LINEIDX (ie. delete point).

The same that I thought. But seems that the new inserted lines are not considered by the other expressions.

No one of the following statement respect what I thought.
Code:

$ cat foo
a
b
c
d

$ cat foo|sed -e '3d' -e '1d'
b
d

(ok)

$ cat foo|sed -e '1d' -e '3d'
b
d

(expected 'b,c')

$ cat foo|sed -e '2ihello' -e 's/hello/world/'
a
hello
b
c
d

(expected 'a,world,b,c,d')

$ cat foo|sed -e '2ihello' -e 's/a/z/'
z
hello
b
c
d

(ok)

$ cat foo|sed  -e 's/a/z/' -e '2iaaa'
z
aaa
b
c
d

(ok)

$ cat foo|sed -e '2iaaa' -e 's/a/z/'
z
aaa
b
c
d

(expected 'z,zaa,b,c,d')

$ cat foo|sed  -e '2d' -e '1iz'       
z
a
c
d

(ok)

$ cat foo|sed  -e '1iz' -e '2d'
z
a
c
d

(expected 'z,b,c,d')

but the line number in the expression seems that just match the input file, not the manipulation. From 'man sed'
Quote:

number Match only the specified line number (which increments cumulatively across files, unless the -s option is specified on the
command line).
Well, today I learned another thing :)

Didier Spaier 06-04-2016 05:46 PM

Quote:

Originally Posted by zerouno (Post 5555990)
The same that I thought. But seems that the new inserted lines are not considered by the other expressions.

These lines are not inserted in the file, just written to standard output. The sed commands takes each line of the file as input, not a text written to standard output, so the sed commands have no effect on such text. In other words, the commands you use apply to the pattern space and the 'i' command doesn't write to the pattern space so no further command is applied to that text.

Quote:

No one of the following statement respect what I thought.
Code:

$ cat foo
a
b
c
d

$ cat foo|sed -e '3d' -e '1d'
b
d

(ok)

$ cat foo|sed -e '1d' -e '3d'
b
d

(expected 'b,c')

=> No. The '1d' command doedn't change the line numbering of the
  input file but deletes the pattern space and starts a new cycle.

$ cat foo|sed -e '2ihello' -e 's/hello/world/'
a
hello
b
c
d

(expected 'a,world,b,c,d')

=> No, as stated above "hello" is just output on your terminal,
  not to the pattern space, so the 's' command does nothing to it.

$ cat foo|sed -e '2ihello' -e 's/a/z/'
z
hello
b
c
d

(ok)

$ cat foo|sed  -e 's/a/z/' -e '2iaaa'
z
aaa
b
c
d

(ok)


$ cat foo|sed -e '2iaaa' -e 's/a/z/'
z
aaa
b
c
d

(expected 'z,zaa,b,c,d')

=> Again, 'aaa' is not written to the pattern space so no further command is applied to it.

$ cat foo|sed  -e '2d' -e '1iz'       
z
a
c
d

(ok)


$ cat foo|sed  -e '1iz' -e '2d'
z
a
c
d

(expected 'z,b,c,d')

=> No, that you write 'z' to stdout doen't change the numbering of lines of the input file,
  so the line that contains 'b' has still the #2 and thus is the one deleted

but the line number in the expression seems that just match the input file, not the manipulation. From 'man sed'


Well, today I learned another thing :)
IMO the right way to learn sed is not to read "man sed" but rather the POSIX specification. The same apply to other utilities as well as to the shell command language.

gegechris99 06-04-2016 05:55 PM

Quote:

Originally Posted by zerouno (Post 5555990)
but the line number in the expression seems that just match the input file, not the manipulation

Should you want to have the second sed expression applied to the result of the first one why not used a | ? It might be ugly but it works.

Code:

$ cat foo | sed -e '1d' | sed -e '3d'
b
c

Maybe a bit off-topic but I'm not sure that the quoted section of sed man page is relevant to your issue.

Quote:

number Match only the specified line number (which increments cumulatively across files, unless the -s option is specified on the
command line).
I'm no sed expert but my understanding of the above is relevant when you have more than one input file for the sed command as explained here.

Code:

$ cat foo
a
b
c
d
$ cat bar
e
f
g
$ sed -n '1,6p' foo bar
a
b
c
d
e
f
$ sed -n '1,2p' foo bar
a
b
$ sed -s -n '1,2p' foo bar
a
b
e
f


Didier Spaier 06-04-2016 06:07 PM

Quote:

Originally Posted by gegechris99 (Post 5556015)
Should you want to have the second sed expression applied to the result of the first one why not used a | ? It might be ugly but it works.

Code:

$ cat foo | sed -e '1d' | sed -e '3d'
b
c


It works but is overly complicated. Also, cat is useless. Just write instead:
Code:

sed -e '1d' -e '4d' foo
or:
Code:

sed '1d;4d' foo
And the order of the commands doesn't matter in this case so this works as well:
Code:

sed '4d;1d' foo

zerouno 06-05-2016 01:46 PM

1 Attachment(s)
Someone has tested bash completation?

here another version (copy as /etc/bash-completation/slackpkg)

Code:

# Slackware slackpkg(8) completion                            -*- shell-script -*-

                                                                                                                                                       
_slackpkg()                                                                                                                                           
{                                                                                                                                                     
    local cur prev words cword                                                                                                                         
    _init_completion || return                                                                                                                         
                                                                                                                                                       
    local special i wc                                                                                                                                 
    wc=${#words[@]}                                                                                                                                   
                                                                                                                                                       
    for (( i=0; i < ${#words[@]}-1; i++ )); do                                                                                                         
      if [[ ${words[i]} == @(install|remove|search|upgrade|reinstall|clean-system|upgrade-all|install-new|search|file-search|info|update|new-config|check-updates) ]]; then
        special=${words[i]}
        break
      fi
    done

    if [[ -n $special ]]; then
      case $special in
        upgrade|remove) COMPREPLY=( $( cd /var/log/packages; ls -- $cur* 2>/dev/null|rev|cut -f4- -d-|rev ) ) ;;
        update)  (( i++ )) ; (( wc-- )) ; [ $i -eq $wc ]&& COMPREPLY=( $( echo gpg|grep "^$cur" ) ) ;;
        search) COMPREPLY=( $( grep -- "$cur" /var/lib/slackpkg/pkglist 2>/dev/null|awk '{print $2}'|grep -- "$cur" ) ) ;;
        info) COMPREPLY=( $( grep -- " $cur" /var/lib/slackpkg/pkglist 2>/dev/null|awk '{print $2}'|grep -- "^$cur" ) ) ;;
        install) COMPREPLY=( $(cd /var/log/packages
                              grep "^[^ ]* $cur" /var/lib/slackpkg/pkglist 2>/dev/null|awk '{print $2}' |
                                      grep -v -f <(ls -- $cur* 2>/dev/null|rev|cut -f4- -d-|rev|sed -r -e "s/^/^/" -e "s/$/$/")
                            ) )
                ;;
        reinstall) [ ! -z "$cur" ]&& COMPREPLY=( $( cd /var/log/packages
                                grep "^[^ ]* $cur" /var/lib/slackpkg/pkglist 2>/dev/null|
                                      grep -f <(ls -- $cur* 2>/dev/null) |awk '{print $2}'
                            ) )
                ;;
        update) COMPREPLY=( gpg ) ;;
      esac
      return 0
    fi

    if [[ "$cur" == -* ]]; then
      COMPREPLY=( $( compgen -W '
                                    -delall=off -checkmd5=off -checkgpg=off -checksize=on
                                    -postinst=off -onoff=off -download_all=off -dialog=off
                                    -batch=on -only_new_dotnew=on
                                    -use_includes=off -spinning=off -default_answer=yes
            ' -- "$cur" ) )
    else

      COMPREPLY=( $( compgen -W '
                                    install remove search upgrade reinstall
                                    clean-system upgrade-all install-new
                                    search file-search
                                    info update new-config check-updates
                                    -
            ' -- "$cur" ) )

    fi

    return 0
} &&
complete -F _slackpkg slackpkg


Drakeo 06-05-2016 02:09 PM

Through the years Slackpkg has become KISS. after that it is well not Slack it is just to much work trying to tell people like I like it.
so create your own repo. Your a slacker that's what it is about. And KISS the the work away. Some times you just have to do it by your self.
:)

zerouno 06-06-2016 03:19 PM

slackpkg+ 1.7.0 is ready. I've just to reorder the changelog, adjust the slackbuild and my build/upload scripts.

Also I have to re-organize the github repository.
The proposal is the following: https://github.com/zuno/testplus
"devel" branch was removed and the "master" will be the main line (development) branch, as slackware-current does; and the branches "1.6" and "1.7" will be the stable packages (and the following backported patches from "master" branch)
This means that I must do a forced commit to rename master to 1.6 and devel to master.

However if I want to hold the current structure, the "devel" branch have to be merged in "master" branch, but the 'merge' command fails since the "stable" branch was merged in "master", so I must however do a forced commit with no-fastforward option (I'm not a git expert).

zerouno 06-07-2016 01:22 PM

Slackpkg+ 1.7.0 stable was released.

Currently http://slakfinder.org/slackpkg+/ contains the 1.6 and
http://slakfinder.org/slackpkg+dev/ contains the 1.7.0rc3
You can find the new version in http://slakfinder.org/slackpkg+1.7/


I ask you to test it by configuring the 1.7 repository for last minute bug (packaging or uploading bugs; remember that the 1.7 was bird as a more tested release before the official release).

this is the git branch https://github.com/zuno/slackpkgplus/tree/1.7

gegechris99 06-07-2016 04:07 PM

Thanks for the new stable version 1.7.0

I just installed it and ran an upgrade. It was OK and the changelog (from Slackware only for now) was correctly displayed.

Using the default values for the new parameters, I tested the file search with incomplete/complete word (upgradep/upgradepkg), the case-sensitive search (MPlayer, mplayer and Mplayer) and got the expected results.

The search of changelog.txt in parent directory for alienbob current repository worked. I'm just wondering if it's wise to show in the stderr log that there is an error when looking into the initial directory. I was a bit confused initially and thought that there was an issue with alienbob repository. Maybe the error message could be hidden and replaced by a warning when SEARCH_CLOG_INPARENT=on.

Here are cosmetic comments:
In slackpkgplus.conf:
- the default value of SEARCH_CLOG_INPARENT is not mentioned in the comments
- typo error in comments for STRICTGPG: heterogeneous
In README:
- there is no info for parameter SEARCH_CLOG_INPARENT

Finally, I don't understand the verb "bird" in
Quote:

1.7 was bird as a more tested release
or (in README)
Quote:

slackpkg was bird to install slackware packages from official mirrors
Could you please explain? If it's a technical term, I'm sorry for my lack of tech knowledge.

Thanks again to you and the other developers for this wonderful tool.

zerouno 06-07-2016 05:16 PM

Quote:

Originally Posted by gegechris99 (Post 5557425)
The search of changelog.txt in parent directory for alienbob current repository worked. I'm just wondering if it's wise to show in the stderr log that there is an error when looking into the initial directory. I was a bit confused initially and thought that there was an issue with alienbob repository. Maybe the error message could be hidden and replaced by a warning when SEARCH_CLOG_INPARENT=on.

'slackpkg update' use by default wget; the error was not removed for trasparency, so you know what it are doing. The same thing is when a CHECKSUMS.MD5.asc or a MANIFEST.bz2 or other was not found becouse the repository does not contain it.
If you want a quicker/simplest output you can set CACHEUPDATE=on
It cache most metadata files so further updates are faster and give you a compact output.

Quote:

- the default value of SEARCH_CLOG_INPARENT is not mentioned in the comments
in slackpkgplus.conf:
Quote:

# Defines if the changelog of any 3rd party repository must be searched in parent URL when not found in base URL.
# Can be set to "on" or "off" (default)
SEARCH_CLOG_INPARENT=on
Quote:

- typo error in comments for STRICTGPG: heterogeneous
- there is no info for parameter SEARCH_CLOG_INPARENT
thankyou

Quote:

Finally, I don't understand the verb "bird" in or (in README)
ops... google translate fails :D
"slackpkg was born to install..." :)

You can found the new fix on github

gegechris99 06-08-2016 01:22 AM

Quote:

Originally Posted by zerouno (Post 5557450)
If you want a quicker/simplest output you can set CACHEUPDATE=on
It cache most metadata files so further updates are faster and give you a compact output.

Thanks, I set the parameter and, indeed, the update is quicker :)

Quote:

# Defines if the changelog of any 3rd party repository must be searched in parent URL when not found in base URL.
# Can be set to "on" or "off" (default)
SEARCH_CLOG_INPARENT=on
Why does the comments say that default value is "off" while the parameter is set to "on" when I install the package? I would have expected the default value to be the one that is shipped with the package (here I would say that the default value is "on").

zerouno 06-08-2016 01:30 AM

Quote:

Originally Posted by gegechris99 (Post 5557590)
Why does the comments say that default value is "off" while the parameter is set to "on" when I install the package? I would have expected the default value to be the one that is shipped with the package (here I would say that the default value is "on").

If you miss the parameter, or you set to someother different from 'on', slackpkg+ set it to off.
But unless you have no problems you are encouraged to set it to on.

gegechris99 06-08-2016 02:34 AM

OK thanks for explanation.

zerouno 06-12-2016 12:59 PM

Slackpkg+ 1.7 released in main stable tree http://slakfinder.org/slackpkg+/

who has already installed it from slackpkg+1.7/ needs to run slackpkg reinstall slackpkg+



Thank's all for contributing, for code developing, for bug fixing, for suggests, for testing and any other support.


All times are GMT -5. The time now is 08:31 AM.