[pacman-dev] [PATCH] Improve changelog handling

Andrew Fyfe andrew at neptune-one.net
Fri Dec 7 13:20:06 EST 2007


Allan McRae wrote:
> +            if(strcmp(entry_name, ".CHANGELOG") == 0) {       
> +                tmpfile = strdup("/tmp/alpm_XXXXXX");
> +                fd = mkstemp(tmpfile);
> +                archive_read_data_into_fd(archive, fd);
> +                break;
> +            }
> +        }
> +        snprintf(clfile, PATH_MAX, "%s", tmpfile);
> +    }
> +
> +    FILE* fp = fopen(clfile, "r");
> +    if(fp == NULL){
> +        return cl;
> +    }   
> +
> +    while(!feof(fp)) {
> +        fgets(line, (int)PATH_MAX, fp);
> +        cl = alpm_list_add(cl, strdup(line));
> +    }
> +    fclose(fp);
> +
> +    if(pkg->origin == PKG_FROM_FILE) {
> +        unlink(tmpfile);
> +        FREE(tmpfile);
> +        close(fd);
> +    }

One small suggestion, has anyone worked out how to read a file directly 
from an archive using libarchive rather than extracting to a temp file 
then reading the temp file? It would be useful here and where we read 
.PKGINFO

Andrew




More information about the pacman-dev mailing list